added repo

This commit is contained in:
Your Name
2026-08-26 03:39:42 +05:30
parent 45c25a95af
commit b8575bb8b9
6889 changed files with 1217125 additions and 0 deletions
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
@@ -0,0 +1,5 @@
apiVersion: v2
name: victoria-metrics-alert
description: Victoria Metrics Alert - executes a list of given MetricsQL expressions (rules) and sends alerts to Alert Manager.
version: 0.6.4
appVersion: v1.126.0
@@ -0,0 +1,229 @@
# Helm Chart For Victoria Metrics Alert.
![Version: 0.6.3](https://img.shields.io/badge/Version-0.6.3-informational?style=flat-square)
Victoria Metrics Alert - executes a list of given MetricsQL expressions (rules) and sends alerts to Alert Manager.
# Prerequisites
* Install the follow packages: ``git``, ``kubectl``, ``helm``, ``helm-docs``. See this [tutorial](../../REQUIREMENTS.md).
# How to install
Access a Kubernetes cluster.
Add a chart helm repository with follow commands:
```console
helm repo add vm https://victoriametrics.github.io/helm-charts/
helm repo update
```
List versions of ``vm/victoria-metrics-alert`` chart available to installation:
##### for helm v3
```console
helm search repo vm/victoria-metrics-alert -l
```
Export default values of ``victoria-metrics-alert`` chart to file ``values.yaml``:
```console
helm show values vm/victoria-metrics-alert > values.yaml
```
Change the values according to the need of the environment in ``values.yaml`` file.
Test the installation with command:
```console
helm install vmalert vm/victoria-metrics-alert -f values.yaml -n NAMESPACE --debug --dry-run
```
Install chart with command:
##### for helm v3
```console
helm install vmalert vm/victoria-metrics-alert -f values.yaml -n NAMESPACE
```
Get the pods lists by running this commands:
```console
kubectl get pods -A | grep 'alert'
```
Get the application by running this command:
```console
helm list -f vmalert -n NAMESPACE
```
See the history of versions of ``vmalert`` application with command.
```console
helm history vmalert -n NAMESPACE
```
## HA configuration for Alertmanager
There is no option on this chart to set up Alertmanager with [HA mode](https://github.com/prometheus/alertmanager#high-availability).
To enable the HA configuration, you can use:
- [VictoriaMetrics Operator](https://docs.victoriametrics.com/operator/VictoriaMetrics-Operator.html)
- official [Alertmanager Helm chart](https://github.com/prometheus-community/helm-charts/tree/main/charts/alertmanager)
# How to uninstall
Remove application with command.
```console
helm uninstall vmalert -n NAMESPACE
```
# Documentation of Helm Chart
Install ``helm-docs`` following the instructions on this [tutorial](../../REQUIREMENTS.md).
Generate docs with ``helm-docs`` command.
```bash
cd charts/victoria-metrics-alert
helm-docs
```
The markdown generation is entirely go template driven. The tool parses metadata from charts and generates a number of sub-templates that can be referenced in a template file (by default ``README.md.gotmpl``). If no template file is provided, the tool has a default internal template that will generate a reasonably formatted README.
# 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 ``victoria-metrics-alert/values.yaml`` file.
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| alertmanager.baseURL | string | `""` | |
| alertmanager.baseURLPrefix | string | `""` | |
| alertmanager.config.global.resolve_timeout | string | `"5m"` | |
| alertmanager.config.receivers[0].name | string | `"devnull"` | |
| alertmanager.config.route.group_by[0] | string | `"alertname"` | |
| alertmanager.config.route.group_interval | string | `"10s"` | |
| alertmanager.config.route.group_wait | string | `"30s"` | |
| alertmanager.config.route.receiver | string | `"devnull"` | |
| alertmanager.config.route.repeat_interval | string | `"24h"` | |
| alertmanager.configMap | string | `""` | |
| alertmanager.enabled | bool | `false` | |
| alertmanager.extraArgs | object | `{}` | |
| alertmanager.image | string | `"prom/alertmanager"` | |
| alertmanager.imagePullSecrets | list | `[]` | |
| alertmanager.ingress.annotations | object | `{}` | |
| alertmanager.ingress.enabled | bool | `false` | |
| alertmanager.ingress.extraLabels | object | `{}` | |
| alertmanager.ingress.hosts | list | `[]` | |
| alertmanager.ingress.pathType | string | `"Prefix"` | pathType is only for k8s >= 1.1= |
| alertmanager.ingress.tls | list | `[]` | |
| alertmanager.nodeSelector | object | `{}` | |
| alertmanager.persistentVolume.accessModes | list | `["ReadWriteOnce"]` | Array of access modes. Must match those of existing PV or dynamic provisioner. Ref: [http://kubernetes.io/docs/user-guide/persistent-volumes/](http://kubernetes.io/docs/user-guide/persistent-volumes/) |
| alertmanager.persistentVolume.annotations | object | `{}` | Persistant volume annotations |
| alertmanager.persistentVolume.enabled | bool | `false` | Create/use Persistent Volume Claim for alertmanager component. Empty dir if false |
| alertmanager.persistentVolume.existingClaim | string | `""` | Existing Claim name. If defined, PVC must be created manually before volume will be bound |
| alertmanager.persistentVolume.mountPath | string | `"/data"` | Mount path. Alertmanager data Persistent Volume mount root path. |
| alertmanager.persistentVolume.size | string | `"50Mi"` | Size of the volume. Better to set the same as resource limit memory property. |
| alertmanager.persistentVolume.storageClass | string | `""` | StorageClass to use for persistent volume. Requires alertmanager.persistentVolume.enabled: true. If defined, PVC created automatically |
| alertmanager.persistentVolume.subPath | string | `""` | Mount subpath |
| alertmanager.podMetadata.annotations | object | `{}` | |
| alertmanager.podMetadata.labels | object | `{}` | |
| alertmanager.podSecurityContext | object | `{}` | |
| alertmanager.priorityClassName | string | `""` | |
| alertmanager.resources | object | `{}` | |
| alertmanager.retention | string | `"120h"` | |
| alertmanager.service.annotations | object | `{}` | |
| alertmanager.service.port | int | `9093` | |
| alertmanager.service.type | string | `"ClusterIP"` | |
| alertmanager.tag | string | `"v0.25.0"` | |
| alertmanager.templates | object | `{}` | |
| alertmanager.tolerations | list | `[]` | |
| imagePullSecrets | list | `[]` | |
| rbac.annotations | object | `{}` | |
| rbac.create | bool | `true` | |
| rbac.extraLabels | object | `{}` | |
| rbac.namespaced | bool | `false` | |
| rbac.pspEnabled | bool | `true` | |
| server.affinity | object | `{}` | |
| server.annotations | object | `{}` | |
| server.config.alerts.groups | list | `[]` | |
| server.configMap | string | `""` | |
| server.datasource.basicAuth | object | `{"password":"","username":""}` | Basic auth for datasource |
| server.datasource.bearer.token | string | `""` | Token with Bearer token. You can use one of token or tokenFile. You don't need to add "Bearer" prefix string |
| server.datasource.bearer.tokenFile | string | `""` | Token Auth file with Bearer token. You can use one of token or tokenFile |
| server.datasource.url | string | `""` | |
| server.enabled | bool | `true` | |
| server.env | list | `[]` | Additional environment variables (ex.: secret tokens, flags) https://github.com/VictoriaMetrics/VictoriaMetrics#environment-variables |
| server.extraArgs."envflag.enable" | string | `"true"` | |
| server.extraArgs."envflag.prefix" | string | `"VM_"` | |
| server.extraArgs.loggerFormat | string | `"json"` | |
| server.extraContainers | list | `[]` | |
| server.extraHostPathMounts | list | `[]` | |
| server.extraVolumeMounts | list | `[]` | |
| server.extraVolumes | list | `[]` | |
| server.fullnameOverride | string | `""` | |
| server.image.pullPolicy | string | `"IfNotPresent"` | |
| server.image.repository | string | `"victoriametrics/vmalert"` | |
| server.image.tag | string | `""` | |
| server.ingress.annotations | object | `{}` | |
| server.ingress.enabled | bool | `false` | |
| server.ingress.extraLabels | object | `{}` | |
| server.ingress.hosts | list | `[]` | |
| server.ingress.pathType | string | `"Prefix"` | pathType is only for k8s >= 1.1= |
| server.ingress.tls | list | `[]` | |
| server.labels | object | `{}` | |
| server.minReadySeconds | int | `0` | |
| server.name | string | `"server"` | |
| server.nameOverride | string | `""` | |
| server.nodeSelector | object | `{}` | |
| server.notifier | object | `{"alertmanager":{"basicAuth":{"password":"","username":""},"bearer":{"token":"","tokenFile":""},"url":""}}` | Notifier to use for alerts. Multiple notifiers can be enabled by using `notifiers` section |
| server.notifier.alertmanager.basicAuth | object | `{"password":"","username":""}` | Basic auth for alertmanager |
| server.notifier.alertmanager.bearer.token | string | `""` | Token with Bearer token. You can use one of token or tokenFile. You don't need to add "Bearer" prefix string |
| server.notifier.alertmanager.bearer.tokenFile | string | `""` | Token Auth file with Bearer token. You can use one of token or tokenFile |
| server.notifiers | list | `[]` | Additional notifiers to use for alerts |
| server.podAnnotations | object | `{}` | |
| server.podDisruptionBudget.enabled | bool | `false` | |
| server.podDisruptionBudget.labels | object | `{}` | |
| server.podLabels | object | `{}` | |
| server.podSecurityContext | object | `{}` | |
| server.priorityClassName | string | `""` | |
| server.remote.read.basicAuth | object | `{"password":"","username":""}` | Basic auth for remote read |
| server.remote.read.bearer.token | string | `""` | Token with Bearer token. You can use one of token or tokenFile. You don't need to add "Bearer" prefix string |
| server.remote.read.bearer.tokenFile | string | `""` | Token Auth file with Bearer token. You can use one of token or tokenFile |
| server.remote.read.url | string | `""` | |
| server.remote.write.basicAuth | object | `{"password":"","username":""}` | Basic auth for remote write |
| server.remote.write.bearer | object | `{"token":"","tokenFile":""}` | Auth based on Bearer token for remote write |
| server.remote.write.bearer.token | string | `""` | Token with Bearer token. You can use one of token or tokenFile. You don't need to add "Bearer" prefix string |
| server.remote.write.bearer.tokenFile | string | `""` | Token Auth file with Bearer token. You can use one of token or tokenFile |
| server.remote.write.url | string | `""` | |
| server.replicaCount | int | `1` | |
| server.resources | object | `{}` | |
| server.securityContext | object | `{}` | |
| server.service.annotations | object | `{}` | |
| server.service.clusterIP | string | `""` | |
| server.service.externalIPs | list | `[]` | |
| server.service.labels | object | `{}` | |
| server.service.loadBalancerIP | string | `""` | |
| server.service.loadBalancerSourceRanges | list | `[]` | |
| server.service.servicePort | int | `8880` | |
| server.service.type | string | `"ClusterIP"` | |
| server.strategy.rollingUpdate.maxSurge | string | `"25%"` | |
| server.strategy.rollingUpdate.maxUnavailable | string | `"25%"` | |
| server.strategy.type | string | `"RollingUpdate"` | |
| server.tolerations | list | `[]` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.automountToken | bool | `true` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `nil` | |
| serviceMonitor.annotations | object | `{}` | |
| serviceMonitor.enabled | bool | `false` | |
| serviceMonitor.extraLabels | object | `{}` | |
| serviceMonitor.relabelings | list | `[]` | |
@@ -0,0 +1,106 @@
# Helm Chart For Victoria Metrics Alert.
{{ template "chart.typeBadge" . }} {{ template "chart.versionBadge" . }}
{{ template "chart.description" . }}
# Prerequisites
* Install the follow packages: ``git``, ``kubectl``, ``helm``, ``helm-docs``. See this [tutorial](../../REQUIREMENTS.md).
# How to install
Access a Kubernetes cluster.
Add a chart helm repository with follow commands:
```console
helm repo add vm https://victoriametrics.github.io/helm-charts/
helm repo update
```
List versions of ``vm/victoria-metrics-alert`` chart available to installation:
##### for helm v3
```console
helm search repo vm/victoria-metrics-alert -l
```
Export default values of ``victoria-metrics-alert`` chart to file ``values.yaml``:
```console
helm show values vm/victoria-metrics-alert > values.yaml
```
Change the values according to the need of the environment in ``values.yaml`` file.
Test the installation with command:
```console
helm install vmalert vm/victoria-metrics-alert -f values.yaml -n NAMESPACE --debug --dry-run
```
Install chart with command:
##### for helm v3
```console
helm install vmalert vm/victoria-metrics-alert -f values.yaml -n NAMESPACE
```
Get the pods lists by running this commands:
```console
kubectl get pods -A | grep 'alert'
```
Get the application by running this command:
```console
helm list -f vmalert -n NAMESPACE
```
See the history of versions of ``vmalert`` application with command.
```console
helm history vmalert -n NAMESPACE
```
## HA configuration for Alertmanager
There is no option on this chart to set up Alertmanager with [HA mode](https://github.com/prometheus/alertmanager#high-availability).
To enable the HA configuration, you can use:
- [VictoriaMetrics Operator](https://docs.victoriametrics.com/operator/VictoriaMetrics-Operator.html)
- official [Alertmanager Helm chart](https://github.com/prometheus-community/helm-charts/tree/main/charts/alertmanager)
# How to uninstall
Remove application with command.
```console
helm uninstall vmalert -n NAMESPACE
```
# Documentation of Helm Chart
Install ``helm-docs`` following the instructions on this [tutorial](../../REQUIREMENTS.md).
Generate docs with ``helm-docs`` command.
```bash
cd charts/victoria-metrics-alert
helm-docs
```
The markdown generation is entirely go template driven. The tool parses metadata from charts and generates a number of sub-templates that can be referenced in a template file (by default ``README.md.gotmpl``). If no template file is provided, the tool has a default internal template that will generate a reasonably formatted README.
# 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 ``victoria-metrics-alert/values.yaml`` file.
{{ template "chart.valuesTable" . }}
@@ -0,0 +1,388 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "vmalert.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Maintainer - Akshay Gupta
Tolerations and nodeSelector via Resources Requests.
*/}}
{{- define "meesho.server.getCpu" -}}
{{- $cpu := toString .Values.server.resources.requests.cpu -}}
{{- if contains "m" $cpu -}}
{{- $cpu := trimAll "m" $cpu | float64 -}}
{{- $cpu := $cpu | float64 -}}
{{- printf "%f" $cpu -}}
{{- else -}}
{{- $cpu := mulf $cpu 1000.000 -}}
{{- printf "%f" $cpu -}}
{{- end -}}
{{- end -}}
{{- define "meesho.server.getMem" -}}
{{- $mem := toString .Values.server.resources.requests.memory -}}
{{- if contains "Mi" $mem -}}
{{- $mem := trimAll "Mi" $mem | float64 -}}
{{- printf "%f" $mem -}}
{{- else if contains "Gi" $mem -}}
{{- $mem := trimAll "Gi" $mem | float64 -}}
{{- $mem := mulf $mem 1024.000 -}}
{{- printf "%f" $mem -}}
{{- end -}}
{{- end -}}
{{- define "meesho.server.getRatio" -}}
{{- $cpu := (include "meesho.server.getCpu" .) -}}
{{- $mem := (include "meesho.server.getMem" .) -}}
{{- $ratio := divf $mem $cpu -}}
{{- if gt $ratio 4.00 -}}
{{- printf "1to8" -}}
{{- else if gt $ratio 2.00 -}}
{{- printf "1to4" -}}
{{- else -}}
{{- printf "1to2" -}}
{{- end -}}
{{- end -}}
{{- define "meesho.server.dedicatedValue" -}}
{{- if (index .Values.server.labels "arch") -}}
{{- if (index .Values.server.labels "runpod") -}}
{{- $cpu := (include "meesho.server.getCpu" .) -}}
{{- $mem := (include "meesho.server.getMem" .) -}}
{{- $ratio := (include "meesho.server.getRatio" .) -}}
{{- $arch := .Values.server.labels.arch -}}
{{- $runPod := .Values.server.labels.runpod -}}
{{- printf "%s-%s-%s" $ratio $arch $runPod -}}
{{- else -}}
{{- printf "missing-runpod-label" -}}
{{- end -}}
{{- else -}}
{{- printf "missing-arch-label" -}}
{{- end -}}
{{/*- printf "%s-%s-%s-%s-%s" $ratio $arch $runPod $cpu $mem -*/}}
{{- end -}}
{{/*
Maintainer - Akshay Gupta
Tolerations and nodeSelector via Resources Requests.
*/}}
{{- define "meesho.alertmanager.getCpu" -}}
{{- $cpu := toString .Values.alertmanager.resources.requests.cpu -}}
{{- if contains "m" $cpu -}}
{{- $cpu := trimAll "m" $cpu | float64 -}}
{{- $cpu := $cpu | float64 -}}
{{- printf "%f" $cpu -}}
{{- else -}}
{{- $cpu := mulf $cpu 1000.000 -}}
{{- printf "%f" $cpu -}}
{{- end -}}
{{- end -}}
{{- define "meesho.alertmanager.getMem" -}}
{{- $mem := toString .Values.alertmanager.resources.requests.memory -}}
{{- if contains "Mi" $mem -}}
{{- $mem := trimAll "Mi" $mem | float64 -}}
{{- printf "%f" $mem -}}
{{- else if contains "Gi" $mem -}}
{{- $mem := trimAll "Gi" $mem | float64 -}}
{{- $mem := mulf $mem 1024.000 -}}
{{- printf "%f" $mem -}}
{{- end -}}
{{- end -}}
{{- define "meesho.alertmanager.getRatio" -}}
{{- $cpu := (include "meesho.alertmanager.getCpu" .) -}}
{{- $mem := (include "meesho.alertmanager.getMem" .) -}}
{{- $ratio := divf $mem $cpu -}}
{{- if gt $ratio 4.00 -}}
{{- printf "1to8" -}}
{{- else if gt $ratio 2.00 -}}
{{- printf "1to4" -}}
{{- else -}}
{{- printf "1to2" -}}
{{- end -}}
{{- end -}}
{{- define "meesho.alertmanager.dedicatedValue" -}}
{{- if (index .Values.alertmanager.labels "arch") -}}
{{- if (index .Values.alertmanager.labels "runpod") -}}
{{- $cpu := (include "meesho.alertmanager.getCpu" .) -}}
{{- $mem := (include "meesho.alertmanager.getMem" .) -}}
{{- $ratio := (include "meesho.alertmanager.getRatio" .) -}}
{{- $arch := .Values.alertmanager.labels.arch -}}
{{- $runPod := .Values.alertmanager.labels.runpod -}}
{{- printf "%s-%s-%s" $ratio $arch $runPod -}}
{{- else -}}
{{- printf "missing-runpod-label" -}}
{{- end -}}
{{- else -}}
{{- printf "missing-arch-label" -}}
{{- end -}}
{{/*- printf "%s-%s-%s-%s-%s" $ratio $arch $runPod $cpu $mem -*/}}
{{- 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 "vmalert.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 "vmalert.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create unified labels for vmalert components
*/}}
{{- define "vmalert.common.matchLabels" -}}
app.kubernetes.io/name: {{ include "vmalert.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{- define "vmalert.common.metaLabels" -}}
helm.sh/chart: {{ include "vmalert.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{- define "vmalert.server.labels" -}}
{{- toYaml .Values.server.labels | nindent 0 }}
{{ include "vmalert.server.matchLabels" . }}
{{ include "vmalert.common.metaLabels" . }}
{{- end -}}
{{- define "vmalert.server.matchLabels" -}}
app: {{ .Values.server.name }}
{{ include "vmalert.common.matchLabels" . }}
{{- end -}}
{{/*
Create a fully qualified server name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "vmalert.server.fullname" -}}
{{- if .Values.server.fullnameOverride -}}
{{- .Values.server.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- printf "%s-%s" .Release.Name .Values.server.name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s-%s" .Release.Name $name .Values.server.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- define "vmalert.server.configname" -}}
{{- if .Values.server.configMap -}}
{{- .Values.server.configMap -}}
{{- else -}}
{{- include "vmalert.server.fullname" . -}}-alert-rules-config
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "vmalert.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "vmalert.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{- define "vmalert.alertmanager.labels" -}}
{{- toYaml .Values.alertmanager.labels | nindent 0 }}
{{ include "vmalert.alertmanager.matchLabels" . }}
{{ include "vmalert.common.metaLabels" . }}
{{- end -}}
{{- define "vmalert.alertmanager.matchLabels" -}}
app: alertmanager
{{ include "vmalert.common.matchLabels" . }}
{{- end -}}
{{/*
Create a fully qualified server name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "vmalert.alertmanager.fullname" -}}
{{- if .Values.alertmanager.fullnameOverride -}}
{{- .Values.alertmanager.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- printf "%s-%s" .Release.Name .Values.alertmanager.name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s-%s" .Release.Name $name .Values.alertmanager.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- define "vmalert.alertmanager.configname" -}}
{{- if .Values.alertmanager.configMap -}}
{{- .Values.alertmanager.configMap -}}
{{- else -}}
{{- include "vmalert.alertmanager.fullname" . -}}-alertmanager-config
{{- end -}}
{{- end -}}
{{- define "vmalert.alertmanager.url" -}}
{{- if .Values.alertmanager.enabled -}}
http://{{- include "vmalert.alertmanager.fullname" . -}}:9093
{{- else -}}
{{- .Values.server.notifier.alertmanager.url -}}
{{- end -}}
{{- end -}}
{{- define "vmalert.alertmanager.urls" -}}
{{- $urls := list -}}
{{- with (include "vmalert.alertmanager.url" .) -}}
{{- $urls = append $urls . -}}
{{- end -}}
{{- range .Values.server.notifiers }}
{{- if not (eq .alertmanager.url "") -}}
{{- $urls = append $urls .alertmanager.url -}}
{{- end -}}
{{- end -}}
{{- join "," $urls }}
{{- end -}}
{{- define "vmalert.alertmanager.passwords" -}}
{{- $password := list -}}
{{- if .Values.alertmanager.enabled -}}
{{- $password = append $password "" -}}
{{- end -}}
{{- $notifiers := append .Values.server.notifiers .Values.server.notifier }}
{{- range $notifiers }}
{{- if not (eq .alertmanager.url "") -}}
{{- if and .alertmanager.basicAuth .alertmanager.basicAuth.password -}}
{{- $password = append $password .alertmanager.basicAuth.password -}}
{{- else -}}
{{- $password = append $password "" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{ include "_vmalert.optionalPrintList" $password }}
{{- end -}}
{{- define "vmalert.alertmanager.usernames" -}}
{{- $usernames := list -}}
{{- if .Values.alertmanager.enabled -}}
{{- $usernames = append $usernames "" -}}
{{- end -}}
{{- $notifiers := append .Values.server.notifiers .Values.server.notifier }}
{{- range $notifiers }}
{{- if not (eq .alertmanager.url "") -}}
{{- if and .alertmanager.basicAuth .alertmanager.basicAuth.username -}}
{{- $usernames = append $usernames .alertmanager.basicAuth.username -}}
{{- else -}}
{{- $usernames = append $usernames "" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{ include "_vmalert.optionalPrintList" $usernames }}
{{- end -}}
{{- define "vmalert.alertmanager.bearerTokens" -}}
{{- $tokens := list -}}
{{- if .Values.alertmanager.enabled -}}
{{- $tokens = append $tokens "" -}}
{{- end -}}
{{- $notifiers := append .Values.server.notifiers .Values.server.notifier }}
{{- range $notifiers }}
{{- if not (eq .alertmanager.url "") -}}
{{- if and .alertmanager.bearer .alertmanager.bearer.token -}}
{{- $tokens = append $tokens .alertmanager.bearer.token -}}
{{- else -}}
{{- $tokens = append $tokens "" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{ include "_vmalert.optionalPrintList" $tokens }}
{{- end -}}
{{- define "vmalert.alertmanager.bearerTokenFiles" -}}
{{- $files := list -}}
{{- if .Values.alertmanager.enabled -}}
{{- $files = append $files "" -}}
{{- end -}}
{{- $notifiers := append .Values.server.notifiers .Values.server.notifier }}
{{- range $notifiers }}
{{- if not (eq .alertmanager.url "") -}}
{{- if and .alertmanager.bearer .alertmanager.bearer.tokenFile -}}
{{- $files = append $files .alertmanager.bearer.tokenFile -}}
{{- else -}}
{{- $files = append $files "" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{ include "_vmalert.optionalPrintList" $files }}
{{- end -}}
{{- define "_vmalert.optionalPrintList" }}
{{- $str := join "," . -}}
{{- $cleared := $str | replace "," "" | trim -}}
{{- if eq $cleared "" -}}
{{ $cleared }}
{{- else -}}
{{ $str }}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for ingress.
*/}}
{{- define "vmalert.ingress.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") -}}
{{- print "networking.k8s.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}
{{/*
Return if ingress is stable.
*/}}
{{- define "vmalert.ingress.isStable" -}}
{{- eq (include "vmalert.ingress.apiVersion" .) "networking.k8s.io/v1" -}}
{{- end -}}
{{/*
Return if ingress supports ingressClassName.
*/}}
{{- define "vmalert.ingress.supportsIngressClassName" -}}
{{- or (eq (include "vmalert.ingress.isStable" .) "true") (and (eq (include "vmalert.ingress.apiVersion" .) "networking.k8s.io/v1beta1")) -}}
{{- end -}}
{{/*
Return if ingress supports pathType.
*/}}
{{- define "vmalert.ingress.supportsPathType" -}}
{{- or (eq (include "vmalert.ingress.isStable" .) "true") (and (eq (include "vmalert.ingress.apiVersion" .) "networking.k8s.io/v1beta1")) -}}
{{- end -}}
@@ -0,0 +1,16 @@
{{- if and .Values.alertmanager.enabled (eq .Values.alertmanager.configMap "") }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "vmalert.alertmanager.configname" .}}
namespace: {{.Release.Namespace}}
labels: {{- include "vmalert.alertmanager.labels" . | nindent 4}}
data:
alertmanager.yaml: |
{{ toYaml .Values.alertmanager.config | nindent 4 }}
{{- range $key, $value := .Values.alertmanager.templates }}
{{ $key }}: |-
{{- $value | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,143 @@
{{- if .Values.alertmanager.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "vmalert.alertmanager.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "vmalert.alertmanager.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "vmalert.alertmanager.matchLabels" . | nindent 6 }}
{{- if .Values.alertmanager.persistentVolume.enabled }}
strategy:
# Must be "Recreate" when we have a persistent volume
type: Recreate
{{- end }}
template:
metadata:
labels:
{{- include "vmalert.alertmanager.labels" . | nindent 8 }}
{{- range $key, $value := .Values.alertmanager.podMetadata.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/alertmanager-configmap.yaml") . | sha256sum }}
{{- range $key, $value := .Values.alertmanager.podMetadata.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
{{- with .Values.alertmanager.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ template "vmalert.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
{{- with .Values.alertmanager.securityContext }}
securityContext:
{{- toYaml .| nindent 8 }}
{{- end }}
containers:
- name: {{ template "vmalert.name" . }}-alertmanager
securityContext:
{{- toYaml .Values.alertmanager.podSecurityContext | nindent 12 }}
image: "{{ .Values.alertmanager.image }}:{{ .Values.alertmanager.tag }}"
args:
- --config.file=/config/alertmanager.yaml
{{ if .Values.alertmanager.persistentVolume.enabled }}
- {{ printf "%s=%s" "--storage.path" .Values.alertmanager.persistentVolume.mountPath | quote}}
{{- else}}
- --storage.path=/data
{{- end}}
- --data.retention={{ .Values.alertmanager.retention }}
- --web.listen-address=0.0.0.0:9093
- --cluster.advertise-address=$(POD_IP):6783
{{ if .Values.alertmanager.baseURL }}
- --web.external-url={{ .Values.alertmanager.baseURL }}
{{- end }}
{{ if .Values.alertmanager.baseURLPrefix }}
- --web.route-prefix={{ .Values.alertmanager.baseURLPrefix }}
{{- end }}
{{- range $key, $value := .Values.alertmanager.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
ports:
- name: web
containerPort: 9093
env:
- name: POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
readinessProbe:
httpGet:
{{ if .Values.alertmanager.baseURLPrefix }}
path: {{ .Values.alertmanager.baseURLPrefix }}/-/ready
{{- else}}
path: /-/ready
{{- end }}
port: web
livenessProbe:
httpGet:
{{ if .Values.alertmanager.baseURLPrefix }}
path: {{ .Values.alertmanager.baseURLPrefix }}/-/healthy
{{- else}}
path: /-/healthy
{{- end }}
port: web
volumeMounts:
- name: storage
{{- if .Values.alertmanager.persistentVolume.enabled }}
mountPath: {{ .Values.alertmanager.persistentVolume.mountPath }}
{{- else }}
mountPath: /data
{{- end }}
- name: config
mountPath: /config
readOnly: true
resources:
{{- toYaml .Values.alertmanager.resources | nindent 12 }}
{{- if .Values.alertmanager.priorityClassName }}
priorityClassName: {{ .Values.alertmanager.priorityClassName | quote }}
{{- end }}
{{- with .Values.server.affinity }}
affinity:
{{ toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.schedulerName }}
schedulerName: "{{ .Values.schedulerName }}"
{{- end }}
nodeSelector:
{{- if .Values.dedicatedValue }}
dedicated: {{ include "meesho.alertmanager.dedicatedValue" . }}
{{- else }}
{{- with .Values.alertmanager.nodeSelector }}
{{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
tolerations:
{{- if .Values.dedicatedValue }}
- key: "dedicated"
operator: "Equal"
value: {{ include "meesho.alertmanager.dedicatedValue" . }}
effect: "NoSchedule"
{{- else }}
{{- with .Values.alertmanager.tolerations }}
{{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
volumes:
- name: storage
{{- if .Values.alertmanager.persistentVolume.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.alertmanager.persistentVolume.existingClaim }}{{ .Values.alertmanager.persistentVolume.existingClaim }}{{- else }}{{ include "vmalert.alertmanager.fullname" . }}{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
- name: config
configMap:
name: {{ include "vmalert.alertmanager.configname" . }}
{{- end -}}
@@ -0,0 +1,50 @@
{{- if and .Values.alertmanager.enabled .Values.alertmanager.ingress.enabled }}
{{- $ingressApiIsStable := eq (include "vmalert.ingress.isStable" .) "true" -}}
{{- $ingressSupportsIngressClassName := eq (include "vmalert.ingress.supportsIngressClassName" .) "true" -}}
{{- $ingressSupportsPathType := eq (include "vmalert.ingress.supportsPathType" .) "true" -}}
{{- $servicePort := .Values.alertmanager.service.port -}}
{{- $ingressPathType := .Values.alertmanager.ingress.pathType -}}
apiVersion: {{ include "vmalert.ingress.apiVersion" . }}
kind: Ingress
metadata:
{{- with .Values.alertmanager.ingress.annotations }}
annotations:
{{ toYaml .| indent 4 }}
{{- end }}
labels:
{{- include "vmalert.alertmanager.labels" . | nindent 4 }}
{{ with .Values.alertmanager.ingress.extraLabels }}
{{ toYaml . | indent 4 }}
{{ end }}
name: {{ template "vmalert.alertmanager.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
{{- if and $ingressSupportsIngressClassName .Values.alertmanager.ingress.ingressClassName }}
ingressClassName: {{ .Values.alertmanager.ingress.ingressClassName }}
{{- end }}
rules:
{{- $serviceName := include "vmalert.alertmanager.fullname" . }}
{{- range .Values.alertmanager.ingress.hosts }}
- host: {{ .name }}
http:
paths:
- path: {{ .path }}
{{- if $ingressSupportsPathType }}
pathType: {{ $ingressPathType }}
{{- end }}
backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $serviceName }}
servicePort: {{ .port | default "http"}}
{{- end }}
{{- end -}}
{{- if .Values.alertmanager.ingress.tls }}
tls:
{{ toYaml .Values.alertmanager.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,26 @@
{{- if .Values.alertmanager.enabled -}}
{{- if and .Values.alertmanager.persistentVolume.enabled (not .Values.alertmanager.persistentVolume.existingClaim)}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "vmalert.alertmanager.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "vmalert.alertmanager.labels" . | nindent 4 }}
{{- with .Values.alertmanager.persistentVolume.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
accessModes:
{{- range .Values.alertmanager.persistentVolume.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.alertmanager.persistentVolume.size | quote }}
{{- if .Values.alertmanager.persistentVolume.storageClass }}
storageClassName: {{ .Values.alertmanager.persistentVolume.storageClass }}
{{- end -}}
{{- end -}}
{{- end -}}
@@ -0,0 +1,21 @@
{{- if .Values.alertmanager.enabled -}}
apiVersion: v1
kind: Service
metadata:
namespace: {{ .Release.Namespace }}
{{- with .Values.alertmanager.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "vmalert.alertmanager.labels" . | nindent 4 }}
name: {{ template "vmalert.alertmanager.fullname" . }}
spec:
ports:
- name: web
port: 9093
targetPort: web
protocol: TCP
selector:
{{- include "vmalert.alertmanager.matchLabels" . | nindent 4 }}
{{- end }}
@@ -0,0 +1,24 @@
{{- if and .Values.rbac.create (not .Values.rbac.namespaced) }}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "vmalert.server.fullname" . }}-clusterrolebinding
namespace: {{ .Release.Namespace }}
labels:
{{- include "vmalert.server.labels" . | nindent 4 }}
{{- with .Values.rbac.extraLabels }}
{{ toYaml . | indent 4}}
{{- end }}
{{- with .Values.rbac.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ include "vmalert.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ template "vmalert.server.fullname" . }}-clusterrole
apiGroup: rbac.authorization.k8s.io
{{- end -}}
@@ -0,0 +1,42 @@
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ template "vmalert.server.fullname" . }}
labels:
{{- include "vmalert.server.labels" . | nindent 4 }}
{{- with .Values.rbac.extraLabels }}
{{ toYaml . | indent 4}}
{{- end }}
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default'
seccomp.security.alpha.kubernetes.io/defaultProfileName: 'docker/default'
{{- with .Values.rbac.annotations }}
{{ toYaml . | indent 4}}
{{- end }}
spec:
privileged: false
allowPrivilegeEscalation: false
requiredDropCapabilities:
# Default set from Docker, with DAC_OVERRIDE and CHOWN
- ALL
volumes:
- 'configMap'
- 'emptyDir'
- 'projected'
- 'secret'
- 'downwardAPI'
- 'persistentVolumeClaim'
hostNetwork: false
hostIPC: false
hostPID: false
runAsUser:
rule: 'RunAsAny'
seLinux:
rule: 'RunAsAny'
supplementalGroups:
rule: 'RunAsAny'
fsGroup:
rule: 'RunAsAny'
readOnlyRootFilesystem: false
{{- end }}
@@ -0,0 +1,25 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ template "vmalert.server.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "vmalert.server.labels" . | nindent 4 }}
{{- with .Values.rbac.extraLabels }}
{{ toYaml . | indent 4}}
{{- end }}
{{- with .Values.rbac.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
rules:
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames: [{{ template "vmalert.server.fullname" . }}]
{{- else }}
rules: []
{{- end }}
{{- end }}
@@ -0,0 +1,24 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ template "vmalert.server.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "vmalert.server.labels" . | nindent 4 }}
{{- with .Values.rbac.extraLabels }}
{{ toYaml . | indent 4}}
{{- end }}
{{- with .Values.rbac.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "vmalert.server.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "vmalert.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
@@ -0,0 +1,11 @@
{{- if eq .Values.server.configMap "" }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "vmalert.server.configname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "vmalert.server.labels" . | nindent 4 }}
data:
alert-rules.yaml: |
{{ toYaml .Values.server.config.alerts | nindent 4 }}
{{- end }}
@@ -0,0 +1,224 @@
{{- if and .Values.server.enabled -}}
{{- if not .Values.server.extraArgs.rule }}
{{- if and (eq .Values.server.configMap "") (eq (len .Values.server.config.alerts.groups) 0) -}}
{{- fail "at least one item in `.server.config.alerts.groups` or `.server.extraArgs.rule` must be set " -}}
{{- end -}}
{{- end -}}
{{- if (eq (include "vmalert.alertmanager.urls" . ) "") -}}
{{- fail "alert manager URL must be specified. Please fill server.notifier.alertmanager.url or server.notifiers or enable Alertmanager in values file" -}}
{{- end -}}
{{- if eq .Values.server.datasource.url "" -}}
{{- fail "server.datasource.url datasource URL must be specified" -}}
{{- end -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "vmalert.server.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "vmalert.server.labels" . | nindent 4 }}
{{- with .Values.server.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
minReadySeconds: {{ .Values.server.minReadySeconds }}
replicas: {{ .Values.server.replicaCount }}
selector:
matchLabels:
{{- include "vmalert.server.matchLabels" . | nindent 6 }}
{{- with .Values.server.strategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
labels:
{{- include "vmalert.server.labels" . | nindent 8 }}
{{- range $key, $value := .Values.server.podLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/server-alerts-configmap.yaml") . | sha256sum }}
{{- range $key, $value := .Values.server.podAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
{{- if .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- with .Values.server.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ template "vmalert.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.server.securityContext | nindent 8 }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
initContainers:
- name: clone-git-repo
image: alpine/git
args:
- clone
- --single-branch
- --branch
- main
- --depth
- "1"
- https://nadig-aditya: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@github.com/Meesho/meesho-alerts-config.git
- /vmalert-config
volumeMounts:
- name: configrules
mountPath: /vmalert-config
containers:
- name: {{ template "vmalert.name" . }}-{{ .Values.server.name }}
securityContext:
{{- toYaml .Values.server.podSecurityContext | nindent 12 }}
image: "{{ .Values.server.image.repository }}:{{ default .Chart.AppVersion .Values.server.image.tag }}"
args:
- -rule=/config/alert-rules.yaml
- -datasource.url={{ .Values.server.datasource.url}}
{{- if or .Values.server.datasource.basicAuth.password .Values.server.datasource.basicAuth.username }}
- -datasource.basicAuth.password={{ .Values.server.datasource.basicAuth.password}}
- -datasource.basicAuth.username={{ .Values.server.datasource.basicAuth.username}}
{{- end }}
{{- with .Values.server.datasource.bearer.token }}
- -datasource.bearerToken={{ . }}
{{- end }}
{{- with .Values.server.datasource.bearer.tokenFile }}
- -datasource.bearerTokenFile={{ . }}
{{- end }}
- -notifier.url={{ include "vmalert.alertmanager.urls" . }}
{{- with (include "vmalert.alertmanager.passwords" .) }}
- -notifier.basicAuth.password={{ . }}
{{- end }}
{{- with (include "vmalert.alertmanager.usernames" .) }}
- -notifier.basicAuth.username={{ . }}
{{- end }}
{{- with (include "vmalert.alertmanager.bearerTokens" .) }}
- -notifier.bearerToken={{ . }}
{{- end }}
{{- with (include "vmalert.alertmanager.bearerTokenFiles" .) }}
- -notifier.bearerTokenFile={{ . }}
{{- end }}
- -remoteRead.url={{ .Values.server.remote.read.url }}
{{- if or .Values.server.remote.read.basicAuth.password .Values.server.remote.read.basicAuth.username }}
- -remoteRead.basicAuth.password={{ .Values.server.remote.read.basicAuth.password }}
- -remoteRead.basicAuth.username={{ .Values.server.remote.read.basicAuth.username }}
{{- end }}
{{- with .Values.server.remote.read.bearer.token }}
- -remoteRead.bearerToken={{ . }}
{{- end }}
{{- with .Values.server.remote.read.bearer.tokenFile }}
- -remoteRead.bearerTokenFile={{ . }}
{{- end }}
- -remoteWrite.url={{ .Values.server.remote.write.url }}
{{- if or .Values.server.remote.write.basicAuth.password .Values.server.remote.write.basicAuth.username }}
- -remoteWrite.basicAuth.password={{ .Values.server.remote.write.basicAuth.password }}
- -remoteWrite.basicAuth.username={{ .Values.server.remote.write.basicAuth.username }}
{{- end }}
{{- with .Values.server.remote.write.bearer.token }}
- -remoteWrite.bearerToken={{ . }}
{{- end }}
{{- with .Values.server.remote.write.bearer.tokenFile }}
- -remoteWrite.bearerTokenFile={{ . }}
{{- end }}
{{- range $key, $value := .Values.server.extraArgs }}
{{- if eq $key "rule" }}
- -{{ $key }}={{ $value | quote}}
{{- else }}
- -{{ $key }}={{ $value }}
{{- end }}
{{- end }}
imagePullPolicy: {{ .Values.server.image.pullPolicy }}
env:
- name: TZ
value: Asia/Kolkata
{{- with .Values.server.env }}
{{ toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 8880
readinessProbe:
httpGet:
{{- if index .Values.server.extraArgs "http.pathPrefix" }}
path: {{ trimSuffix "/" (index .Values.server.extraArgs "http.pathPrefix") }}/health
{{- else }}
path: /health
{{- end }}
port: http
initialDelaySeconds: 5
periodSeconds: 15
livenessProbe:
tcpSocket:
port: http
initialDelaySeconds: 5
periodSeconds: 15
timeoutSeconds: 5
volumeMounts:
- name: alerts-config
mountPath: /config
- name: configrules
mountPath: /config/vm-alerts-config
subPath: vm-alerts-config/configmap
{{- range .Values.server.extraHostPathMounts }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
subPath: {{ .subPath }}
readOnly: {{ .readOnly }}
{{- end }}
{{- with .Values.server.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.server.resources | nindent 12 }}
{{- with .Values.server.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.server.priorityClassName }}
priorityClassName: {{ .Values.server.priorityClassName | quote }}
{{- end }}
{{- with .Values.server.affinity }}
affinity:
{{ toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.schedulerName }}
schedulerName: "{{ .Values.schedulerName }}"
{{- end }}
nodeSelector:
{{- if .Values.dedicatedValue }}
dedicated: {{ include "meesho.server.dedicatedValue" . }}
{{- else }}
{{- with .Values.server.nodeSelector }}
{{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
tolerations:
{{- if .Values.dedicatedValue }}
- key: "dedicated"
operator: "Equal"
value: {{ include "meesho.server.dedicatedValue" . }}
effect: "NoSchedule"
{{- else }}
{{- with .Values.server.tolerations }}
{{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
volumes:
- name: configrules
emptyDir: {}
- name: alerts-config
configMap:
name: {{ include "vmalert.server.configname" . }}
{{- range .Values.server.extraHostPathMounts }}
- name: {{ .name }}
hostPath:
path: {{ .hostPath }}
{{- end }}
{{- with .Values.server.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end -}}
@@ -0,0 +1,50 @@
{{- if and .Values.server.enabled .Values.server.ingress.enabled }}
{{- $ingressApiIsStable := eq (include "vmalert.ingress.isStable" .) "true" -}}
{{- $ingressSupportsIngressClassName := eq (include "vmalert.ingress.supportsIngressClassName" .) "true" -}}
{{- $ingressSupportsPathType := eq (include "vmalert.ingress.supportsPathType" .) "true" -}}
{{- $servicePort := .Values.server.service.servicePort -}}
{{- $ingressPathType := .Values.server.ingress.pathType -}}
apiVersion: {{ include "vmalert.ingress.apiVersion" . }}
kind: Ingress
metadata:
{{- with .Values.server.ingress.annotations }}
annotations:
{{ toYaml .| indent 4 }}
{{- end }}
labels:
{{- include "vmalert.server.labels" . | nindent 4 }}
{{ with .Values.server.ingress.extraLabels }}
{{ toYaml . | indent 4 }}
{{ end }}
name: {{ template "vmalert.server.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
{{- if and $ingressSupportsIngressClassName .Values.server.ingress.ingressClassName }}
ingressClassName: {{ .Values.server.ingress.ingressClassName }}
{{- end }}
rules:
{{- $serviceName := include "vmalert.server.fullname" . }}
{{- range .Values.server.ingress.hosts }}
- host: {{ .name }}
http:
paths:
- path: {{ .path }}
{{- if $ingressSupportsPathType }}
pathType: {{ $ingressPathType }}
{{- end }}
backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $serviceName }}
servicePort: {{ .port | default "http"}}
{{- end }}
{{- end -}}
{{- with .Values.server.ingress.tls }}
tls:
{{ toYaml . | indent 4 }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,26 @@
{{- if .Values.server.podDisruptionBudget.enabled }}
{{- if .Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget" }}
apiVersion: policy/v1
{{- else -}}
apiVersion: policy/v1beta1
{{- end }}
kind: PodDisruptionBudget
metadata:
name: {{ template "vmalert.server.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "vmalert.server.labels" . | nindent 4 }}
{{- with .Values.server.podDisruptionBudget.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.server.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.server.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.server.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.server.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "vmalert.server.matchLabels" . | nindent 6 }}
{{- end }}
@@ -0,0 +1,50 @@
{{- if and .Values.server.enabled -}}
apiVersion: v1
kind: Service
metadata:
namespace: {{ .Release.Namespace }}
{{- with .Values.server.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "vmalert.server.labels" . | nindent 4 }}
{{- with .Values.server.service.labels }}
{{- toYaml . | nindent 4}}
{{- end }}
name: {{ template "vmalert.server.fullname" . }}
spec:
{{- with .Values.server.service.clusterIP }}
clusterIP: {{- . }}
{{- end }}
{{- with .Values.server.service.externalIPs }}
externalIPs:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.server.service.loadBalancerIP }}
loadBalancerIP: {{- . }}
{{- end }}
{{- with .Values.server.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- range $cidr := . }}
- {{ $cidr }}
{{- end }}
{{- end }}
ports:
- name: http
port: {{ .Values.server.service.servicePort }}
targetPort: http
protocol: TCP
{{- with .Values.server.service.nodePort }}
nodePort: {{ . }}
{{- end }}
selector:
{{- include "vmalert.server.matchLabels" . | nindent 4 }}
type: "{{ .Values.server.service.type }}"
{{- with .Values.server.service.healthCheckNodePort }}
healthCheckNodePort: {{ . }}
{{- end }}
{{- with .Values.server.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ . }}
{{- end }}
{{- end }}
@@ -0,0 +1,44 @@
{{- if .Values.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- if .Values.serviceMonitor.annotations }}
annotations:
{{ toYaml .Values.serviceMonitor.annotations | indent 4 }}
{{- end }}
labels:
{{- include "vmalert.server.labels" . | nindent 4 }}
{{- with .Values.serviceMonitor.extraLabels -}}
{{ toYaml . | nindent 4 }}
{{- end }}
name: {{ template "vmalert.server.fullname" . }}
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "vmalert.server.matchLabels" . | nindent 6 }}
endpoints:
- port: http
{{- if .Values.serviceMonitor.scheme }}
scheme: {{ .Values.serviceMonitor.scheme }}
{{- end }}
{{- if .Values.serviceMonitor.interval }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
{{- if .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- with .Values.serviceMonitor.tlsConfig }}
tlsConfig:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "vmalert.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "vmalert.common.metaLabels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end -}}
@@ -0,0 +1,356 @@
# Default values for victoria-metrics-alert.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name:
# mount API token to pod directly
automountToken: true
imagePullSecrets: []
rbac:
create: true
# Note: The PSP will only be deployed, if Kubernetes (<1.25) supports the resource.
pspEnabled: true
namespaced: false
extraLabels: {}
annotations: {}
server:
name: server
enabled: true
image:
repository: victoriametrics/vmalert
tag: "" # rewrites Chart.AppVersion
pullPolicy: IfNotPresent
nameOverride: ""
fullnameOverride: ""
## See `kubectl explain poddisruptionbudget.spec` for more
## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
podDisruptionBudget:
enabled: false
# minAvailable: 1
# maxUnavailable: 1
labels: {}
# -- Additional environment variables (ex.: secret tokens, flags) https://github.com/VictoriaMetrics/VictoriaMetrics#environment-variables
env:
[]
# - name: VM_remoteWrite_basicAuth_password
# valueFrom:
# secretKeyRef:
# name: auth_secret
# key: password
replicaCount: 1
# deployment strategy, set to standard k8s default
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
# specifies the minimum number of seconds for which a newly created Pod should be ready without any of its containers crashing/terminating
# 0 is the standard k8s default
minReadySeconds: 0
# vmalert reads metrics from source, next section represents its configuration. It can be any service which supports
# MetricsQL or PromQL.
datasource:
url: ""
# -- Basic auth for datasource
basicAuth:
username: ""
password: ""
# -- Auth based on Bearer token for datasource
bearer:
# -- Token with Bearer token. You can use one of token or tokenFile. You don't need to add "Bearer" prefix string
token: ""
# -- Token Auth file with Bearer token. You can use one of token or tokenFile
tokenFile: ""
remote:
write:
url: ""
# -- Basic auth for remote write
basicAuth:
username: ""
password: ""
# -- Auth based on Bearer token for remote write
bearer:
# -- Token with Bearer token. You can use one of token or tokenFile. You don't need to add "Bearer" prefix string
token: ""
# -- Token Auth file with Bearer token. You can use one of token or tokenFile
tokenFile: ""
read:
url: ""
# -- Basic auth for remote read
basicAuth:
username: ""
password: ""
# -- Auth based on Bearer token for remote read
bearer:
# -- Token with Bearer token. You can use one of token or tokenFile. You don't need to add "Bearer" prefix string
token: ""
# -- Token Auth file with Bearer token. You can use one of token or tokenFile
tokenFile: ""
# -- Notifier to use for alerts.
# Multiple notifiers can be enabled by using `notifiers` section
notifier:
alertmanager:
url: ""
# -- Basic auth for alertmanager
basicAuth:
username: ""
password: ""
# -- Auth based on Bearer token for alertmanager
bearer:
# -- Token with Bearer token. You can use one of token or tokenFile. You don't need to add "Bearer" prefix string
token: ""
# -- Token Auth file with Bearer token. You can use one of token or tokenFile
tokenFile: ""
# -- Additional notifiers to use for alerts
notifiers:
[]
# - alertmanager:
# url: ""
# basicAuth:
# username: ""
# password: ""
# bearer:
# token: ""
# tokenFile: ""
extraArgs:
envflag.enable: "true"
envflag.prefix: VM_
loggerFormat: json
# Additional hostPath mounts
extraHostPathMounts:
[]
# - name: certs-dir
# mountPath: /etc/kubernetes/certs
# subPath: ""
# hostPath: /etc/kubernetes/certs
# readOnly: true
# Extra Volumes for the pod
extraVolumes:
[]
#- name: example
# configMap:
# name: example
# Extra Volume Mounts for the container
extraVolumeMounts:
[]
# - name: example
# mountPath: /example
extraContainers:
[]
#- name: config-reloader
# image: reloader-image
service:
annotations: {}
labels: {}
clusterIP: ""
## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
##
externalIPs: []
loadBalancerIP: ""
loadBalancerSourceRanges: []
servicePort: 8880
# nodePort: 30000
type: ClusterIP
# Ref: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
# externalTrafficPolicy: "local"
# healthCheckNodePort: 0
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: 'true'
extraLabels: {}
hosts: []
# - name: vmselect.local
# path: /select
# port: http
tls: []
# - secretName: vmselect-ingress-tls
# hosts:
# - vmselect.local
# For Kubernetes >= 1.18 you should specify the ingress-controller via the field ingressClassName
# See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress
# ingressClassName: nginx
# -- pathType is only for k8s >= 1.1=
pathType: Prefix
podSecurityContext: {}
# fsGroup: 2000
securityContext:
{}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources:
{}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# Annotations to be added to the deployment
annotations: {}
# labels to be added to the deployment
labels: {}
# Annotations to be added to pod
podAnnotations: {}
podLabels: {}
nodeSelector: {}
priorityClassName: ""
tolerations: []
affinity: {}
# vmalert alert rules configuration configuration:
# use existing configmap if specified
# otherwise .config values will be used
configMap: ""
config:
alerts:
groups: []
serviceMonitor:
enabled: false
extraLabels: {}
annotations: {}
relabelings: []
# interval: 15s
# scrapeTimeout: 5s
# -- Commented. HTTP scheme to use for scraping.
# scheme: https
# -- Commented. TLS configuration to use when scraping the endpoint
# tlsConfig:
# insecureSkipVerify: true
alertmanager:
enabled: false
podMetadata:
labels: {}
annotations: {}
image: prom/alertmanager
tag: v0.25.0
retention: 120h
nodeSelector: {}
priorityClassName: ""
resources: {}
tolerations: []
imagePullSecrets: []
podSecurityContext: {}
extraArgs: {}
# key: value
# external URL, that alertmanager will expose to receivers
baseURL: ""
# external URL Prefix, Prefix for the internal routes of web endpoints
baseURLPrefix: ""
# use existing configmap if specified
# otherwise .config values will be used
configMap: ""
config:
global:
resolve_timeout: 5m
route:
# default receiver
receiver: devnull
# tag to group by
group_by: ["alertname"]
# How long to initially wait to send a notification for a group of alerts
group_wait: 30s
# How long to wait before sending a notification about new alerts that are added to a group
group_interval: 10s
# How long to wait before sending a notification again if it has already been sent successfully for an alert
repeat_interval: 24h
receivers:
- name: devnull
templates: {}
# alertmanager.tmpl: |-
service:
annotations: {}
type: ClusterIP
port: 9093
# if you want to force a specific nodePort. Must be use with service.type=NodePort
# nodePort:
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: 'true'
extraLabels: {}
hosts: []
# - name: alertmanager.local
# path: /
# port: web
tls: []
# - secretName: alertmanager-ingress-tls
# hosts:
# - alertmanager.local
# For Kubernetes >= 1.18 you should specify the ingress-controller via the field ingressClassName
# See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress
# ingressClassName: nginx
# -- pathType is only for k8s >= 1.1=
pathType: Prefix
persistentVolume:
# -- Create/use Persistent Volume Claim for alertmanager component. Empty dir if false
enabled: false
# -- Array of access modes. Must match those of existing PV or dynamic provisioner. Ref: [http://kubernetes.io/docs/user-guide/persistent-volumes/](http://kubernetes.io/docs/user-guide/persistent-volumes/)
accessModes:
- ReadWriteOnce
# -- Persistant volume annotations
annotations: {}
# -- StorageClass to use for persistent volume. Requires alertmanager.persistentVolume.enabled: true. If defined, PVC created automatically
storageClass: ""
# -- Existing Claim name. If defined, PVC must be created manually before volume will be bound
existingClaim: ""
# -- Mount path. Alertmanager data Persistent Volume mount root path.
mountPath: /data
# -- Mount subpath
subPath: ""
# -- Size of the volume. Better to set the same as resource limit memory property.
size: 50Mi