diff --git a/incubator/kubewatch/Chart.yaml b/incubator/kubewatch/Chart.yaml index cbc436e8b0..6778e31a85 100644 --- a/incubator/kubewatch/Chart.yaml +++ b/incubator/kubewatch/Chart.yaml @@ -1,13 +1,12 @@ +deprecated: true # moved to stable name: kubewatch -version: 0.2.1 +version: 0.2.2 appVersion: v0.0.3 -description: Kubewatch notifies your slack rooms when changes to your cluster occur +description: DEPRECATED Kubewatch notifies your slack rooms when changes to your cluster occur +home: https://github.com/skippbox/kubewatch keywords: - kubernetes - slack -maintainers: -- name: compleatang - email: casey@monax.io sources: - https://github.com/skippbox/kubewatch engine: gotpl diff --git a/incubator/kubewatch/README.md b/incubator/kubewatch/README.md index 4a65749394..84d7c886f0 100644 --- a/incubator/kubewatch/README.md +++ b/incubator/kubewatch/README.md @@ -2,6 +2,7 @@ [kubewatch](https://github.com/skippbox/kubewatch) is a Kubernetes watcher that currently publishes notification to Slack. Run it in your k8s cluster, and you will get event notifications in a slack channel. +**N.B. this chart is deprecated and has been [moved to stable](../../stable/kubewatch).** ## TL;DR; diff --git a/incubator/kubewatch/templates/NOTES.txt b/incubator/kubewatch/templates/NOTES.txt index 2eec79ffe6..d7b3e0bb22 100644 --- a/incubator/kubewatch/templates/NOTES.txt +++ b/incubator/kubewatch/templates/NOTES.txt @@ -1,3 +1,7 @@ To verify that kubewatch has started, run: kubectl --namespace={{ .Release.Namespace }} get pods -l "app={{ template "kubewatch.name" . }},release={{ .Release.Name }}" + +**N.B.** This chart is deprecated and has been replaced with +the same named chart in the stable repository. Please use +the stable repository's chart moving forward. diff --git a/incubator/kubewatch/values.yaml b/incubator/kubewatch/values.yaml index d7a67d56c4..7d1a8e26e7 100644 --- a/incubator/kubewatch/values.yaml +++ b/incubator/kubewatch/values.yaml @@ -1,10 +1,10 @@ slack: # Slack channel to notify - channel: "" + channel: "XXXX" # Slack bots token. Create using: https://my.slack.com/services/new/bot # and invite the bot to your channel using: /join @botname - token: "" + token: "XXXX" # Resources to watch resourcesToWatch: diff --git a/stable/kubewatch/.helmignore b/stable/kubewatch/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/kubewatch/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/stable/kubewatch/Chart.yaml b/stable/kubewatch/Chart.yaml new file mode 100644 index 0000000000..f9135fc627 --- /dev/null +++ b/stable/kubewatch/Chart.yaml @@ -0,0 +1,15 @@ +name: kubewatch +version: 0.3.0 +apiVersion: v1 +appVersion: v0.0.3 +home: https://github.com/skippbox/kubewatch +description: Kubewatch notifies your slack rooms when changes to your cluster occur +keywords: +- kubernetes +- slack +maintainers: +- name: compleatang + email: casey@monax.io +sources: +- https://github.com/skippbox/kubewatch +engine: gotpl diff --git a/stable/kubewatch/README.md b/stable/kubewatch/README.md new file mode 100644 index 0000000000..b4d4a2e8eb --- /dev/null +++ b/stable/kubewatch/README.md @@ -0,0 +1,87 @@ +# kubewatch + +[kubewatch](https://github.com/skippbox/kubewatch) is a Kubernetes watcher that currently publishes notification to Slack. Run it in your k8s cluster, and you will get event notifications in a slack channel. + + +## TL;DR; + +```console +$ helm install stable/kubewatch +``` + +## Introduction + +This chart bootstraps a kubewatch deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +$ helm install stable/kubewatch --name my-release +``` + +The command deploys kubewatch on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following tables lists the configurable parameters of the kubewatch chart and their default values. + +Parameter | Description | Default +--- | --- | --- +`affinity` | node/pod affinities | None +`image.repository` | Image repository | `tuna/kubewatch` +`image.tag` | Image tag | `v0.0.3` +`image.pullPolicy` | Image pull policy | `IfNotPresent` +`nodeSelector` | node labels for pod assignment | `{}` +`podAnnotations` | annotations to add to each pod | `{}` +`podLabels` | additional labesl to add to each pod | `{}` +`rbac.create` | If true, create & use RBAC resources | `true` +`serviceAccount.create` | If true, create a serviceAccount | `true` +`serviceAccount.name` | existing ServiceAccount to use (ignored if rbac.create=true) | `` +`replicaCount` | desired number of pods | `1` +`resourcesToWatch` | list of resources which kubewatch should watch and notify slack | `{pod: true, deployment: true}` +`resourcesToWatch.pod` | watch changes to [Pods](https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/) | `true` +`resourcesToWatch.deployment` | watch changes to [Deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) | `true` +`resourcesToWatch.replicationcontroller` | watch changes to [ReplicationControllers](https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/) | `false` +`resourcesToWatch.replicaset` | watch changes to [ReplicaSets](https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/) | `false` +`resourcesToWatch.daemonset` | watch changes to [DaemonSets](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/) | `false` +`resourcesToWatch.services` | watch changes to [Services](https://kubernetes.io/docs/concepts/services-networking/service/) | `false` +`resourcesToWatch.job` | watch changes to [Jobs](https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/) | `false` +`resourcesToWatch.persistentvolume` | watch changes to [PersistentVolumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) | `false` +`resources` | pod resource requests & limits | `{}` +`slack.channel` | slack channel to notify | `""` +`slack.token` | slack API token | `""` +`tolerations` | List of node taints to tolerate (requires Kubernetes >= 1.6) | `[]` + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install stable/kubewatch --name my-release \ + --set=slack.channel="#bots",slack.token="XXXX-XXXX-XXXX" +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +$ helm install stable/kubewatch --name my-release -f values.yaml +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Create a Slack bot + +Open [https://my.slack.com/services/new/bot](https://my.slack.com/services/new/bot) to create a new Slack bot. +The API token can be found on the edit page (it starts with `xoxb-`). + +Invite the Bot to your channel by typing `/join @name_of_your_bot` in the Slack message area. diff --git a/stable/kubewatch/templates/NOTES.txt b/stable/kubewatch/templates/NOTES.txt new file mode 100644 index 0000000000..2eec79ffe6 --- /dev/null +++ b/stable/kubewatch/templates/NOTES.txt @@ -0,0 +1,3 @@ +To verify that kubewatch has started, run: + + kubectl --namespace={{ .Release.Namespace }} get pods -l "app={{ template "kubewatch.name" . }},release={{ .Release.Name }}" diff --git a/stable/kubewatch/templates/_helpers.tpl b/stable/kubewatch/templates/_helpers.tpl new file mode 100644 index 0000000000..3e3d9656f0 --- /dev/null +++ b/stable/kubewatch/templates/_helpers.tpl @@ -0,0 +1,44 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "kubewatch.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "kubewatch.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "kubewatch.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{/* +Create the name of the service account to use +*/}} +{{- define "kubewatch.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "kubewatch.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/stable/kubewatch/templates/clusterrole.yaml b/stable/kubewatch/templates/clusterrole.yaml new file mode 100644 index 0000000000..bd3e79b689 --- /dev/null +++ b/stable/kubewatch/templates/clusterrole.yaml @@ -0,0 +1,25 @@ +{{- if .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + labels: + app: {{ template "kubewatch.name" . }} + chart: {{ template "kubewatch.chart" . }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "kubewatch.fullname" . }} +rules: + - apiGroups: + - "" + resources: + - pods + - namespaces + - services + - deployments + - replicationcontrollers + - replicasets + - daemonsets + verbs: + - list + - watch +{{- end -}} diff --git a/stable/kubewatch/templates/clusterrolebinding.yaml b/stable/kubewatch/templates/clusterrolebinding.yaml new file mode 100644 index 0000000000..b309c5f537 --- /dev/null +++ b/stable/kubewatch/templates/clusterrolebinding.yaml @@ -0,0 +1,19 @@ +{{- if .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + labels: + app: {{ template "kubewatch.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "kubewatch.fullname" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ template "kubewatch.fullname" . }} +subjects: + - kind: ServiceAccount + name: {{ template "kubewatch.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{- end -}} \ No newline at end of file diff --git a/stable/kubewatch/templates/configmap.yaml b/stable/kubewatch/templates/configmap.yaml new file mode 100644 index 0000000000..51fc3babc4 --- /dev/null +++ b/stable/kubewatch/templates/configmap.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: {{ template "kubewatch.name" . }} + chart: {{ template "kubewatch.chart" . }} + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" + name: {{ template "kubewatch.fullname" . }}-config +data: + .kubewatch.yaml: | + handler: + slack: +{{ toYaml .Values.slack | indent 8 }} + resource: +{{ toYaml .Values.resourcesToWatch | indent 6 }} diff --git a/stable/kubewatch/templates/deployment.yaml b/stable/kubewatch/templates/deployment.yaml new file mode 100644 index 0000000000..d3fbc63ff9 --- /dev/null +++ b/stable/kubewatch/templates/deployment.yaml @@ -0,0 +1,55 @@ +apiVersion: apps/v1beta2 +kind: Deployment +metadata: + labels: + app: {{ template "kubewatch.name" . }} + chart: {{ template "kubewatch.chart" . }} + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" + name: {{ template "kubewatch.fullname" . }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "kubewatch.name" . }} + release: {{ .Release.Name }} + template: + metadata: + annotations: + checksum/config-map: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- if .Values.podAnnotations }} +{{ toYaml .Values.podAnnotations | indent 8 }} + {{- end }} + labels: + app: {{ template "kubewatch.name" . }} + release: "{{ .Release.Name }}" + {{- if .Values.podLabels }} +{{ toYaml .Values.podLabels | indent 8 }} + {{- end }} + spec: + containers: + - name: {{ template "kubewatch.name" . }} + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: {{ template "kubewatch.name" . }}-config-map + mountPath: /root + resources: +{{ toYaml .Values.resources | indent 10 }} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 8 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} + serviceAccountName: {{ template "kubewatch.serviceAccountName" . }} + tolerations: +{{ toYaml .Values.tolerations | indent 8 }} + restartPolicy: Always + volumes: + - name: {{ template "kubewatch.name" . }}-config-map + configMap: + name: {{ template "kubewatch.fullname" . }}-config + diff --git a/stable/kubewatch/templates/servieaccount.yaml b/stable/kubewatch/templates/servieaccount.yaml new file mode 100644 index 0000000000..82b18d4730 --- /dev/null +++ b/stable/kubewatch/templates/servieaccount.yaml @@ -0,0 +1,11 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app: {{ template "kubewatch.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "kubewatch.serviceAccountName" . }} +{{- end -}} \ No newline at end of file diff --git a/stable/kubewatch/values.yaml b/stable/kubewatch/values.yaml new file mode 100644 index 0000000000..fc77c7d412 --- /dev/null +++ b/stable/kubewatch/values.yaml @@ -0,0 +1,59 @@ +slack: + # Slack channel to notify + channel: "XXXX" + + # Slack bots token. Create using: https://my.slack.com/services/new/bot + # and invite the bot to your channel using: /join @botname + token: "XXXX" + +# Resources to watch +resourcesToWatch: + deployment: true + replicationcontroller: false + replicaset: false + daemonset: false + services: false + pod: true + job: false + persistentvolume: false + +image: + repository: "tuna/kubewatch" + tag: "v0.0.3" + pullPolicy: "IfNotPresent" + +rbac: + # If true, create & use RBAC resources + # + create: true + +serviceAccount: + # Specifies whether a ServiceAccount should be created + create: true + # The name of the ServiceAccount to use. + # If not set and create is true, a name is generated using the fullname template + name: + +resources: {} + # limits: + # cpu: 100m + # memory: 300Mi + # requests: + # cpu: 100m + # memory: 300Mi + +# Affinity for pod assignment +# Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +# affinity: {} + +# Tolerations for pod assignment +# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +tolerations: [] + +# Node labels for pod assignment +# Ref: https://kubernetes.io/docs/user-guide/node-selection/ +nodeSelector: {} + +podAnnotations: {} +podLabels: {} +replicaCount: 1