# kubewatch

[kubewatch](https://github.com/bitnami-labs/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 repo add bitnami https://charts.bitnami.com/bitnami
helm install my-release bitnami/kubewatch
```

## Introduction

This chart bootstraps a kubewatch deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes 1.12+
- Helm 3.1.0

## Installing the Chart

To install the chart with the release name `my-release`:

```console
helm install my-release bitnami/kubewatch
```

The command deploys kubewatch on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) 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.

## Parameters

### Global parameters

Example:

```yaml
global:
  imageRegistry: myRegistryName
  imagePullSecrets:
    - myRegistryKeySecretName
```

| Name                      | Description                                     | Value |
| ------------------------- | ----------------------------------------------- | ----- |
| `global.imageRegistry`    | Global Docker image registry                    | `""`  |
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]`  |

### Common parameters

This section contains parameters common to most of the Helm Charts in the wild
as they are mainly auto-generated by initializing a new Helm Chart directory.

It even supports multiple lines and [Link parsing](#common-parameters).

| Name                | Description                                        | Value |
| ------------------- | -------------------------------------------------- | ----- |
| `nameOverride`      | String to partially override common.names.fullname | `""`  |
| `fullnameOverride`  | String to fully override common.names.fullname     | `""`  |
| `commonLabels`      | Labels to add to all deployed objects              | `{}`  |
| `commonAnnotations` | Annotations to add to all deployed objects         | `{}`  |
| `extraDeploy`       | Array of extra objects to deploy with the release  | `[]`  |
| `hostAliases`       | Add deployment host aliases                        | `[]`  |

### Kubewatch parameters

This description starts in a new line instead of the same line of description start tag. It does not have multiple lines.

| Name                                     | Description                                         | Value                       |
| ---------------------------------------- | --------------------------------------------------- | --------------------------- |
| `image.registry`                         | Kubewatch image registry                            | `REGISTRY_NAME`             |
| `image.repository`                       | Kubewatch image name                                | `REPOSITORY_NAME/kubewatch` |
| `image.pullPolicy`                       | Kubewatch image pull policy                         | `IfNotPresent`              |
| `image.pullSecrets`                      | Specify docker-registry secret names as an array    | `[]`                        |
| `slack.enabled`                          | Enable Slack notifications                          | `true`                      |
| `slack.channel`                          | Slack channel to notify                             | `XXXX`                      |
| `slack.token`                            | Slack API token                                     | `XXXX`                      |
| `hipchat.enabled`                        | Enable HipChat notifications                        | `false`                     |
| `hipchat.room`                           | HipChat room to notify                              | `""`                        |
| `hipchat.token`                          | HipChat token                                       | `""`                        |
| `hipchat.url`                            | HipChat URL                                         | `""`                        |
| `mattermost.enabled`                     | Enable Mattermost notifications                     | `false`                     |
| `mattermost.channel`                     | Mattermost channel to notify                        | `""`                        |
| `mattermost.username`                    | Mattermost user to notify                           | `""`                        |
| `mattermost.url`                         | Mattermost URL                                      | `""`                        |
| `flock.enabled`                          | Enable Flock notifications                          | `false`                     |
| `flock.url`                              | Flock URL                                           | `""`                        |
| `msteams.enabled`                        | Enable Microsoft Teams notifications                | `false`                     |
| `msteams.webhookurl`                     | Microsoft Teams webhook URL                         | `""`                        |
| `webhook`                                | Enable Webhook notifications                        | `{}`                        |
| `smtp.enabled`                           | Enable SMTP (email) notifications                   | `false`                     |
| `smtp.to`                                | Destination email address (required)                | `""`                        |
| `smtp.from`                              | Source email address (required)                     | `""`                        |
| `smtp.hello`                             | SMTP hello field (optional)                         | `""`                        |
| `smtp.smarthost`                         | SMTP server address (name:port) (required)          | `""`                        |
| `smtp.subject`                           | SMTP subject for the email                          | `""`                        |
| `smtp.requireTLS`                        | Force STARTTLS                                      | `false`                     |
| `smtp.auth.username`                     | Username for LOGIN and PLAIN auth mech              | `""`                        |
| `smtp.auth.password`                     | Password for LOGIN and PLAIN auth mech              | `""`                        |
| `smtp.auth.secret`                       | Secret for CRAM-MD5 auth mech                       | `""`                        |
| `smtp.auth.identity`                     | Identity for PLAIN auth mech                        | `""`                        |
| `namespaceToWatch`                       | Namespace to watch, leave it empty for watching all | `""`                        |
| `resourcesToWatch.pod`                   | Watch changes to Pods                               | `true`                      |
| `resourcesToWatch.deployment`            | Watch changes to Deployments                        | `true`                      |
| `resourcesToWatch.replicationcontroller` | Watch changes to ReplicationControllers             | `false`                     |
| `resourcesToWatch.replicaset`            | Watch changes to ReplicaSets                        | `false`                     |
| `resourcesToWatch.daemonset`             | Watch changes to DaemonSets                         | `false`                     |
| `resourcesToWatch.services`              | Watch changes to Services                           | `false`                     |
| `resourcesToWatch.job`                   | Watch changes to Jobs                               | `false`                     |
| `resourcesToWatch.persistentvolume`      | Watch changes to PersistentVolumes                  | `false`                     |

### Deployment parameters

| Name                                                  | Description                                                                                                                    | Value        |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------ |
| `command`                                             | Override default container command (useful when using custom images)                                                           | `[]`         |
| `args`                                                | Override default container args (useful when using custom images)                                                              | `[]`         |
| `extraEnvVars[0].name`                                | Name of the env var                                                                                                            | `FOO`        |
| `extraEnvVars[0].value`                               | Value for the env var                                                                                                          | `bar`        |
| `extraEnvVarsCM`                                      | Name of existing ConfigMap containing extra env vars                                                                           | `""`         |
| `extraEnvVarsSecret`                                  | Name of existing Secret containing extra env vars                                                                              | `""`         |
| `replicaCount`                                        | Number of Kubewatch replicas to deploy                                                                                         | `1`          |
| `podSecurityContext.enabled`                          | Enabled Kubewatch pods' Security Context                                                                                       | `false`      |
| `podSecurityContext.fsGroup`                          | Set Kubewatch pod's Security Context fsGroup                                                                                   | `1001`       |
| `containerSecurityContext.enabled`                    | Enabled Kubewatch containers' Security Context                                                                                 | `false`      |
| `containerSecurityContext.runAsUser`                  | Set Kubewatch container's Security Context runAsUser                                                                           | `1001`       |
| `containerSecurityContext.runAsNonRoot`               | Set Kubewatch container's Security Context runAsNonRoot                                                                        | `true`       |
| `livenessProbe.enabled`                               | Enable livenessProbe                                                                                                           | `false`      |
| `livenessProbe.initialDelaySeconds`                   | Initial delay seconds for livenessProbe                                                                                        | `10`         |
| `livenessProbe.periodSeconds`                         | Period seconds for livenessProbe                                                                                               | `10`         |
| `livenessProbe.timeoutSeconds`                        | Timeout seconds for livenessProbe                                                                                              | `1`          |
| `livenessProbe.failureThreshold`                      | Failure threshold for livenessProbe                                                                                            | `3`          |
| `livenessProbe.successThreshold`                      | Success threshold for livenessProbe                                                                                            | `1`          |
| `readinessProbe.enabled`                              | Enable readinessProbe                                                                                                          | `false`      |
| `readinessProbe.initialDelaySeconds`                  | Initial delay seconds for readinessProbe                                                                                       | `10`         |
| `readinessProbe.periodSeconds`                        | Period seconds for readinessProbe                                                                                              | `10`         |
| `readinessProbe.timeoutSeconds`                       | Timeout seconds for readinessProbe                                                                                             | `1`          |
| `readinessProbe.failureThreshold`                     | Failure threshold for readinessProbe                                                                                           | `3`          |
| `readinessProbe.successThreshold`                     | Success threshold for readinessProbe                                                                                           | `1`          |
| `customLivenessProbe`                                 | Override default liveness probe                                                                                                | `{}`         |
| `customReadinessProbe`                                | Override default readiness probe                                                                                               | `{}`         |
| `podAffinityPreset`                                   | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard`                                            | `""`         |
| `podAntiAffinityPreset`                               | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard`                                       | `soft`       |
| `nodeAffinityPreset.type`                             | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard`                                      | `""`         |
| `nodeAffinityPreset.key`                              | Node label key to match. Ignored if `affinity` is set                                                                          | `""`         |
| `nodeAffinityPreset.values`                           | Node label values to match. Ignored if `affinity` is set                                                                       | `[]`         |
| `affinity`                                            | Affinity for pod assignment                                                                                                    | `{}`         |
| `nodeSelector`                                        | Node labels for pod assignment                                                                                                 | `{}`         |
| `tolerations`                                         | Tolerations for pod assignment                                                                                                 | `[]`         |
| `podLabels`                                           | Extra labels for Kubewatch pods                                                                                                | `{}`         |
| `podAnnotations`                                      | Annotations for Kubewatch pods                                                                                                 | `{}`         |
| `extraVolumes`                                        | Optionally specify extra list of additional volumes for Kubewatch pods                                                         | `[]`         |
| `extraVolumeMounts`                                   | Optionally specify extra list of additional volumeMounts for Kubewatch container(s)                                            | `[]`         |
| `initContainers`                                      | Add additional init containers to the Kubewatch pods                                                                           | `{}`         |
| `sidecars`                                            | Add additional sidecar containers to the Kubewatch pods                                                                        | `{}`         |
| `rbac.create`                                         | Weather to create & use RBAC resources or not                                                                                  | `false`      |
| `serviceAccount.create`                               | Enable the creation of a ServiceAccount for Kubewatch pods                                                                     | `true`       |
| `serviceAccount.name`                                 | Name of the created ServiceAccount                                                                                             | `""`         |
| `inventedArray`                                       | Test parameter to check arrays                                                                                                 | `["a","b"]`  |
| `arrayModifier`                                       | Test parameter for modifier array                                                                                              | `[]`         |
| `configuration`                                       | haproxy configuration                                                                                                          | `""`         |
| `jobs[0].nameOverride`                                | String to partially override jobs.names.fullname                                                                               | `""`         |
| `jobs[0].fullnameOverride`                            | String to fully override jobs.names.fullname                                                                                   | `""`         |
| `jobs[0].resources.limits`                            | The resources limits override for the Job                                                                                      | `{}`         |
| `jobs[0].newOption.subArray[0].object`                | Test object inside Arrat                                                                                                       | `a`          |
| `jobs[0].newOption.subArray[0].plainArray`            | Test nested arrays                                                                                                             | `["b"]`      |
| `jobs[0].newOption.subArray[0].threeLevelsArray[0].c` | Test 3 levels array                                                                                                            | `d`          |
| `jobs[0].newOption.subArray[0].emptyObject`           | Empty object                                                                                                                   | `{}`         |
| `extraTest`                                           | An object that we want to document even though it is not at the end of the YAML tree                                           |              |
| `extraTest.content`                                   | Content of the object                                                                                                          | `whatever`   |
| `forceSchemaArrayModifier`                            | The parameter should appear completely into the schema but with the modifier value into the README                             | `[]`         |
| `linkInDescription`                                   | Link with square brackets present in description. [More information here](#deployment-parameters).                             | `{}`         |
| `nullable`                                            | Nullable parameter                                                                                                             | `nil`        |
| `nullableNullStringWithValueChange`                   | Nullable null string. We apply string modifier that will change the type and value, but the schema will show `nullable: true`. | `""`         |
| `nullableNullArray`                                   | Nullable null array. We apply array modifier that will change the type in the schema plus `nullable: true`.                    | `nil`        |
| `nullableNullString`                                  | Nullable null string. We apply string modifier to avoid infering an object type. The null must be preverved as value.          | `nil`        |
| `nullableNotNull`                                     | Nullable parameter with a non null value                                                                                       | `somestring` |
| `nullableObject`                                      | Nullable parameter with an object value                                                                                        | `{}`         |
| `nullableArray`                                       | Nullable parameter with an array value                                                                                         | `[]`         |
| `arrayEmptyModifier`                                  | Test empty array modifier                                                                                                      | `[]`         |
| `annotations.prometheus.io/scrape`                    | A Prometheus annotation                                                                                                        | `true`       |
| `weird.key.with.weird.format/and.object`              | A weird key with weird format and an object inside.                                                                            | `asValue`    |

### Regression tests

| Name                                                 | Description              | Value     |
| ---------------------------------------------------- | ------------------------ | --------- |
| `foo.file.ext.foo`                                   | A weird key with a list. | `["bar"]` |
| `vault.annotations.vault.hashicorp.com/agent-inject` | Some desc                | `true`    |
| `stack.mode`                                         | way to deploy            | `nil`     |
| `stack.version`                                      | version of the stack     | `8.10.3`  |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

```console
helm install my-release bitnami/kubewatch \
  --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 my-release -f values.yaml bitnami/kubewatch
```

> **Tip**: You can use the default [values.yaml](values.yaml)
