Add VictoriaMetrics observability stack + sync catalog for monitoring test

- VM stack 10 charts: victoria-metrics-cluster/auth, victoria-logs-cluster,
  victoria-metrics-agent/alert, opentelemetry-collector, kube-state-metrics,
  prometheus-node-exporter, alertmanager, perses (JWT/OIDC, Infisical-ready)
- ArgoCD ApplicationSet (syncWave) + per-chart dip-values overlays
- doc/victoria-metrics-architecture.md, define-chart-resources updates
- includes pending working-tree changes (mlflow, kubeflow, apisix, CLAUDE.md)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
wbsong111
2026-06-25 11:10:51 +09:00
parent a55427730e
commit 6290322f1b
514 changed files with 68103 additions and 40 deletions
@@ -0,0 +1,174 @@
{{- define "alertmanager.args" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $app := $Values.alertmanager -}}
{{- $args := dict -}}
{{- $_ := set $args "config.file" "/config/alertmanager.yaml" -}}
{{- $_ := set $args "storage.path" (ternary $app.persistentVolume.mountPath "/data" $app.persistentVolume.enabled) -}}
{{- $_ := set $args "data.retention" $app.retention -}}
{{- $_ := set $args "web.listen-address" $app.listenAddress -}}
{{- $_ := set $args "cluster.advertise-address" "[$(POD_IP)]:6783" -}}
{{- with $app.baseURL -}}
{{- $_ := set $args "web.external-url" . -}}
{{- end -}}
{{ with $app.baseURLPrefix }}
{{- $_ := set $args "web.route-prefix" . -}}
{{- end -}}
{{- $replicaCount := $app.replicaCount | default 1 | int }}
{{- if gt $replicaCount 1 }}
{{- $_ := set $args "cluster.listen-address" $app.cluster.listenAddress -}}
{{- $port := include "vm.port.from.flag" (dict "flag" $app.cluster.listenAddress "default" "9094") -}}
{{- $_ := set $args "cluster.advertise-address" (printf "[$(POD_IP)]:%s" $port) -}}
{{- with $app.cluster.pushPullInterval -}}
{{- $_ := set $args "cluster.pushpull-interval" . -}}
{{- end -}}
{{- with $app.cluster.gossipInterval -}}
{{- $_ := set $args "cluster.gossip-interval" . -}}
{{- end -}}
{{- with $app.cluster.peerTimeout -}}
{{- $_ := set $args "cluster.peer-timeout" . -}}
{{- end -}}
{{- with $app.cluster.settleTimeout -}}
{{- $_ := set $args "cluster.settle-timeout" . -}}
{{- end -}}
{{- $ctx := . -}}
{{- if not (hasKey . "helm") -}}
{{- $ctx = dict "helm" . }}
{{- end -}}
{{- $_ := set $ctx "appKey" "alertmanager" -}}
{{- $_ := set $ctx "style" "plain" -}}
{{- $fullname := include "vm.plain.fullname" $ctx -}}
{{- $alertmanager := deepCopy $app }}
{{- $_ := set $alertmanager "fullnameOverride" (printf "%s-headless" $fullname) }}
{{- $_ := set $ctx "headless" (dict "alertmanager" $alertmanager) }}
{{- $_ := set $ctx "appKey" (list "headless" "alertmanager") }}
{{- $port := include "vm.port.from.flag" (dict "flag" $app.cluster.listenAddress "default" "9094") -}}
{{- $peers := list }}
{{- range $idx := (until (int $replicaCount)) }}
{{- $_ := set $ctx "appIdx" $idx }}
{{- $peers = append $peers (printf "%s:%s" (include "vm.fqdn" $ctx) $port) -}}
{{- end }}
{{- $_ := unset $ctx "appIdx" }}
{{- $_ := set $args "cluster.peer" $peers }}
{{- end }}
{{- $args = mergeOverwrite $args $app.extraArgs -}}
{{- toYaml (fromYaml (include "vm.args" $args)).args -}}
{{- end -}}
{{- define "vmalert.fromLegacyArgs" -}}
{{- $result := omit . "basicAuth" "bearer" }}
{{- with .basicAuth }}
{{- with .username }}
{{- $_ := set $result "basicAuth.username" . }}
{{- end }}
{{- with .password }}
{{- $_ := set $result "basicAuth.password" . }}
{{- end }}
{{- end -}}
{{- with .bearer -}}
{{- with .token }}
{{- $_ := set $result "bearerToken" . -}}
{{- end -}}
{{- with .tokenFile -}}
{{- $_ := set $result "bearerTokenFile" . -}}
{{- end -}}
{{- end }}
{{- toYaml $result }}
{{- end -}}
{{- define "vmalert.subargs" }}
{{- $args := .args }}
{{- range $k, $vs := (omit . "args") }}
{{- range $i, $v := $vs }}
{{- with $v }}
{{- if not .url -}}
{{- fail (printf "`url` is not set for `%s` idx %d" $k $i) -}}
{{- end -}}
{{- range $vKey, $vValue := . -}}
{{- if $vValue }}
{{- $key := printf "%s.%s" $k $vKey -}}
{{- $param := index $args $key | default list -}}
{{- range until (int (sub $i (len $param))) }}
{{- $param = append $param "" }}
{{- end }}
{{- if kindIs "map" $vValue }}
{{- $values := list }}
{{- range $mk, $mvs := $vValue }}
{{- $mv := ternary (join "," $mvs | quote) $mvs (kindIs "slice" $mvs) }}
{{- $values = append $values (printf "%s:%s" $mk $mv) }}
{{- end }}
{{- $param = append $param (join "^^" $values | squote) }}
{{- else -}}
{{- $param = append $param $vValue }}
{{- end }}
{{- $_ := set $args $key $param -}}
{{- end }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end }}
{{- end }}
{{- define "vmalert.args" -}}
{{- $ctx := . }}
{{- $Values := (.helm).Values | default .Values -}}
{{- $app := $Values.server -}}
{{- $datasource := list (include "vmalert.fromLegacyArgs" $app.datasource | fromYaml) -}}
{{- $remoteWrite := list (mergeOverwrite (deepCopy ($app.remoteWrite | default dict)) (include "vmalert.fromLegacyArgs" ($app.remote).write | fromYaml)) -}}
{{- $remoteRead := list (mergeOverwrite (deepCopy ($app.remoteRead | default dict)) (include "vmalert.fromLegacyArgs" ($app.remote).read | fromYaml)) -}}
{{- $notifiers := list }}
{{- range $rawNotifier := ($app.notifiers | default list) }}
{{- $notifier := mergeOverwrite (deepCopy (omit ($rawNotifier | default dict) "alertmanager")) (include "vmalert.fromLegacyArgs" ($rawNotifier).alertmanager | fromYaml) }}
{{- $notifiers = append $notifiers $notifier }}
{{- end }}
{{- $notifier := mergeOverwrite (deepCopy (omit ($app.notifier | default dict) "alertmanager")) (include "vmalert.fromLegacyArgs" ($app.notifier).alertmanager | fromYaml) }}
{{- if $notifier.url }}
{{- if kindIs "slice" $notifier.url }}
{{- $urls := $notifier.url }}
{{- range $urls }}
{{- $_ := set $notifier "url" . }}
{{- $notifiers = append $notifiers $notifier }}
{{- end }}
{{- else }}
{{- $notifiers = append $notifiers $notifier }}
{{- end }}
{{- else if $Values.alertmanager.enabled }}
{{- $alertmanager := deepCopy $Values.alertmanager }}
{{- $_ := set $ctx "style" "plain" -}}
{{- $_ := set $ctx "appKey" "alertmanager" -}}
{{- $appSecure := not (empty ($alertmanager.webConfig).tls_server_config) -}}
{{- $_ := set $ctx "appSecure" $appSecure -}}
{{- $_ := set $ctx "appRoute" $alertmanager.baseURLPrefix -}}
{{- if gt (int ($alertmanager.replicaCount | default 1)) 1 }}
{{- $fullname := include "vm.plain.fullname" $ctx -}}
{{- $_ := set $alertmanager "fullnameOverride" (printf "%s-headless" $fullname) }}
{{- $_ := set $ctx "headless" (dict "alertmanager" $alertmanager) }}
{{- $_ := set $ctx "appKey" (list "headless" "alertmanager") }}
{{- range $idx := (until (int $alertmanager.replicaCount)) }}
{{- $_ := set $ctx "appIdx" $idx }}
{{- $_ := set $notifier "url" (include "vm.url" $ctx) -}}
{{- $notifiers = append $notifiers $notifier }}
{{- end }}
{{- $_ := unset $ctx "appIdx" }}
{{- else }}
{{- $_ := set $notifier "url" (include "vm.url" $ctx) -}}
{{- $notifiers = append $notifiers $notifier }}
{{- end }}
{{- end }}
{{- $args := dict }}
{{- include "vmalert.subargs" (dict "args" $args "datasource" $datasource "remoteWrite" $remoteWrite "remoteRead" $remoteRead "notifier" $notifiers) }}
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" .)) -}}
{{- $args = mergeOverwrite $args $app.extraArgs -}}
{{- toYaml (fromYaml (include "vm.args" $args)).args -}}
{{- end -}}
{{- define "vmalert.rules.config.name" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $fullname := include "vm.plain.fullname" . -}}
{{- $Values.server.configMap | default (printf "%s-alert-rules-config" $fullname) -}}
{{- end -}}
{{- define "alertmanager.config.name" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $fullname := include "vm.plain.fullname" . -}}
{{- $Values.alertmanager.configMap | default (printf "%s-config" $fullname) -}}
{{- end -}}
@@ -0,0 +1,14 @@
{{- $app := .Values.server }}
{{- if empty $app.configMap }}
{{- $ctx := dict "helm" . "appKey" "server" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "vmalert.rules.config.name" $ctx }}
namespace: {{ $ns }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
data:
alert-rules.yaml: |{{ toYaml $app.config.alerts | nindent 4 }}
{{- end }}
@@ -0,0 +1,42 @@
{{- $app := .Values.server }}
{{- $ingress := $app.ingress }}
{{- if $ingress.enabled }}
{{- $ctx := dict "helm" . "appKey" "server" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
{{- with $ingress.annotations }}
annotations: {{ toYaml .| nindent 4 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $ingress.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
namespace: {{ $ns }}
spec:
{{- with $ingress.ingressClassName }}
ingressClassName: {{ . }}
{{- end }}
{{- with $ingress.tls }}
tls: {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
rules:
{{- range $host := $ingress.hosts }}
{{- $paths := ternary (list $host.path) $host.path (kindIs "string" $host.path) }}
- host: {{ tpl $host.name $ | quote }}
http:
paths:
{{- range $path := $paths }}
- path: {{ $path }}
{{- with $ingress.pathType }}
pathType: {{ . }}
{{- end }}
backend:
service:
name: {{ $fullname }}
port: {{ include "vm.ingress.port" $host | nindent 18 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,27 @@
{{- $app := .Values.server }}
{{- $pdb := $app.podDisruptionBudget }}
{{- if $pdb.enabled }}
{{- $ctx := dict "helm" . "appKey" "server" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ $fullname }}
namespace: {{ $ns }}
{{- $_ := set $ctx "extraLabels" $pdb.labels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
spec:
{{- with $pdb.minAvailable }}
minAvailable: {{ . }}
{{- end }}
{{- with $pdb.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
{{- with $pdb.unhealthyPodEvictionPolicy }}
unhealthyPodEvictionPolicy: {{ . }}
{{- end }}
selector:
matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 6 }}
{{- end }}
@@ -0,0 +1,43 @@
{{- $app := .Values.server }}
{{- $route := $app.route }}
{{- if $route.enabled }}
{{- $ctx := dict "helm" . "appKey" "server" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
---
apiVersion: {{ $route.apiVersion | default "gateway.networking.k8s.io/v1" }}
kind: {{ $route.kind | default "HTTPRoute" }}
metadata:
name: {{ $fullname }}
namespace: {{ $ns }}
{{- $_ := set $ctx "extraLabels" $app.route.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
{{- with $route.annotations }}
annotations: {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
spec:
{{- with $route.parentRefs }}
parentRefs: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with $route.hostnames }}
hostnames: {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
rules:
{{- with $route.extraRules }}
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
- backendRefs:
- name: {{ $fullname }}
port: {{ $route.port | default (include "vm.port.from.flag" (dict "flag" ($app.extraArgs).httpListenAddr)) }}
group: ''
kind: Service
weight: 1
{{- with $route.filters }}
filters: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $route.matches }}
matches: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- end }}
@@ -0,0 +1,139 @@
{{- $app := .Values.server }}
{{- if not $app.extraArgs.rule }}
{{- if and (empty $app.configMap) (empty $app.config.alerts.groups) -}}
{{- fail "at least one item in `.server.config.alerts.groups` or `.server.extraArgs.rule` must be set " -}}
{{- end -}}
{{- end -}}
{{- if empty $app.datasource.url -}}
{{- fail "server.datasource.url datasource URL must be specified" -}}
{{- end }}
{{- $ctx := dict "helm" . "appKey" "server" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
{{- $sa := include "vm.fullname" . }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $fullname }}
namespace: {{ $ns }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- with $app.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
spec:
minReadySeconds: {{ $app.minReadySeconds }}
replicas: {{ $app.replicaCount }}
selector:
matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 6 }}
{{- with $app.strategy }}
strategy: {{ toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
{{- $_ := set $ctx "extraLabels" $app.podLabels }}
labels: {{ include "vm.podLabels" $ctx | nindent 8 }}
{{- $_ := unset $ctx "extraLabels" }}
{{- $annotations := dict "checksum/config" (include (print .Template.BasePath "/alert-configmap.yaml") . | sha256sum) }}
{{- $annotations = merge $annotations $app.podAnnotations }}
annotations: {{ toYaml $annotations | nindent 8 }}
spec:
{{- if or (.Values.serviceAccount).name (.Values.serviceAccount).create }}
serviceAccountName: {{ tpl ((.Values.serviceAccount).name | default $sa) $ctx }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
{{- end }}
{{- if $app.podSecurityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.podSecurityContext "helm" .) | nindent 8 }}
{{- end }}
{{- with ($app.imagePullSecrets | default .Values.global.imagePullSecrets) }}
imagePullSecrets: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $app.initContainers }}
initContainers: {{ toYaml . | nindent 8 }}
{{- end }}
containers:
- name: vmalert
{{- if $app.securityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
{{- end }}
image: {{ include "vm.image" $ctx }}
args: {{ include "vmalert.args" $ctx | nindent 12 }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- with $app.envFrom }}
envFrom: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with $app.env }}
env: {{ toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ include "vm.port.from.flag" (dict "flag" $app.extraArgs.httpListenAddr "default" "8880") }}
{{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "readiness"))) }}
readinessProbe: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "liveness"))) }}
livenessProbe: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "startup"))) }}
startupProbe: {{ toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: alerts-config
mountPath: /config
{{- range $app.extraHostPathMounts }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
{{- with .subPath }}
subPath: {{ . }}
{{- end }}
{{- with .readOnly }}
readOnly: {{ . }}
{{- end }}
{{- end }}
{{- range $app.extraVolumeMounts }}
- name: {{ .name }}
{{- toYaml (omit . "name") | nindent 14 }}
{{- end }}
{{- include "vm.license.mount" . | nindent 12 }}
{{- with $app.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with $app.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $app.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $app.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- with $app.affinity }}
affinity: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $app.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := . }}
- {{ toYaml $constraint | nindent 10 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 14 }}
{{- end }}
{{- end }}
{{- end }}
{{- with $app.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
{{- $_ := set $ctx "appKey" "server" }}
volumes:
- name: alerts-config
configMap:
name: {{ include "vmalert.rules.config.name" $ctx }}
{{- range $app.extraHostPathMounts }}
- name: {{ .name }}
hostPath:
path: {{ .hostPath }}
{{- end }}
{{- range $app.extraVolumes }}
- name: {{ .name }}
{{- toYaml (omit . "name") | nindent 10 }}
{{- end }}
{{- include "vm.license.volume" . | nindent 8 }}
@@ -0,0 +1,54 @@
{{- $app := .Values.server }}
{{- $service := $app.service }}
{{- $ctx := dict "helm" . "appKey" "server" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: v1
kind: Service
metadata:
namespace: {{ $ns }}
{{- with $service.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $app.service.labels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
spec:
{{- with $service.trafficDistribution }}
trafficDistribution: {{ . }}
{{- end }}
{{- with $service.clusterIP }}
clusterIP: {{ . }}
{{- end }}
{{- with $service.externalIPs }}
externalIPs: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with $service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
{{- with $service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{ toYaml . | nindent 4 }}
{{- end }}
type: {{ $service.type }}
{{- with $service.healthCheckNodePort }}
healthCheckNodePort: {{ . }}
{{- end }}
{{- with $service.externalTrafficPolicy }}
externalTrafficPolicy: {{ . }}
{{- end }}
{{- with $service.ipFamilyPolicy }}
ipFamilyPolicy: {{ . }}
{{- end }}
{{- with $service.ipFamilies }}
ipFamilies: {{ toYaml . | nindent 4 }}
{{- end }}
ports:
- name: http
port: {{ $service.servicePort }}
targetPort: http
protocol: TCP
{{- with $service.nodePort }}
nodePort: {{ . }}
{{- end }}
selector: {{ include "vm.selectorLabels" $ctx | nindent 4 }}
@@ -0,0 +1,20 @@
{{- $app := .Values.alertmanager }}
{{- if and $app.enabled (empty $app.configMap) }}
{{- $ctx := dict "helm" . "appKey" "alertmanager" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "alertmanager.config.name" $ctx }}
namespace: {{ $ns }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
data:
alertmanager.yaml: |{{ toYaml $app.config | nindent 4 }}
{{- range $key, $value := $app.templates }}
{{ $key }}: |{{ $value | nindent 4 }}
{{- end }}
{{- with $app.webconfig }}
webconfig.yaml: |{{ toYaml . | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,42 @@
{{- $app := .Values.alertmanager }}
{{- $ingress := $app.ingress }}
{{- if and $app.enabled $ingress.enabled }}
{{- $ctx := dict "helm" . "appKey" "alertmanager" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
{{- with $ingress.annotations }}
annotations: {{ toYaml .| nindent 4 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $app.ingress.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
namespace: {{ $ns }}
spec:
{{- with $ingress.ingressClassName }}
ingressClassName: {{ . }}
{{- end }}
{{- with $ingress.tls }}
tls: {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
rules:
{{- range $host := $ingress.hosts }}
{{- $paths := ternary (list $host.path) $host.path (kindIs "string" $host.path) }}
- host: {{ tpl $host.name $ | quote }}
http:
paths:
{{- range $path := $paths }}
- path: {{ $path }}
{{- with $ingress.pathType }}
pathType: {{ . }}
{{- end }}
backend:
service:
name: {{ $fullname }}
port: {{ include "vm.ingress.port" $host | nindent 18 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,35 @@
{{- $app := .Values.alertmanager }}
{{- $pvc := $app.persistentVolume }}
{{- if and $pvc.enabled (not $pvc.existingClaim) (eq $app.mode "deployment") -}}
{{- $ctx := dict "helm" . "appKey" "alertmanager" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ tpl ($pvc.name | default $fullname) $ctx }}
namespace: {{ $ns }}
{{- $_ := set $ctx "extraLabels" $pvc.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
{{- with $pvc.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with $pvc.accessModes }}
accessModes: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with $pvc.volumeAttributeClassName }}
volumeAttributesClassName: {{ . }}
{{- end }}
resources:
requests:
storage: {{ $pvc.size }}
{{- with $pvc.storageClassName }}
storageClassName: {{ . }}
{{- end }}
{{- with $pvc.matchLabels }}
selector:
matchLabels: {{ toYaml . | nindent 6 }}
{{- end }}
{{- end }}
@@ -0,0 +1,43 @@
{{- $app := .Values.alertmanager }}
{{- $route := $app.route }}
{{- if $route.enabled }}
{{- $ctx := dict "helm" . "appKey" "alertmanager" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
---
apiVersion: {{ $route.apiVersion | default "gateway.networking.k8s.io/v1" }}
kind: {{ $route.kind | default "HTTPRoute" }}
metadata:
name: {{ $fullname }}
namespace: {{ $ns }}
{{- $_ := set $ctx "extraLabels" $app.route.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
{{- with $route.annotations }}
annotations: {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
spec:
{{- with $route.parentRefs }}
parentRefs: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with $route.hostnames }}
hostnames: {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
rules:
{{- with $route.extraRules }}
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
- backendRefs:
- name: {{ $fullname }}
port: {{ $route.port | default $app.service.port }}
group: ''
kind: Service
weight: 1
{{- with $route.filters }}
filters: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $route.matches }}
matches: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- end }}
@@ -0,0 +1,184 @@
{{- $storageName := "server-volume" }}
{{- $app := .Values.alertmanager }}
{{- $pvc := $app.persistentVolume }}
{{- $mode := $app.mode }}
{{- if and $mode $app.enabled (hasKey $app $mode) -}}
{{- $modeOpts := index $app $mode }}
{{- $ctx := dict "helm" . "appKey" "alertmanager" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
{{- $sa := include "vm.fullname" . }}
{{- if and (ne $mode "statefulSet") (gt (int $app.replicaCount) 1) }}
{{- fail "Alertmanager HA mode is not supported for Deployment. Consider switching to statefulset instead using `alertmanager.mode: statefulSet`" -}}
{{- end }}
apiVersion: apps/v1
kind: {{ title $mode }}
metadata:
name: {{ $fullname }}
namespace: {{ $ns }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
spec:
{{- with $modeOpts.spec }}
{{- toYaml . | nindent 2 }}
{{- end }}
replicas: {{ $app.replicaCount | default 1 }}
{{- if eq $mode "statefulSet" }}
serviceName: {{ $fullname }}
{{- end }}
selector:
matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 6 }}
template:
metadata:
{{- $_ := set $ctx "extraLabels" $app.podLabels }}
labels: {{ include "vm.podLabels" $ctx | nindent 8 }}
{{- $_ := unset $ctx "extraLabels" }}
{{- $annotations := dict "checksum/config" (include (print .Template.BasePath "/alertmanager-configmap.yaml") . | sha256sum) }}
{{- $annotations = merge $annotations (deepCopy $app.podAnnotations) }}
annotations: {{ toYaml $annotations | nindent 8 }}
spec:
{{- if or (.Values.serviceAccount).name (.Values.serviceAccount).create }}
serviceAccountName: {{ tpl ((.Values.serviceAccount).name | default $sa) $ctx }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
{{- end }}
{{- if $app.podSecurityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.podSecurityContext "helm" .) | nindent 8 }}
{{- end }}
{{- with ($app.imagePullSecrets | default .Values.global.imagePullSecrets) }}
imagePullSecrets: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $app.initContainers }}
initContainers: {{ toYaml . | nindent 8 }}
{{- end }}
containers:
- name: alertmanager
{{- if $app.securityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
{{- end }}
image: {{ include "vm.image" $ctx }}
args: {{ include "alertmanager.args" $ctx | nindent 12 }}
ports:
- name: web
containerPort: {{ include "vm.port.from.flag" (dict "flag" $app.listenAddress "default" "9093") }}
{{- if gt (int $app.replicaCount) 1 }}
- name: cluster-tcp
containerPort: {{ include "vm.port.from.flag" (dict "flag" $app.cluster.listenAddress "default" "9094") }}
protocol: TCP
- name: cluster-udp
containerPort: {{ include "vm.port.from.flag" (dict "flag" $app.cluster.listenAddress "default" "9094") }}
protocol: UDP
{{- end }}
{{- with $app.envFrom }}
envFrom: {{ toYaml . | nindent 12 }}
{{- end }}
env:
- name: POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
{{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "readiness"))) }}
readinessProbe: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "liveness"))) }}
livenessProbe: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "startup"))) }}
startupProbe: {{ toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: {{ $storageName }}
mountPath: {{ ternary $pvc.mountPath "/data" $pvc.enabled }}
- name: config
mountPath: /config
readOnly: true
{{- range $app.extraHostPathMounts }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
{{- with .subPath }}
subPath: {{ . }}
{{- end }}
{{- with .readOnly }}
readOnly: {{ . }}
{{- end }}
{{- end }}
{{- with $app.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with $app.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with $app.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $app.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- if $app.priorityClassName }}
priorityClassName: {{ $app.priorityClassName | quote }}
{{- end }}
{{- with $app.affinity }}
affinity: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $app.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := . }}
- {{ toYaml $constraint | nindent 10 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 14 }}
{{- end }}
{{- end }}
{{- end }}
{{- with $app.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{ end }}
volumes:
{{- $_ := set $ctx "appKey" "alertmanager" }}
- name: config
configMap:
name: {{ include "alertmanager.config.name" $ctx }}
{{- range $app.extraHostPathMounts }}
- name: {{ .name }}
hostPath:
path: {{ .hostPath }}
{{- end }}
{{- with $app.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or (eq $mode "deployment") (not $pvc.enabled) $pvc.existingClaim }}
- name: {{ $storageName }}
{{- if or (and (eq $mode "deployment") $pvc.enabled) $pvc.existingClaim }}
persistentVolumeClaim:
claimName: {{ tpl ($pvc.existingClaim | default $pvc.name | default $fullname) $ctx }}
{{- else }}
emptyDir: {{ toYaml $app.emptyDir | nindent 12 }}
{{- end }}
{{- end }}
{{- if and (eq $mode "statefulSet") $pvc.enabled (not $pvc.existingClaim) }}
volumeClaimTemplates:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ tpl ($pvc.name | default $storageName) $ctx }}
{{- with $pvc.annotations }}
annotations: {{ toYaml . | nindent 10 }}
{{- end }}
{{- with $pvc.extraLabels }}
labels: {{ toYaml . | nindent 10 }}
{{- end }}
spec:
{{- with $pvc.accessModes }}
accessModes: {{ toYaml . | nindent 10 }}
{{- end }}
resources:
requests:
storage: {{ $pvc.size }}
{{- with $pvc.storageClassName }}
storageClassName: {{ ternary "" . (eq "-" .) }}
{{- end }}
{{- with $pvc.matchLabels }}
selector:
matchLabels: {{ toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- end -}}
@@ -0,0 +1,87 @@
{{- $app := .Values.alertmanager }}
{{- $mode := $app.mode }}
{{- $service := $app.service }}
{{- $ctx := dict "helm" . "appKey" "alertmanager" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
{{- if $app.enabled -}}
---
apiVersion: v1
kind: Service
metadata:
namespace: {{ $ns }}
{{- with $service.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $app.service.labels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
spec:
{{- with $service.trafficDistribution }}
trafficDistribution: {{ . }}
{{- end }}
type: {{ $service.type }}
{{- with $service.clusterIP }}
clusterIP: {{ . }}
{{- end }}
{{- with $service.externalIPs }}
externalIPs: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with $service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
{{- with $service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with $service.healthCheckNodePort }}
healthCheckNodePort: {{ . }}
{{- end }}
{{- with $service.externalTrafficPolicy }}
externalTrafficPolicy: {{ . }}
{{- end }}
{{- with $service.ipFamilyPolicy }}
ipFamilyPolicy: {{ . }}
{{- end }}
{{- with $service.ipFamilies }}
ipFamilies: {{ toYaml . | nindent 4 }}
{{- end }}
ports:
- name: web
port: {{ $service.servicePort }}
targetPort: web
protocol: TCP
selector: {{ include "vm.selectorLabels" $ctx | nindent 4 }}
{{- end }}
{{- if and (eq $mode "statefulSet") (gt (int $app.replicaCount) 1) }}
---
apiVersion: v1
kind: Service
metadata:
namespace: {{ $ns }}
{{- with $service.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $app.service.labels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}-headless
spec:
clusterIP: None
ports:
- name: web
port: {{ $service.servicePort }}
targetPort: web
protocol: TCP
{{- if gt (int $app.replicaCount) 1 }}
- port: {{ include "vm.port.from.flag" (dict "flag" $app.cluster.listenAddress "default" "9094") }}
targetPort: cluster-tcp
protocol: TCP
name: cluster-tcp
- port: {{ include "vm.port.from.flag" (dict "flag" $app.cluster.listenAddress "default" "9094") }}
targetPort: cluster-udp
protocol: UDP
name: cluster-udp
{{- end }}
selector: {{ include "vm.selectorLabels" $ctx | nindent 4 }}
{{- end }}
@@ -0,0 +1,4 @@
{{ range .Values.extraObjects }}
---
{{ tpl (ternary . (toYaml .) (typeIs "string" .)) $ }}
{{ end }}
@@ -0,0 +1,48 @@
{{- if .Values.serviceMonitor.enabled -}}
{{- $serviceMonitor := .Values.serviceMonitor -}}
{{- $ctx := dict "helm" . "appKey" "server" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- with $serviceMonitor.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $serviceMonitor.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
{{- with $serviceMonitor.namespace }}
namespace: {{ . }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ $ns }}
selector:
matchLabels: {{ include "vm.commonLabels" $ctx | nindent 6 }}
endpoints:
- port: http
{{- with $serviceMonitor.basicAuth }}
basicAuth: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $serviceMonitor.scheme }}
scheme: {{ . }}
{{- end }}
{{- with $serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with $serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with $serviceMonitor.tlsConfig }}
tlsConfig: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $serviceMonitor.relabelings }}
relabelings: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $serviceMonitor.metricRelabelings }}
metricRelabelings: {{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
@@ -0,0 +1,14 @@
{{- if .Values.serviceAccount.create -}}
{{- $ctx := dict "helm" . }}
{{- $fullname := include "vm.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ tpl ((.Values.serviceAccount).name | default $fullname) $ctx }}
namespace: {{ $ns }}
labels: {{ include "vm.metaLabels" $ctx | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- end -}}
@@ -0,0 +1,25 @@
{{- $vpa := .Values.server.verticalPodAutoscaler }}
{{- if and (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1") $vpa.enabled }}
{{- $ctx := dict "helm" . "appKey" "server" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: {{ $fullname }}
namespace: {{ $ns }}
spec:
{{- with $vpa.recommenders }}
recommenders: {{ toYaml . | nindent 4 }}
{{- end }}
targetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ $fullname }}
{{- with $vpa.updatePolicy }}
updatePolicy: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with $vpa.resourcePolicy }}
resourcePolicy: {{ toYaml . | nindent 4 }}
{{- end }}
{{- end }}