-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/add support for vm alert (#15)
* init vmalert * helm-docs + aoi alerting enablement feat * change default clusterid * helm-docs * disable alerting by default update version update docs * update helm package to support deploying alerting stack --------- Co-authored-by: Alexander Soelberg Heidarsson <[email protected]>
- Loading branch information
Showing
19 changed files
with
625 additions
and
10 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,2 @@ | ||
# Ignore dependencies downloaded by helm | ||
charts/ |
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,2 @@ | ||
.gitignore | ||
CHANGELOG.md |
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 @@ | ||
# WiP |
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 @@ | ||
dependencies: | ||
- name: grafana | ||
repository: https://grafana.github.io/helm-charts | ||
version: 7.0.9 | ||
- name: victoria-metrics-single | ||
repository: https://victoriametrics.github.io/helm-charts/ | ||
version: 0.9.12 | ||
- name: victoria-metrics-single | ||
repository: https://victoriametrics.github.io/helm-charts/ | ||
version: 0.9.12 | ||
- name: victoria-metrics-alert | ||
repository: https://victoriametrics.github.io/helm-charts/ | ||
version: 0.8.3 | ||
digest: sha256:3f7d3160e0f43e6932e9e8e0c7fc3217457ed705a06a2f232ac4c273908919ba | ||
generated: "2024-02-02T09:25:35.926638+01:00" |
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
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
93 changes: 93 additions & 0 deletions
93
charts/aoi/templates/application-operations-alerting/HelmRelease.yaml
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,93 @@ | ||
{{- if .Values.alerting.enabled }} | ||
{{- range $i, $namespace := (include "aoi.alerting.namespaces" . | fromJsonArray) }} | ||
--- | ||
apiVersion: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
metadata: | ||
name: victoria-metrics-alert | ||
namespace: {{ $namespace }} | ||
spec: | ||
chart: | ||
spec: | ||
chart: victoria-metrics-alert | ||
version: {{ include "aoi.alerting.chartVersion" $ }} | ||
sourceRef: | ||
kind: HelmRepository | ||
name: victoria-metrics | ||
interval: 5m | ||
interval: 5m | ||
timeout: 15m | ||
values: | ||
serviceAccount: | ||
create: false | ||
name: victoria-metrics-alert-config-reloader | ||
rbac: | ||
create: false | ||
server: | ||
{{- include "aoi.serverPriorityClassName" $ | nindent 6 }} | ||
image: | ||
repository: "{{ $.Values.alerting.helmRelease.values.server.image.registry }}/{{ $.Values.alerting.helmRelease.values.server.image.repository }}" | ||
pullPolicy: {{ $.Values.alerting.helmRelease.values.server.image.pullPolicy }} | ||
resources: | ||
{{- toYaml $.Values.alerting.helmRelease.values.server.resources | nindent 8 }} | ||
extraArgs: | ||
rule: '/tmp/rules/*.yaml' | ||
extraVolumes: | ||
- name: alert-rules | ||
emptyDir: {} | ||
extraVolumeMounts: | ||
- name: alert-rules | ||
mountPath: /tmp/rules | ||
datasource: | ||
{{- if eq $namespace $.Values.alerting.clusterWideNamespace.name }} | ||
url: "{{ include "aoi.readUrl" $ }}" | ||
{{- else }} | ||
url: "{{ include "aoi.readUrl" $ }}?extra_label=namespace_id={{ $.Values.alerting.clusterId }}_{{ $namespace }}" | ||
{{- end }} | ||
securityContext: | ||
{{- toYaml $.Values.alerting.helmRelease.values.server.securityContext | nindent 8 }} | ||
extraContainers: | ||
- name: config-reloader | ||
image: "{{ $.Values.alerting.helmRelease.values.server.configReloader.image.registry }}/{{ $.Values.alerting.helmRelease.values.server.configReloader.image.repository }}:{{ $.Values.alerting.helmRelease.values.server.configReloader.image.tag }}" | ||
imagePullPolicy: {{ $.Values.alerting.helmRelease.values.server.configReloader.image.pullPolicy }} | ||
resources: | ||
{{- toYaml $.Values.alerting.helmRelease.values.server.configReloader.resources | nindent 12 }} | ||
securityContext: | ||
{{- toYaml $.Values.alerting.helmRelease.values.server.configReloader.securityContext | nindent 12 }} | ||
env: | ||
- name: IGNORE_ALREADY_PROCESSED | ||
value: "true" | ||
- name: METHOD | ||
value: WATCH | ||
- name: LABEL | ||
value: application-operations-alerting | ||
- name: FOLDER | ||
value: /tmp/rules | ||
- name: RESOURCE | ||
value: configmap | ||
- name: REQ_URL | ||
value: http://localhost:8880/-/reload | ||
- name: REQ_METHOD | ||
value: GET | ||
volumeMounts: | ||
- name: alert-rules | ||
mountPath: /tmp/rules | ||
podSecurityContext: | ||
{{- toYaml $.Values.alerting.helmRelease.values.server.podSecurityContext | nindent 8 }} | ||
alertmanager: | ||
enabled: true | ||
{{- include "aoi.alertmanagerPriorityClassName" $ | nindent 6 }} | ||
image: "{{ $.Values.alerting.helmRelease.values.alertmanager.image.registry }}/{{ $.Values.alerting.helmRelease.values.alertmanager.image.repository }}" | ||
resources: | ||
{{- toYaml $.Values.alerting.helmRelease.values.alertmanager.resources | nindent 8 }} | ||
configMap: "alertmanager-config" | ||
securityContext: | ||
{{- toYaml $.Values.alerting.helmRelease.values.alertmanager.securityContext | nindent 8 }} | ||
podSecurityContext: | ||
{{- toYaml $.Values.alerting.helmRelease.values.alertmanager.podSecurityContext | nindent 8 }} | ||
serviceMonitor: | ||
enabled: true | ||
extraLabels: | ||
netic.dk/monitoring: "true" | ||
{{- end }} | ||
{{- end }} |
14 changes: 14 additions & 0 deletions
14
charts/aoi/templates/application-operations-alerting/HelmRepository.yaml
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,14 @@ | ||
{{- if .Values.alerting.enabled }} | ||
{{- range $i, $namespace := (include "aoi.alerting.namespaces" . | fromJsonArray) }} | ||
--- | ||
apiVersion: source.toolkit.fluxcd.io/v1beta2 | ||
kind: HelmRepository | ||
metadata: | ||
name: victoria-metrics | ||
namespace: {{ $namespace }} | ||
spec: | ||
interval: 30m0s | ||
url: {{ include "aoi.alerting.helmRepository" $ }} | ||
type: {{ include "aoi.alerting.helmRepository.type" $ }} | ||
{{- end }} | ||
{{- end }} |
67 changes: 67 additions & 0 deletions
67
charts/aoi/templates/application-operations-alerting/_helpers.tpl
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,67 @@ | ||
{{/* | ||
list of namespaces that should have alerting enabled | ||
*/}} | ||
{{- define "aoi.alerting.namespaces" -}} | ||
{{ $newList := list }} | ||
{{- if .Values.alerting.clusterWideNamespace.enabled }} | ||
{{ $newList = prepend .Values.alerting.namespaces .Values.alerting.clusterWideNamespace.name }} | ||
{{- else }} | ||
{{ $newList = .Values.alerting.namespaces }} | ||
{{- end }} | ||
{{ toJson $newList }} | ||
{{- end }} | ||
|
||
{{/* | ||
HelmRepository for victoria-metrics-alert | ||
*/}} | ||
{{- define "aoi.alerting.helmRepository" -}} | ||
{{- range $i, $dep := .Chart.Dependencies }} | ||
{{- if eq $dep.Name "victoria-metrics-alert" }} | ||
{{- default $dep.Repository $.Values.alerting.helmRepository }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
HelmRepository type | ||
*/}} | ||
{{- define "aoi.alerting.helmRepository.type" -}} | ||
{{- if hasPrefix "oci" ( include "aoi.alerting.helmRepository" . ) }} | ||
{{- print "oci" -}} | ||
{{- else }} | ||
{{- print "default" -}} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Helm chart version for victoria-metrics-alert | ||
*/}} | ||
{{- define "aoi.alerting.chartVersion" -}} | ||
{{- range $i, $dep := .Chart.Dependencies }} | ||
{{- if eq $dep.Name "victoria-metrics-alert" }} | ||
{{- $dep.Version }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
promxy priority class name | ||
*/}} | ||
{{- define "aoi.serverPriorityClassName" -}} | ||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.alerting.helmRelease.values.server.priorityClassName -}} | ||
{{- if $pcn -}} | ||
priorityClassName: {{ $pcn }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
promxy priority class name | ||
*/}} | ||
{{- define "aoi.alertmanagerPriorityClassName" -}} | ||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.alerting.helmRelease.values.alertmanager.priorityClassName -}} | ||
{{- if $pcn -}} | ||
priorityClassName: {{ $pcn }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
|
Oops, something went wrong.