graduate kubewatch to stable (#3482)

This commit is contained in:
Casey Kuhlman
2018-04-25 12:24:02 -07:00
committed by k8s-ci-robot
parent 3ca25082a4
commit fa387df750
15 changed files with 366 additions and 7 deletions
+4 -5
View File
@@ -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
+1
View File
@@ -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;
+4
View File
@@ -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.
+2 -2
View File
@@ -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:
+21
View File
@@ -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
+15
View File
@@ -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
+87
View File
@@ -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.
+3
View File
@@ -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 }}"
+44
View File
@@ -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 -}}
@@ -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 -}}
@@ -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 -}}
+16
View File
@@ -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 }}
@@ -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
@@ -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 -}}
+59
View File
@@ -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