-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from weibo-zhao/helm-chart-v2
Add new version of calert helm chart
- Loading branch information
Showing
10 changed files
with
416 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# 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 | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
appVersion: 2.0.2 | ||
description: A Helm chart for the calert which uses Alertmanager webhook receiver to receive alerts payload, and pushes this data to Google Chat webhook endpoint. | ||
name: calert | ||
version: 2.0.2 | ||
icon: https://github.com/mr-karan/calert/raw/master/images/logo.png | ||
home: https://github.com/mr-karan/calert | ||
sources: | ||
- https://github.com/mr-karan/calert | ||
maintainers: | ||
- name: Karan Sharma | ||
email: karansharma1295@gmail.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# calert | ||
|
||
![Version: 2.0.2](https://img.shields.io/badge/Version-2.0.2-informational?style=flat-square) ![AppVersion: 2.0.2](https://img.shields.io/badge/AppVersion-2.0.2-informational?style=flat-square) | ||
|
||
A Helm chart for the calert which uses Alertmanager webhook receiver to receive alerts payload, and pushes this data to Google Chat webhook endpoint. | ||
|
||
**Homepage:** <https://github.com/mr-karan/calert> | ||
|
||
## Alertmanager Integration | ||
|
||
The Alertmanager helm chart can be found [here](https://github.com/prometheus-community/helm-charts/tree/main/charts/alertmanager). You can refer to the following config block to route webhook alerts to `calert`: | ||
|
||
```yml | ||
config: | ||
receivers: | ||
- name: 'calert' | ||
webhook_configs: | ||
- url: 'http://calert:6000/dispatch' | ||
|
||
route: | ||
receiver: 'calert' | ||
group_wait: 30s | ||
group_interval: 60s | ||
repeat_interval: 3h | ||
group_by: ['alertname'] | ||
``` | ||
## Maintainers | ||
| Name | Email | Url | | ||
| ---- | ------ | --- | | ||
| Karan Sharma | <karansharma1295@gmail.com> | | | ||
## Source Code | ||
* <https://github.com/mr-karan/calert> | ||
## Values | ||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| affinity | object | `{}` | | | ||
| args[0] | string | `"--config=/app/static/config.toml"` | | | ||
| configmap.app.address | string | `"0.0.0.0:6000"` | | | ||
| configmap.app.enable_request_logs | bool | `true` | | | ||
| configmap.app.log | string | `"info"` | | | ||
| configmap.app.server_timeout | string | `"5s"` | | | ||
| configmap.providers.dev_alerts.dry_run | bool | `false` | | | ||
| configmap.providers.dev_alerts.endpoint | string | `"https://chat.googleapis.com/v1/spaces/xxx/messages?key=key&token=token%3D"` | | | ||
| configmap.providers.dev_alerts.max_idle_conns | int | `50` | | | ||
| configmap.providers.dev_alerts.proxy_url | string | `"http://internal-squid-proxy.com:3128"` | | | ||
| configmap.providers.dev_alerts.template | string | `"static/message.tmpl"` | | | ||
| configmap.providers.dev_alerts.thread_ttl | string | `"12h"` | | | ||
| configmap.providers.dev_alerts.timeout | string | `"7s"` | | | ||
| configmap.providers.dev_alerts.type | string | `"google_chat"` | | | ||
| configmap.providers.prod_alerts.dry_run | bool | `false` | | | ||
| configmap.providers.prod_alerts.endpoint | string | `"https://chat.googleapis.com/v1/spaces/xxx/messages?key=key&token=token%3D"` | | | ||
| configmap.providers.prod_alerts.max_idle_conns | int | `50` | | | ||
| configmap.providers.prod_alerts.proxy_url | string | `"http://internal-squid-proxy.com:3128"` | | | ||
| configmap.providers.prod_alerts.template | string | `"static/message.tmpl"` | | | ||
| configmap.providers.prod_alerts.thread_ttl | string | `"12h"` | | | ||
| configmap.providers.prod_alerts.timeout | string | `"7s"` | | | ||
| configmap.providers.prod_alerts.type | string | `"google_chat"` | | | ||
| fullnameOverride | string | `""` | | | ||
| image.pullPolicy | string | `"Always"` | | | ||
| image.repository | string | `"ghcr.io/mr-karan/calert"` | | | ||
| image.tag | string | `"latest"` | | | ||
| ingress.enabled | bool | `false` | | | ||
| nameOverride | string | `""` | | | ||
| nodeSelector | object | `{}` | | | ||
| replicaCount | int | `1` | | | ||
| resources.limits.cpu | string | `"20m"` | | | ||
| resources.limits.memory | string | `"48Mi"` | | | ||
| resources.requests.cpu | string | `"5m"` | | | ||
| resources.requests.memory | string | `"24Mi"` | | | ||
| service.port | int | `6000` | | | ||
| service.type | string | `"ClusterIP"` | | | ||
| tolerations | list | `[]` | | | ||
|
||
---------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "calert.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "calert.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "calert.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "calert.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
echo "Visit http://127.0.0.1:{{ .Values.service.port }} to use your application" | ||
kubectl port-forward $POD_NAME {{ .Values.service.port }}:{{ .Values.service.port }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "calert.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 "calert.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 "calert.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "calert.labels" -}} | ||
app.kubernetes.io/name: {{ include "calert.name" . }} | ||
helm.sh/chart: {{ include "calert.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "calert.fullname" . }}-config | ||
labels: | ||
app: {{ template "calert.name" . }} | ||
chart: {{ template "calert.chart" . }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
data: | ||
message.tmpl: {{- toYaml .Values.template_file | indent 4 }} | ||
config.toml: | | ||
# All timeouts and durations are in milliseconds. | ||
[app] | ||
address = {{ .Values.configmap.app.address | quote }} | ||
server_timeout = {{ .Values.configmap.app.server_timeout | quote }} | ||
enable_request_logs = {{ .Values.configmap.app.enable_request_logs | quote }} | ||
log = {{ .Values.configmap.app.enable_request_logs | quote }} | ||
[providers.prod_alerts] | ||
type = {{ .Values.configmap.providers.prod_alerts.type | quote }} | ||
endpoint = {{ .Values.configmap.providers.prod_alerts.endpoint | quote }} | ||
max_idle_conns = {{ .Values.configmap.providers.prod_alerts.max_idle_conns | quote }} | ||
timeout = {{ .Values.configmap.providers.prod_alerts.timeout | quote }} | ||
proxy_url = {{ .Values.configmap.providers.prod_alerts.proxy_url | quote }} | ||
template = {{ .Values.configmap.providers.prod_alerts.template | quote }} | ||
thread_ttl = {{ .Values.configmap.providers.prod_alerts.thread_ttl | quote }} | ||
dry_run = {{ .Values.configmap.providers.prod_alerts.dry_run | quote }} | ||
[providers.dev_alerts] | ||
type = {{ .Values.configmap.providers.dev_alerts.type | quote }} | ||
endpoint = {{ .Values.configmap.providers.dev_alerts.endpoint | quote }} | ||
max_idle_conns = {{ .Values.configmap.providers.dev_alerts.max_idle_conns | quote }} | ||
timeout = {{ .Values.configmap.providers.dev_alerts.timeout | quote }} | ||
proxy_url = {{ .Values.configmap.providers.dev_alerts.proxy_url | quote }} | ||
template = {{ .Values.configmap.providers.dev_alerts.template | quote }} | ||
thread_ttl = {{ .Values.configmap.providers.dev_alerts.thread_ttl | quote }} | ||
dry_run = {{ .Values.configmap.providers.dev_alerts.dry_run | quote }} | ||
{{- with .Values.configmap.rooms }} | ||
{{ tpl . $ | indent 4 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "calert.fullname" . }} | ||
labels: | ||
{{ include "calert.labels" . | indent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "calert.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
annotations: | ||
# https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments | ||
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "calert.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
args: | ||
{{- range .Values.args }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
ports: | ||
- containerPort: {{ .Values.service.port }} | ||
protocol: TCP | ||
volumeMounts: | ||
- mountPath: /app/static/ | ||
name: config-dir | ||
livenessProbe: | ||
httpGet: | ||
httpHeaders: | ||
- name: X-Causation-ID | ||
value: kube-health | ||
path: "/ping" | ||
port: {{ .Values.service.port }} | ||
initialDelaySeconds: 10 | ||
periodSeconds: 60 | ||
timeoutSeconds: 3 | ||
readinessProbe: | ||
httpGet: | ||
httpHeaders: | ||
- name: X-Causation-ID | ||
value: kube-health | ||
path: "/ping" | ||
port: {{ .Values.service.port }} | ||
initialDelaySeconds: 10 | ||
periodSeconds: 60 | ||
timeoutSeconds: 3 | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
volumes: | ||
- name: config-dir | ||
configMap: | ||
name: {{ template "calert.fullname" . }}-config | ||
items: | ||
- key: config.toml | ||
path: config.toml | ||
- key: message.tmpl | ||
path: message.tmpl | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "calert.fullname" . }} | ||
labels: | ||
{{ include "calert.labels" . | indent 4 }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: {{ .Values.service.port }} | ||
protocol: TCP | ||
selector: | ||
app.kubernetes.io/name: {{ include "calert.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} |
Oops, something went wrong.