-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into serviceaccount-clair
- Loading branch information
Showing
52 changed files
with
9,165 additions
and
0 deletions.
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
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,19 @@ | ||
apiVersion: v2 | ||
name: calert | ||
version: 0.0.1 | ||
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. | ||
type: application | ||
keywords: | ||
- monitoring | ||
- alerting | ||
- prometheus | ||
- alertmanager | ||
- alertmanager-webhook | ||
- google-chat | ||
home: https://github.com/mr-karan/calert | ||
sources: | ||
- https://github.com/mr-karan/calert | ||
maintainers: | ||
- name: Devtron Devops team | ||
email: [email protected] | ||
appVersion: 0.0.1 |
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,61 @@ | ||
# calert | ||
|
||
![Version: 2.0.3](https://img.shields.io/badge/Version-2.0.3-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. | ||
|
||
**Source Code:** <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'] | ||
``` | ||
# Parameters | ||
The following tables lists the configurable parameters of the chart and their default values. | ||
Change the values according to the need of the environment in ``contrib/helm/calert/values.yaml`` file. | ||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| app.address | string | `"0.0.0.0:6000"` | | | ||
| app.server_timeout | string | `"60s"` | | | ||
| app.enable_request_logs | bool | `true` | | | ||
| app.log | string | `"info"` | | | ||
| providers | object | `{}` | | | ||
| templates | object | `{}` | | | ||
| replicaCount | int | `1` | | | ||
| image.repository | string | `"ghcr.io/mr-karan/calert"` | | | ||
| image.tag | string | `"v2.0.2"` | | | ||
| image.pullPolicy | string | `"Always"` | | | ||
| args[0] | string | `"--config=/app/static/config.toml"` | | | ||
| nameOverride | string | `""` | | | ||
| fullnameOverride | string | `""` | | | ||
| service.type | string | `"ClusterIP"` | | | ||
| service.port | int | `6000` | | | ||
| ingress.enabled | bool | `false` | | | ||
| resources.limits.cpu | string | `"20m"` | | | ||
| resources.limits.memory | string | `"48Mi"` | | | ||
| resources.requests.cpu | string | `"5m"` | | | ||
| resources.requests.memory | string | `"24Mi"` | | | ||
| priorityClassName | string | `""` | | | ||
| nodeSelector | object | `{}` | | | ||
| tolerations | list | `[]` | | | ||
| affinity | object | `{}` | | | ||
| topologySpreadConstraints | list | `[]` | | | ||
| podAnnotations | object | `{}` | | |
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,34 @@ | ||
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: | ||
{{- range $key, $value := .Values.templates }} | ||
{{ $key }}: |- | ||
{{- $value | nindent 4 }} | ||
{{- end }} | ||
config.toml: | | ||
# All timeouts and durations are in milliseconds. | ||
[app] | ||
address = {{ .Values.app.address | quote }} | ||
server_timeout = {{ .Values.app.server_timeout | quote }} | ||
enable_request_logs = {{ .Values.app.enable_request_logs | quote }} | ||
log = {{ .Values.app.log | quote }} | ||
{{- range $key, $value := .Values.providers }} | ||
[providers.{{ $key }}] | ||
type = {{ $value.type | default "google_chat" | quote }} | ||
endpoint = {{ required "setting a endpoint for providers is requiered" $value.endpoint | quote }} | ||
max_idle_conns = {{ $value.max_idle_conns | default "50" }} | ||
timeout = {{ $value.timeout | default "30s" | quote }} | ||
proxy_url = {{ $value.proxy_url | default "" | quote }} | ||
template = {{ $value.template | default "static/message.tmpl" | quote }} | ||
thread_ttl = {{ $value.thread_ttl | default "12h" | quote }} | ||
dry_run = {{ $value.dry_run | default "false" | quote }} | ||
{{- 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,106 @@ | ||
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 }} | ||
{{- range $key, $value := .Values.podAnnotations }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "calert.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.priorityClassName }} | ||
priorityClassName: {{ . }} | ||
{{- end }} | ||
{{- if .Values.securityContext.enabled }} | ||
{{- with omit .Values.securityContext "enabled" }} | ||
securityContext: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
args: | ||
{{- range .Values.args }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
{{- if .Values.securityContext.enabled }} | ||
{{- with omit .Values.securityContext "enabled" "runAsGroup" "runAsUser" "runAsNonRoot" "windowsOptions" }} | ||
securityContext: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- 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 | ||
{{- range $key, $value := .Values.templates }} | ||
- key: {{ $key }} | ||
path: {{ $key }} | ||
{{- end }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.topologySpreadConstraints }} | ||
topologySpreadConstraints: | ||
{{- 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.