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,33 @@
{{- if .Values.printNotes }}
{{- $ctx := dict "helm" . "style" "plain" }}
{{- $ns := include "vm.namespace" $ctx }}
{{- if .Values.vlinsert.enabled }}
{{- if .Values.vmauth.enabled }}
{{- $_ := set $ctx "appKey" "vmauth" }}
{{- else }}
{{- $_ := set $ctx "appKey" "vlinsert" }}
{{- end }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
Write API:
The VictoriaLogs ingest APIs can be accessed with the following url:
{{ include "vm.url" $ctx }}
Check how to ingest data in https://docs.victoriametrics.com/victorialogs/data-ingestion/
{{- end }}
{{- if .Values.vlselect.enabled }}
{{- if .Values.vmauth.enabled }}
{{- $_ := set $ctx "appKey" "vmauth" }}
{{- else }}
{{- $_ := set $ctx "appKey" "vlselect" }}
{{- end }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
Read API:
The VictoriaLogs query APIs can be accessed with the following url:
{{ include "vm.url" $ctx }}
Check how to query data in https://docs.victoriametrics.com/victorialogs/querying/
{{- end }}
{{- end }}
@@ -0,0 +1,148 @@
{{- define "vlinsert.args" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $app := $Values.vlinsert -}}
{{- $args := dict "select.disable" "true" -}}
{{- $ctx := dict "style" "plain" "appKey" "vlstorage" "helm" .helm }}
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" $ctx)) -}}
{{- $args = mergeOverwrite $args $app.extraArgs -}}
{{- $storage := $Values.vlstorage }}
{{- if and (not $app.suppressStorageFQDNsRender) $storage.enabled $storage.replicaCount }}
{{- $storageNodes := list }}
{{- $fqdn := include "vm.fqdn" $ctx }}
{{- $port := include "vm.port.from.flag" (dict "flag" $Values.vlstorage.extraArgs.httpListenAddr "default" "9491") }}
{{- range $i := until ($storage.replicaCount | int) -}}
{{- if not (has (float64 $i) $app.excludeStorageIDs) -}}
{{- $_ := set $ctx "appIdx" $i }}
{{- $storageNode := include "vm.fqdn" $ctx -}}
{{- $storageNodes = append $storageNodes (printf "%s:%s" $storageNode $port) -}}
{{- end -}}
{{- end -}}
{{- $_ := unset $ctx "appIdx" }}
{{- $_ := set $args "storageNode" (concat ($args.storageNode | default list) $storageNodes) }}
{{- end -}}
{{- if empty $args.storageNode }}
{{- fail "no storageNodes found. Either set vlstorage.enabled to true or add nodes to vlinsert.extraArgs.storageNode"}}
{{- end }}
{{- toYaml (fromYaml (include "vm.args" $args)).args -}}
{{- end -}}
{{- define "vmauth.args" -}}
{{- $Values := (.helm).Values | default .Values }}
{{- $app := $Values.vmauth -}}
{{- $args := dict -}}
{{- $_ := set $args "auth.config" "/config/auth.yml" -}}
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" .)) -}}
{{- $args = mergeOverwrite $args $app.extraArgs -}}
{{- toYaml (fromYaml (include "vm.args" $args)).args -}}
{{- end -}}
{{- define "vlselect.args" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $app := $Values.vlselect -}}
{{- $args := dict "insert.disable" "true" -}}
{{- $ctx := dict "style" "plain" "appKey" "vlstorage" "helm" .helm }}
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" .)) -}}
{{- $args = mergeOverwrite $args $app.extraArgs -}}
{{- $storage := $Values.vlstorage }}
{{- if and (not $app.suppressStorageFQDNsRender) $storage.enabled $storage.replicaCount }}
{{- $storageNodes := list }}
{{- $fqdn := include "vm.fqdn" $ctx }}
{{- $port := include "vm.port.from.flag" (dict "flag" $Values.vlstorage.extraArgs.httpListenAddr "default" "9491") }}
{{- range $i := until ($storage.replicaCount | int) -}}
{{- $_ := set $ctx "appIdx" $i }}
{{- $storageNode := include "vm.fqdn" $ctx -}}
{{- $storageNodes = append $storageNodes (printf "%s:%s" $storageNode $port) -}}
{{- end -}}
{{- $_ := unset $ctx "appIdx" }}
{{- $_ := set $args "storageNode" (concat ($args.storageNode | default list) $storageNodes) }}
{{- end }}
{{- if empty $args.storageNode }}
{{- fail "no storageNodes found. Either set vlstorage.enabled to true or add nodes to vlselect.extraArgs.storageNode"}}
{{- end }}
{{- toYaml (fromYaml (include "vm.args" $args)).args -}}
{{- end -}}
{{- define "vlstorage.args" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $app := $Values.vlstorage -}}
{{- $args := dict -}}
{{- if and (empty $app.retentionPeriod) (empty $app.retentionDiskSpaceUsage) (empty $app.retentionMaxDiskUsagePercent) -}}
{{- fail "either .Values.server.retentionPeriod, .Values.server.retentionDiskSpaceUsage or .Values.server.retentionMaxDiskUsagePercent should be defined" -}}
{{- end -}}
{{- with $app.retentionPeriod -}}
{{- $_ := set $args "retentionPeriod" $app.retentionPeriod -}}
{{- end -}}
{{- with $app.retentionDiskSpaceUsage -}}
{{- $retentionDiskSpaceUsage := int $app.retentionDiskSpaceUsage -}}
{{- if $retentionDiskSpaceUsage -}}
{{- $_ := set $args "retention.maxDiskSpaceUsageBytes" (printf "%dGiB" $retentionDiskSpaceUsage) -}}
{{- else -}}
{{- $_ := set $args "retention.maxDiskSpaceUsageBytes" $app.retentionDiskSpaceUsage -}}
{{- end -}}
{{- end -}}
{{- with $app.retentionMaxDiskUsagePercent -}}
{{- $_ := set $args "retention.maxDiskUsagePercent" $app.retentionMaxDiskUsagePercent -}}
{{- end -}}
{{- $_ := set $args "storageDataPath" $app.persistentVolume.mountPath -}}
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" .)) -}}
{{- $args = mergeOverwrite $args $app.extraArgs -}}
{{- toYaml (fromYaml (include "vm.args" $args)).args -}}
{{- end -}}
{{- define "vlselect.ports" -}}
{{- $service := .service }}
{{- $extraArgs := .extraArgs -}}
- name: http
port: {{ $service.servicePort }}
protocol: TCP
targetPort: {{ $service.targetPort }}
{{- range $service.extraPorts }}
- name: {{ .name }}
port: {{ .port }}
protocol: TCP
targetPort: {{ .targetPort }}
{{- end }}
{{- end -}}
{{- define "vlinsert.ports" -}}
{{- $service := .service }}
{{- $extraArgs := .extraArgs -}}
- name: http
port: {{ $service.servicePort }}
protocol: TCP
targetPort: {{ $service.targetPort }}
{{- range $service.extraPorts }}
- name: {{ .name }}
port: {{ .port }}
protocol: {{ .protocol | default "TCP" }}
targetPort: {{ .targetPort }}
{{- end }}
{{- end -}}
{{- define "vlstorage.ports" -}}
{{- $service := .service -}}
- port: {{ $service.servicePort }}
targetPort: http
protocol: TCP
name: http
{{- range $service.extraPorts }}
- name: {{ .name }}
port: {{ .port }}
protocol: TCP
targetPort: {{ .targetPort }}
{{- end }}
{{- end -}}
{{- define "vmauth.ports" -}}
{{- $service := .service -}}
- port: {{ $service.servicePort }}
targetPort: http
protocol: TCP
name: http
{{- range $service.extraPorts }}
- name: {{ .name }}
port: {{ .port }}
protocol: TCP
targetPort: {{ .targetPort }}
{{- end }}
{{- end -}}
@@ -0,0 +1,4 @@
{{ range .Values.extraObjects }}
---
{{ tpl (ternary . (toYaml .) (typeIs "string" .)) $ }}
{{ end }}
@@ -0,0 +1,29 @@
{{- $ctx := dict "helm" . }}
{{- $ns := include "vm.namespace" . }}
{{- range $name, $app := .Values }}
{{- if and (kindIs "map" $app) $app.enabled ($app.horizontalPodAutoscaler).enabled }}
{{- $isStatefulSet := eq $name "vlstorage" }}
{{- $hpa := $app.horizontalPodAutoscaler }}
{{- $_ := set $ctx "extraLabels" $app.extraLabels }}
{{- $_ := set $ctx "appKey" $name }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
labels: {{ include "vm.labels" $ctx | nindent 4 }}
name: {{ $fullname }}
namespace: {{ $ns }}
spec:
maxReplicas: {{ $hpa.maxReplicas }}
minReplicas: {{ $hpa.minReplicas }}
scaleTargetRef:
apiVersion: apps/v1
kind: {{ ternary "StatefulSet" "Deployment" $isStatefulSet }}
name: {{ $fullname }}
metrics: {{ toYaml $hpa.metrics | nindent 4 }}
{{- with $hpa.behavior }}
behavior: {{ toYaml . | nindent 4 }}
{{- end -}}
{{- end }}
{{- end }}
@@ -0,0 +1,43 @@
{{- $ctx := dict "helm" . }}
{{- range $name, $app := .Values }}
{{- if and (kindIs "map" $app) $app.enabled ($app.ingress).enabled }}
{{- $ingress := $app.ingress }}
{{- $_ := set $ctx "extraLabels" $ingress.extraLabels }}
{{- $_ := set $ctx "appKey" $name }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
{{- with $ingress.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
name: {{ $fullname }}
namespace: {{ include "vm.namespace" $ }}
spec:
{{- with $ingress.ingressClassName }}
ingressClassName: {{ . }}
{{- end }}
{{- with $ingress.tls }}
tls: {{ toYaml . | nindent 4 }}
{{- end }}
rules:
{{- range $host := $app.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 $app.ingress.pathType }}
pathType: {{ . }}
{{- end }}
backend:
service:
name: {{ $fullname }}
port: {{ include "vm.ingress.port" $host | nindent 18 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,29 @@
{{- $ctx := dict "helm" . }}
{{- range $name, $app := .Values }}
{{- if and (kindIs "map" $app) $app.enabled ($app.podDisruptionBudget).enabled }}
{{- $pdb := $app.podDisruptionBudget }}
{{- $_ := set $ctx "extraLabels" $pdb.labels }}
{{- $_ := set $ctx "appKey" $name }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ $fullname }}
namespace: {{ include "vm.namespace" $ }}
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 }}
{{- end }}
@@ -0,0 +1,43 @@
{{- $ctx := dict "helm" . }}
{{- range $name, $app := .Values }}
{{- if and (kindIs "map" $app) $app.enabled ($app.route).enabled }}
{{- $route := $app.route }}
{{- $_ := set $ctx "extraLabels" $route.extraLabels }}
{{- $_ := set $ctx "appKey" $name }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
---
apiVersion: {{ $route.apiVersion | default "gateway.networking.k8s.io/v1" }}
kind: {{ $route.kind | default "HTTPRoute" }}
metadata:
name: {{ $fullname }}
namespace: {{ include "vm.namespace" $ }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- 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 }}
{{- end }}
@@ -0,0 +1,44 @@
{{- $ctx := dict "helm" . }}
{{- range $name, $app := .Values }}
{{- if and (kindIs "map" $app) $app.enabled ($app.vmServiceScrape).enabled }}
{{- $vmServiceScrape := $app.vmServiceScrape }}
{{- $_ := set $ctx "extraLabels" $vmServiceScrape.extraLabels }}
{{- $_ := set $ctx "appKey" $name }}
{{ $fullname := include "vm.plain.fullname" $ctx }}
---
{{ if not $vmServiceScrape.useServiceMonitor }}
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
{{ else }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
{{ end }}
metadata:
{{- with $vmServiceScrape.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
{{- with $vmServiceScrape.namespace }}
namespace: {{ . }}
{{- end }}
spec:
{{- with $vmServiceScrape.spec.namespaceSelector }}
namespaceSelector: {{ toYaml . | nindent 4 }}
{{- else }}
namespaceSelector:
matchNames:
- {{ include "vm.namespace" $ }}
{{- end }}
{{- with $vmServiceScrape.spec.selector }}
selector: {{ toYaml . | nindent 4 }}
{{- else }}
selector:
matchLabels: {{ include "vm.commonLabels" $ctx | nindent 6 }}
{{- end }}
{{- with omit $app.vmServiceScrape.spec "selector" "namespaceSelector"}}
{{ toYaml . | nindent 2 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,63 @@
{{- $ctx := dict "helm" . }}
{{- range $name, $app := .Values }}
{{- if and (kindIs "map" $app) $app.enabled ($app.service).enabled }}
{{- $service := $app.service }}
{{- $_ := set $ctx "extraLabels" $service.labels }}
{{- $_ := set $ctx "appKey" $name }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
---
apiVersion: v1
kind: Service
metadata:
{{- with $service.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
namespace: {{ include "vm.namespace" $ }}
spec:
{{- with $service.trafficDistribution }}
trafficDistribution: {{ . }}
{{- end }}
{{- $type := $service.type }}
{{- if and (not $type) (eq $app.mode "statefulSet") }}
{{- $type = "ClusterIP" }}
{{- end }}
type: {{ $type }}
{{- if eq $type "ClusterIP" }}
{{- with $service.clusterIP }}
clusterIP: {{. }}
{{- end }}
{{- 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 }}
{{- $portsTpl := printf "%s.ports" $name }}
{{- with include $portsTpl $app }}
ports: {{ . | nindent 4 }}
{{- if and (eq $type "NodePort") $service.nodePort }}
nodePort: {{ $service.nodePort }}
{{- end }}
{{- end }}
selector: {{ include "vm.selectorLabels" $ctx | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,17 @@
{{- $sa := .Values.serviceAccount }}
{{- if $sa.create }}
{{- $ctx := dict "helm" . }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: v1
kind: ServiceAccount
metadata:
{{- $_ := set $ctx "extraLabels" $sa.extraLabels }}
labels: {{ include "vm.metaLabels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
{{- with $sa.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
name: {{ tpl ((.Values.serviceAccount).name | default $fullname) $ctx }}
namespace: {{ $ns }}
{{- end }}
@@ -0,0 +1,31 @@
{{- $app := (.Values).vlinsert | default dict }}
{{- $vector := (.Values).vector | default dict }}
{{- $defaultConfig := $vector.customConfigName }}
{{- if and (or $vector.enabled $vector.customConfigNamespace) (has $defaultConfig $vector.existingConfigMaps) }}
{{- $config := ($vector).customConfig | default dict }}
{{- $ctx := dict "helm" . "appKey" "vlinsert" "style" "plain" }}
{{- if $app.enabled }}
{{- $port := int $app.service.servicePort -}}
{{- range $sinkName, $sinkConfig := $config.sinks }}
{{- if and $sinkConfig (eq $sinkConfig.type "elasticsearch") }}
{{ if or (not $sinkConfig.endpoints) (kindIs "string" $sinkConfig.endpoints) }}
{{- $_ := unset $config.sinks $sinkName }}
{{- $url := printf "%s/insert/elasticsearch" (include "vm.url" $ctx) }}
{{- $_ := set $sinkConfig "endpoints" (list $url) }}
{{- $_ := set $config.sinks $sinkName (deepCopy $sinkConfig) }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- $ns := include "vm.namespace" $ctx }}
{{- $ns = ternary $ns (($vector).customConfigNamespace | default $ns) $vector.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $defaultConfig }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
namespace: {{ $ns }}
data:
{{ include "vm.fullname" $ctx }}-vector.yaml: |{{ tpl (toYaml $config) . | nindent 4 }}
{{- end }}
@@ -0,0 +1,126 @@
{{- $app := merge (deepCopy .Values.vlinsert) (deepCopy .Values.common) -}}
{{- $_ := set .Values "vlinsert" $app }}
{{- if $app.enabled -}}
{{- $ctx := dict "helm" . "appKey" "vlinsert" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $sa := include "vm.fullname" . }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: apps/v1
kind: Deployment
metadata:
{{- with $app.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $app.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
namespace: {{ $ns }}
spec:
selector:
matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 6 }}
{{- if not $app.horizontalPodAutoscaler.enabled }}
replicas: {{ $app.replicaCount }}
{{- end }}
{{- with $app.strategy }}
strategy: {{ toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
{{- with $app.podAnnotations }}
annotations: {{ toYaml . | nindent 8 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $app.podLabels }}
labels: {{ include "vm.podLabels" $ctx | nindent 8 }}
spec:
{{- with $app.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- with $app.initContainers }}
initContainers: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with ($app.imagePullSecrets | default .Values.global.imagePullSecrets) }}
imagePullSecrets: {{ toYaml . | nindent 8 }}
{{- end }}
containers:
- name: vlinsert
image: {{ include "vm.image" $ctx }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- with $app.lifecycle }}
lifecycle: {{ . | toYaml | nindent 12 }}
{{- end }}
{{- with $app.containerWorkingDir }}
workingDir: {{ . }}
{{- end }}
{{- if $app.securityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
{{- end }}
args: {{ include "vlinsert.args" $ctx | nindent 12 }}
{{- with $app.envFrom }}
envFrom: {{ tpl (toYaml .) $ctx | nindent 12 }}
{{- end }}
{{- with $app.env }}
env: {{ tpl (toYaml .) $ctx | nindent 12 }}
{{- end }}
ports:
- name: {{ $app.ports.name | default "http" }}
containerPort: {{ include "vm.port.from.flag" (dict "flag" $app.extraArgs.httpListenAddr "default" "9481") }}
{{- 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 }}
{{- $license := include "vm.license.mount" . }}
{{- if or $app.extraVolumeMounts $license }}
volumeMounts:
{{- with $app.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- $license | 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.podSecurityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.podSecurityContext "helm" .) | nindent 8 }}
{{- end }}
{{- if or (.Values.serviceAccount).name (.Values.serviceAccount).create }}
serviceAccountName: {{ tpl ((.Values.serviceAccount).name | default $sa) $ctx }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
{{- end }}
{{- with $app.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- 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 }}
terminationGracePeriodSeconds: {{ $app.terminationGracePeriodSeconds }}
{{- $license := include "vm.license.volume" . }}
{{- if or $app.extraVolumes $license }}
volumes:
{{- with $app.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- $license | nindent 8 }}
{{- end }}
{{- end }}
@@ -0,0 +1,126 @@
{{- $app := merge (deepCopy .Values.vlselect) (deepCopy .Values.common) -}}
{{- $_ := set .Values "vlselect" $app }}
{{- if $app.enabled -}}
{{- $ctx := dict "helm" . "appKey" "vlselect" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $sa := include "vm.fullname" . }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: apps/v1
kind: Deployment
metadata:
{{- with $app.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $app.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
namespace: {{ $ns }}
spec:
selector:
matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 6 }}
{{- if not $app.horizontalPodAutoscaler.enabled }}
replicas: {{ $app.replicaCount }}
{{- end }}
{{- with $app.strategy }}
strategy: {{ toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
{{- with $app.podAnnotations }}
annotations: {{ toYaml . | nindent 8 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $app.podLabels }}
labels: {{ include "vm.podLabels" $ctx | nindent 8 }}
spec:
{{- with $app.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- with $app.initContainers }}
initContainers: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with ($app.imagePullSecrets | default .Values.global.imagePullSecrets) }}
imagePullSecrets: {{ toYaml . | nindent 8 }}
{{- end }}
containers:
- name: vlselect
image: {{ include "vm.image" $ctx }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- with $app.lifecycle }}
lifecycle: {{ . | toYaml | nindent 12 }}
{{- end }}
{{- with $app.containerWorkingDir }}
workingDir: {{ . }}
{{- end }}
{{- if $app.securityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
{{- end }}
args: {{ include "vlselect.args" $ctx | nindent 12 }}
{{- with $app.envFrom }}
envFrom: {{ tpl (toYaml .) $ctx | nindent 12 }}
{{- end }}
{{- with $app.env }}
env: {{ tpl (toYaml .) $ctx | nindent 12 }}
{{- end }}
ports:
- name: {{ $app.ports.name | default "http" }}
containerPort: {{ include "vm.port.from.flag" (dict "flag" $app.extraArgs.httpListenAddr "default" "9481") }}
{{- 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 }}
{{- $license := include "vm.license.mount" . }}
{{- if or $app.extraVolumeMounts $license }}
volumeMounts:
{{- with $app.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- $license | 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.podSecurityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.podSecurityContext "helm" .) | nindent 8 }}
{{- end }}
{{- if or (.Values.serviceAccount).name (.Values.serviceAccount).create }}
serviceAccountName: {{ tpl ((.Values.serviceAccount).name | default $sa) $ctx }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
{{- end }}
{{- with $app.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- 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 }}
terminationGracePeriodSeconds: {{ $app.terminationGracePeriodSeconds }}
{{- $license := include "vm.license.volume" . }}
{{- if or $app.extraVolumes $license }}
volumes:
{{- with $app.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- $license | nindent 8 }}
{{- end }}
{{- end }}
@@ -0,0 +1,165 @@
{{- $app := merge (deepCopy .Values.vlstorage) (deepCopy .Values.common) -}}
{{- $pvc := $app.persistentVolume }}
{{- $_ := set .Values "vlstorage" $app }}
{{- if $app.enabled -}}
{{- $ctx := dict "helm" . "appKey" "vlstorage" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $sa := include "vm.fullname" . }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
{{- with $app.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $app.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
namespace: {{ $ns }}
spec:
serviceName: {{ $fullname }}
selector:
matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 6 }}
replicas: {{ $app.replicaCount }}
podManagementPolicy: {{ $app.podManagementPolicy }}
template:
metadata:
{{- with $app.podAnnotations }}
annotations: {{ toYaml . | nindent 8 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $app.podLabels }}
labels: {{ include "vm.podLabels" $ctx | nindent 8 }}
spec:
{{- with $app.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- with $app.initContainers }}
initContainers: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with ($app.imagePullSecrets | default .Values.global.imagePullSecrets) }}
imagePullSecrets: {{ toYaml . | nindent 8 }}
{{- end }}
containers:
- name: vlstorage
{{- $_ := set $ctx "appKey" "vlstorage" }}
image: {{ include "vm.image" $ctx }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- with $app.containerWorkingDir }}
workingDir: {{ . }}
{{- end }}
{{- if $app.securityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
{{- end }}
{{- with $app.lifecycle }}
lifecycle: {{ . | toYaml | nindent 12 }}
{{- end }}
args: {{ include "vlstorage.args" $ctx | nindent 12 }}
ports:
- name: {{ $app.ports.name | default "http" }}
containerPort: {{ include "vm.port.from.flag" (dict "flag" $app.extraArgs.httpListenAddr "default" "9491") }}
{{- with $app.envFrom }}
envFrom: {{ tpl (toYaml .) $ctx | nindent 12 }}
{{- end }}
{{- with $app.env }}
env: {{ tpl (toYaml .) $ctx | nindent 12 }}
{{- end }}
{{- 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 }}
{{- with $app.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- with $pvc }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
{{- with .subPath }}
subPath: {{ . }}
{{- end }}
{{- end }}
{{- with $app.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- include "vm.license.mount" . | nindent 12 }}
{{- with $app.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $app.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- if $app.podSecurityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.podSecurityContext "helm" .) | nindent 8 }}
{{- end }}
{{- if or (.Values.serviceAccount).name (.Values.serviceAccount).create }}
serviceAccountName: {{ tpl ((.Values.serviceAccount).name | default $sa) $ctx }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
{{- end }}
{{- with $app.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- 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 }}
terminationGracePeriodSeconds: {{ $app.terminationGracePeriodSeconds }}
{{- $license := include "vm.license.volume" . }}
{{- if or $app.extraVolumes (not $pvc.enabled) $pvc.existingClaim $license }}
volumes:
{{- with $app.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or (not $pvc.enabled) $pvc.existingClaim }}
- name: vlstorage-volume
{{- if $pvc.enabled }}
persistentVolumeClaim:
claimName: {{ $pvc.existingClaim }}
{{- else }}
emptyDir: {{ toYaml $app.emptyDir | nindent 12 }}
{{- end }}
{{- end }}
{{- $license | nindent 8 }}
{{- end }}
minReadySeconds: {{ $app.minReadySeconds }}
{{- if and $pvc.enabled (not $pvc.existingClaim) }}
volumeClaimTemplates:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ tpl $pvc.name $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 }}
{{- with $pvc.volumeAttributeClassName }}
volumeAttributesClassName: {{ . }}
{{- end }}
resources:
requests:
storage: {{ $pvc.size }}
{{- with $pvc.storageClassName }}
storageClassName: {{ ternary "" . (eq "-" .) }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,37 @@
{{- if and (empty .Values.vmauth.configSecretName) .Values.vmauth.enabled }}
{{- $ctx := dict "helm" . "appKey" "vmauth" "style" "plain" }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "vm.plain.fullname" $ctx }}
namespace: {{ include "vm.namespace" $ctx }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
type: Opaque
data:
{{- $config := .Values.vmauth.config }}
{{- $_ := set . "style" "plain" }}
{{- $_ := set . "appKey" "vlinsert" -}}
{{- $writeURL := urlParse (include "vm.url" .) -}}
{{- $_ := set $writeURL "path" (printf "%s/insert" $writeURL.path) -}}
{{- $_ := set . "appKey" "vlselect" -}}
{{- $readURL := urlParse (include "vm.url" .) -}}
{{- $_ := set $readURL "path" (printf "%s/select" $readURL.path) -}}
{{- $_ := set . "vm" (dict "read" $readURL "write" $writeURL) -}}
{{- if or (empty $config) $config.unauthorized_user }}
{{- $urlMap := ($config.unauthorized_user).url_map | default list }}
{{- if empty $urlMap }}
{{- if $.Values.vlselect.service.enabled }}
{{- $readPaths := list (printf "%s/.*" $readURL.path) }}
{{- $readPrefix := urlJoin (omit .vm.read "path") }}
{{- $urlMap = append $urlMap (dict "src_paths" $readPaths "url_prefix" $readPrefix "discover_backend_ips" true) }}
{{- end }}
{{- if $.Values.vlinsert.service.enabled }}
{{- $writePaths := list (printf "%s/.*" $writeURL.path) }}
{{- $writePrefix := urlJoin (omit .vm.write "path") }}
{{- $urlMap = append $urlMap (dict "src_paths" $writePaths "url_prefix" $writePrefix "discover_backend_ips" true) }}
{{- end }}
{{- $_ := set $config "unauthorized_user" (dict "url_map" $urlMap) }}
{{- end }}
{{- end }}
auth.yml: | {{ tpl (toYaml $config) . | b64enc | nindent 4 }}
{{- end }}
@@ -0,0 +1,127 @@
{{- $app := merge (deepCopy .Values.vmauth) (deepCopy .Values.common) -}}
{{- $_ := set .Values "vmauth" $app }}
{{- if $app.enabled -}}
{{- $ctx := dict "helm" . "appKey" "vmauth" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $sa := include "vm.fullname" . }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: apps/v1
kind: Deployment
metadata:
{{- with $app.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" $app.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
namespace: {{ $ns }}
spec:
selector:
matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 6 }}
{{- if not $app.horizontalPodAutoscaler.enabled }}
replicas: {{ $app.replicaCount }}
{{- end }}
{{- with $app.strategy }}
strategy: {{ toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
annotations:
{{- with $app.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
checksum/config: {{ include (print $.Template.BasePath "/vmauth-config.yaml") . | sha256sum }}
{{- $_ := set $ctx "extraLabels" $app.podLabels }}
labels: {{ include "vm.podLabels" $ctx | nindent 8 }}
{{- $_ := unset $ctx "extraLabels" }}
spec:
{{- with $app.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- if or (.Values.serviceAccount).name (.Values.serviceAccount).create }}
serviceAccountName: {{ tpl ((.Values.serviceAccount).name | default $sa) $ctx }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
{{- end }}
{{- with $app.initContainers }}
initContainers: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with ($app.imagePullSecrets | default .Values.global.imagePullSecrets) }}
imagePullSecrets: {{ toYaml . | nindent 8 }}
{{- end }}
containers:
- name: vmauth
image: {{ include "vm.image" $ctx }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- with $app.lifecycle }}
lifecycle: {{ . | toYaml | nindent 12 }}
{{- end }}
{{- with $app.containerWorkingDir }}
workingDir: {{ . }}
{{- end }}
{{- if $app.securityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
{{- end }}
args: {{ include "vmauth.args" $ctx | nindent 12 }}
{{- with $app.envFrom }}
envFrom: {{ tpl (toYaml .) $ctx | nindent 12 }}
{{- end }}
{{- with $app.env }}
env: {{ tpl (toYaml .) $ctx | nindent 12 }}
{{- end }}
ports:
- name: {{ $app.ports.name | default "http" }}
containerPort: {{ include "vm.port.from.flag" (dict "flag" $app.extraArgs.httpListenAddr "default" "8427") }}
{{- 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: config
mountPath: /config
{{- with $app.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- 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 }}
{{- if $app.podSecurityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.podSecurityContext "helm" .) | nindent 8 }}
{{- end }}
{{- with $app.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- 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 }}
volumes:
- name: config
secret:
secretName: {{ ternary $fullname $app.configSecretName (empty $app.configSecretName) }}
{{- with $app.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "vm.license.volume" . | nindent 8 }}
{{- end }}
@@ -0,0 +1,32 @@
{{- $ctx := dict "helm" . }}
{{- $ns := include "vm.namespace" . }}
{{- range $name, $app := .Values }}
{{- if and ($.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1") (kindIs "map" $app) $app.enabled ($app.verticalPodAutoscaler).enabled }}
{{- $isStatefulSet := eq $name "vlstorage" }}
{{- $vpa := $app.verticalPodAutoscaler }}
{{- $_ := set $ctx "extraLabels" $app.extraLabels }}
{{- $_ := set $ctx "appKey" $name }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
---
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
labels: {{ include "vm.labels" $ctx | nindent 4 }}
name: {{ $fullname }}
namespace: {{ $ns }}
spec:
{{- with $vpa.recommenders }}
recommenders: {{ toYaml . | nindent 4 }}
{{- end }}
targetRef:
apiVersion: apps/v1
kind: {{ ternary "StatefulSet" "Deployment" $isStatefulSet }}
name: {{ $fullname }}
{{- with $vpa.updatePolicy }}
updatePolicy: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with $vpa.resourcePolicy }}
resourcePolicy: {{ toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}