# Dead mans Switch

A Helm chart based on [Pingcap's dead-mans-switch](https://github.com/pingcap/dead-mans-switch) for Prometheus' Alertmanager. This Helm chart does not modify the Pingcap's dead man's switch image in any way.

This Helm chart provides a simple way to install a dead man's switch for Alertmanager integrated with Pagerduty. A dead man's switch in Prometheus is a simple alert that is always firing, to test that the alerting pipeline is healthy. This dead man's switch integrates with Pagerduty, so that if this "always firing alert" is not firing (e.g. the "watchdog" alert from [kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/general.rules.yaml)), a notification will be sent to Pagerduty.

## Installation

To install the chart, run:

```bash
$ helm repo add empathy-public https://empathyco.github.io/helm-charts
$ helm install my-release empathy-public/deadman-switch
```

## Configuration

[Pingcap's dead-mans-switch](https://github.com/pingcap/dead-mans-switch) is configured through a [YAML file](https://github.com/pingcap/dead-mans-switch/blob/master/manifest/config.example.yaml), mounted in the container as a secret in this Helm chart. The contents of this YAML file should be included in the `secret` parameter of the Helm chart `values.yaml`.

### Alertmanager configuration

Taken from [Pingcap's dead-mans-switch](https://github.com/pingcap/dead-mans-switch), Alertmanager should be configured as follows:

Create a route for the always firing alert in Alertmanager:
```yaml
route:
  routes:
    - receiver: dead-mans-switch
      group_wait: 10s
      group_interval: 30s
      repeat_interval: 15s
      match:
        alertname: 'Watchdog'
```

Use the Kubernetes service as a webhook receiver:
```yaml
receivers:
- name: dead-mans-switch
  webhook_configs:
  - url: http://<DEAD-MANS-SWITCH-SVC>:8080/webhook
```

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Kubernetes pod affinity |
| fullnameOverride | string | `""` | Chart full name override |
| image.pullPolicy | string | `"IfNotPresent"` | Image pullpolicy |
| image.repository | string | `"gcr.io/pingcap-public/deadmansswitch"` | Image repository |
| image.tag | string | `"1.0"` | Image tag |
| imagePullSecrets | list | `[]` | Image pull secrets |
| metrics.grafanaDashboard.enabled | bool | `false` | Create Grafana dashboard |
| metrics.grafanaDashboard.labels | object | `{"grafana_dashboard":"1"}` | Grafana dashboards sidecar labels |
| metrics.grafanaDashboard.namespace | string | `"monitoring"` | Namespace for the Grafana dashboard |
| metrics.prometheusRule.enabled | bool | `false` | if true, creates a Prometheus Operator PrometheusRule |
| metrics.prometheusRule.namespace | string | `""` | Namespace for the PrometheusRule Resource |
| metrics.prometheusRule.rules | list | `[]` | Prometheus Rule definitions |
| metrics.prometheusRule.selector | object | `{}` | Prometheus instance selector labels |
| metrics.serviceMonitor.enabled | bool | `false` | if true, creates a Prometheus Operator ServiceMonitor |
| metrics.serviceMonitor.interval | string | `nil` | Interval at which metrics should be scraped. |
| metrics.serviceMonitor.namespace | string | `""` | Namespace for the ServiceMonitor Resource (defaults to the Release Namespace). |
| metrics.serviceMonitor.scrapeTimeout | string | `nil` | Timeout after which the scrape is ended  |
| metrics.serviceMonitor.selector | object | `{}` | Prometheus instance selector labels |
| nameOverride | string | `""` | Chart name override |
| nodeSelector | object | `{}` | Kubernetes node selector |
| podAnnotations | object | `{}` | Custom pod annotations |
| podSecurityContext | object | `{}` | Custom pod security context |
| replicaCount | int | `1` | Number of deployment replicas |
| resources | string | `nil` | Container resources |
| secret | object | `{"interval":"5m","notify":{"pagerduty":{"key":"your-pg-key"}}}` | Pingcap's dead-man-switch configuration as YAML. Please see https://github.com/pingcap/dead-mans-switch/blob/master/manifest/config.example.yaml |
| securityContext | object | `{}` | Custom container security context |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| tolerations | list | `[]` | Kubernetes tolerations |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
