diff --git a/charts/victoria-metrics-cluster/CHANGELOG.md b/charts/victoria-metrics-cluster/CHANGELOG.md
index 20f93a13e..f9a0f85bc 100644
--- a/charts/victoria-metrics-cluster/CHANGELOG.md
+++ b/charts/victoria-metrics-cluster/CHANGELOG.md
@@ -2,7 +2,9 @@
## Next release
-- TODO
+- Support extra storageNodes. Fail if no storageNodes set
+- Replace storageNode list for enterprise with autodiscovered storage nodes
+- Added HPA with scaledown disabled by default
## 0.13.7
diff --git a/charts/victoria-metrics-cluster/README.md b/charts/victoria-metrics-cluster/README.md
index 64346cc48..4dc157bfa 100644
--- a/charts/victoria-metrics-cluster/README.md
+++ b/charts/victoria-metrics-cluster/README.md
@@ -772,6 +772,15 @@ enabled: false
Service ClusterIP
|
+
+ vminsert.service.enabled |
+ bool |
+
+true
+
+ |
+ |
+
vminsert.service.externalIPs |
list |
@@ -1589,6 +1598,15 @@ enabled: true
Service ClusterIP
|
+
+ vmselect.service.enabled |
+ bool |
+
+true
+
+ |
+ |
+
vmselect.service.externalIPs |
list |
@@ -2003,6 +2021,57 @@ null
Overrides the full name of vmstorage component
+ |
+
+
+ vmstorage.horizontalPodAutoscaler.behavior |
+ object |
+
+scaleDown:
+ selectPolicy: Disabled
+
+ |
+ Behavior settings for scaling by the HPA
+ |
+
+
+ vmstorage.horizontalPodAutoscaler.enabled |
+ bool |
+
+false
+
+ |
+ Use HPA for vmstorage component
+ |
+
+
+ vmstorage.horizontalPodAutoscaler.maxReplicas |
+ int |
+
+10
+
+ |
+ Maximum replicas for HPA to use to to scale the vmstorage component
+ |
+
+
+ vmstorage.horizontalPodAutoscaler.metrics |
+ list |
+
+[]
+
+ |
+ Metric for HPA to use to scale the vmstorage component
+ |
+
+
+ vmstorage.horizontalPodAutoscaler.minReplicas |
+ int |
+
+2
+
+ |
+ Minimum replicas for HPA to use to scale the vmstorage component
|
@@ -2338,6 +2407,24 @@ enabled: false
Service annotations
|
+
+ vmstorage.service.clusterIP |
+ string |
+
+None
+
+ |
+ |
+
+
+ vmstorage.service.enabled |
+ bool |
+
+true
+
+ |
+ |
+
vmstorage.service.externalTrafficPolicy |
string |
@@ -2404,6 +2491,15 @@ enabled: false
Service port
|
+
+ vmstorage.service.type |
+ string |
+
+ClusterIP
+
+ |
+ |
+
vmstorage.service.vminsertPort |
int |
diff --git a/charts/victoria-metrics-cluster/templates/NOTES.txt b/charts/victoria-metrics-cluster/templates/NOTES.txt
index 974d01e15..41f89d4da 100644
--- a/charts/victoria-metrics-cluster/templates/NOTES.txt
+++ b/charts/victoria-metrics-cluster/templates/NOTES.txt
@@ -1,20 +1,22 @@
{{ if .Values.printNotes }}
+{{- $ctx := dict "helm" . "style" "plain" }}
{{ if .Values.vminsert.enabled }}
+{{- $_ := set $ctx "appKey" "vminsert" }}
Write API:
The Victoria Metrics write api can be accessed via port {{ .Values.vminsert.service.servicePort }} with the following DNS name from within your cluster:
-{{ include "victoria-metrics.vminsert.fullname" . }}.{{ include "vm.namespace" . }}.svc.{{ .Values.clusterDomainSuffix }}
+{{ include "vm.fqdn" $ctx }}
Get the Victoria Metrics insert service URL by running these commands in the same shell:
{{- if contains "NodePort" .Values.vminsert.service.type }}
- export NODE_PORT=$(kubectl get --namespace {{ include "vm.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "victoria-metrics.vminsert.fullname" . }})
+ export NODE_PORT=$(kubectl get --namespace {{ include "vm.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "vm.service" $ctx }})
export NODE_IP=$(kubectl get nodes --namespace {{ include "vm.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.vminsert.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
- You can watch the status of by running 'kubectl get svc --namespace {{ include "vm.namespace" . }} -w {{ include "victoria-metrics.vminsert.fullname" . }}'
+ You can watch the status of by running 'kubectl get svc --namespace {{ include "vm.namespace" . }} -w {{ include "vm.service" $ctx }}'
- export SERVICE_IP=$(kubectl get svc --namespace {{ include "vm.namespace" . }} {{ include "victoria-metrics.vminsert.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
+ export SERVICE_IP=$(kubectl get svc --namespace {{ include "vm.namespace" . }} {{ include "vm.service" $ctx }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.vminsert.service.servicePort }}
{{- else if contains "ClusterIP" .Values.vminsert.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ include "vm.namespace" . }} -l "app={{ .Values.vminsert.name }}" -o jsonpath="{.items[0].metadata.name}")
@@ -33,26 +35,27 @@ prometheus.yml
for example - inside the Kubernetes cluster:
remote_write:
- - url: "http://{{ include "victoria-metrics.vminsert.fullname" . }}.{{ include "vm.namespace" . }}.svc.{{ .Values.clusterDomainSuffix }}:{{ .Values.vminsert.service.servicePort }}/insert/0/prometheus/"
+ - url: "http://{{ include "vm.fqdn" $ctx }}:{{ .Values.vminsert.service.servicePort }}/insert/0/prometheus/"
{{- end }}
{{- if .Values.vmselect.enabled }}
+{{- $_ := set $ctx "appKey" "vmselect" }}
Read API:
The VictoriaMetrics read api can be accessed via port {{ .Values.vmselect.service.servicePort }} with the following DNS name from within your cluster:
-{{ include "victoria-metrics.vmselect.fullname" . }}.{{ include "vm.namespace" . }}.svc.{{ .Values.clusterDomainSuffix }}
+{{ include "vm.fqdn" $ctx }}
Get the VictoriaMetrics select service URL by running these commands in the same shell:
{{- if contains "NodePort" .Values.vmselect.service.type }}
- export NODE_PORT=$(kubectl get --namespace {{ include "vm.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "victoria-metrics.vminsert.fullname" . }})
+ export NODE_PORT=$(kubectl get --namespace {{ include "vm.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "vm.service" $ctx }})
export NODE_IP=$(kubectl get nodes --namespace {{ include "vm.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.vmselect.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
- You can watch the status of by running 'kubectl get svc --namespace {{ include "vm.namespace" . }} -w {{ include "victoria-metrics.vminsert.fullname" . }}'
+ You can watch the status of by running 'kubectl get svc --namespace {{ include "vm.namespace" . }} -w {{ include "vm.service" $ctx }}'
- export SERVICE_IP=$(kubectl get svc --namespace {{ include "vm.namespace" . }} {{ include "victoria-metrics.vmselect.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
+ export SERVICE_IP=$(kubectl get svc --namespace {{ include "vm.namespace" . }} {{ include "vm.service" $ctx }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.vmselect.service.servicePort }}
{{- else if contains "ClusterIP" .Values.vmselect.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ include "vm.namespace" . }} -l "app={{ .Values.vmselect.name }}" -o jsonpath="{.items[0].metadata.name}")
@@ -69,7 +72,7 @@ Input this URL field into Grafana
for example - inside the Kubernetes cluster:
- http://{{ include "victoria-metrics.vmselect.fullname" . }}.{{ include "vm.namespace" . }}.svc.{{ .Values.clusterDomainSuffix }}:{{ .Values.vmselect.service.servicePort }}/select/0/prometheus/
+ http://{{ include "vm.fqdn" $ctx }}:{{ .Values.vmselect.service.servicePort }}/select/0/prometheus/
{{- end }}
{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/_helpers.tpl b/charts/victoria-metrics-cluster/templates/_helpers.tpl
index b12a8d277..d14ed4639 100644
--- a/charts/victoria-metrics-cluster/templates/_helpers.tpl
+++ b/charts/victoria-metrics-cluster/templates/_helpers.tpl
@@ -1,65 +1,24 @@
-{{/* vim: set filetype=mustache: */}}
-{{/*
-Expand the name of the chart.
-*/}}
-{{- define "victoria-metrics.name" -}}
-{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
-{{- end -}}
-
-{{/*
-Create a default fully qualified app name.
-We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
-If release name contains chart name it will be used as a full name.
-*/}}
-{{- define "victoria-metrics.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 "victoria-metrics.chart" -}}
-{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
-{{- end -}}
-
-{{/*
-Create the name of the service account
-*/}}
-{{- define "victoria-metrics.serviceAccountName" -}}
-{{- if .Values.serviceAccount.create -}}
- {{ default (include "victoria-metrics.fullname" .) .Values.serviceAccount.name }}
-{{- else -}}
- {{ default "default" .Values.serviceAccount.name }}
-{{- end -}}
-{{- end -}}
-
{{/*
Create unified labels for victoria-metrics components
*/}}
{{- define "victoria-metrics.common.matchLabels" -}}
-app.kubernetes.io/name: {{ include "victoria-metrics.name" . }}
-app.kubernetes.io/instance: {{ .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- $Release := (.helm).Release | default .Release -}}
+app.kubernetes.io/name: {{ include "vm.name" . }}
+app.kubernetes.io/instance: {{ $Release.Name | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{- define "victoria-metrics.common.metaLabels" -}}
-helm.sh/chart: {{ include "victoria-metrics.chart" . }}
-app.kubernetes.io/managed-by: {{ .Release.Service | trunc 63 | trimSuffix "-" }}
+{{- $Release := (.helm).Release | default .Release -}}
+helm.sh/chart: {{ include "vm.chart" . }}
+app.kubernetes.io/managed-by: {{ $Release.Service | trunc 63 | trimSuffix "-" }}
{{- with .extraLabels }}
{{ toYaml . }}
{{- end }}
{{- end -}}
{{- define "victoria-metrics.common.podLabels" -}}
-app.kubernetes.io/managed-by: {{ .Release.Service | trunc 63 | trimSuffix "-" }}
+{{- $Release := (.helm).Release | default .Release -}}
+app.kubernetes.io/managed-by: {{ $Release.Service | trunc 63 | trimSuffix "-" }}
{{- with .extraLabels }}
{{ toYaml . }}
{{- end }}
@@ -76,7 +35,8 @@ app.kubernetes.io/managed-by: {{ .Release.Service | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{- define "victoria-metrics.vmstorage.matchLabels" -}}
-app: {{ .Values.vmstorage.name }}
+{{- $Values := (.helm).Values | default .Values -}}
+app: {{ $Values.vmstorage.name | default "vmstorage" }}
{{ include "victoria-metrics.common.matchLabels" . }}
{{- end -}}
@@ -91,7 +51,8 @@ app: {{ .Values.vmstorage.name }}
{{- end -}}
{{- define "victoria-metrics.vmselect.matchLabels" -}}
-app: {{ .Values.vmselect.name }}
+{{- $Values := (.helm).Values | default .Values -}}
+app: {{ $Values.vmselect.name | default "vmselect" }}
{{ include "victoria-metrics.common.matchLabels" . }}
{{- end -}}
@@ -106,131 +67,126 @@ app: {{ .Values.vmselect.name }}
{{- end -}}
{{- define "victoria-metrics.vminsert.matchLabels" -}}
-app: {{ .Values.vminsert.name }}
+{{- $Values := (.helm).Values | default .Values -}}
+app: {{ $Values.vminsert.name | default "vminsert" }}
{{ include "victoria-metrics.common.matchLabels" . }}
{{- end -}}
-{{/*
-Create a fully qualified vmstorage name.
-We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
-*/}}
-{{- define "victoria-metrics.vmstorage.fullname" -}}
-{{- if .Values.vmstorage.fullnameOverride -}}
-{{- .Values.vmstorage.fullnameOverride | trunc 63 | trimSuffix "-" -}}
-{{- else -}}
-{{- $name := default .Chart.Name .Values.nameOverride -}}
-{{- if contains $name .Release.Name -}}
-{{- printf "%s-%s" .Release.Name .Values.vmstorage.name | trunc 63 | trimSuffix "-" -}}
-{{- else -}}
-{{- printf "%s-%s-%s" .Release.Name $name .Values.vmstorage.name | trunc 63 | trimSuffix "-" -}}
-{{- end -}}
-{{- end -}}
-{{- end -}}
-
-{{/*
-Create a fully qualified vmselect name.
-We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
-*/}}
-{{- define "victoria-metrics.vmselect.fullname" -}}
-{{- if .Values.vmselect.fullnameOverride -}}
-{{- .Values.vmselect.fullnameOverride | trunc 63 | trimSuffix "-" -}}
-{{- else -}}
-{{- $name := default .Chart.Name .Values.nameOverride -}}
-{{- if contains $name .Release.Name -}}
-{{- printf "%s-%s" .Release.Name .Values.vmselect.name | trunc 63 | trimSuffix "-" -}}
-{{- else -}}
-{{- printf "%s-%s-%s" .Release.Name $name .Values.vmselect.name | trunc 63 | trimSuffix "-" -}}
-{{- end -}}
-{{- end -}}
-{{- end -}}
-
-{{/*
-Create a fully qualified vminsert name.
-We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
-*/}}
-{{- define "victoria-metrics.vminsert.fullname" -}}
-{{- if .Values.vminsert.fullnameOverride -}}
-{{- .Values.vminsert.fullnameOverride | trunc 63 | trimSuffix "-" -}}
-{{- else -}}
-{{- $name := default .Chart.Name .Values.nameOverride -}}
-{{- if contains $name .Release.Name -}}
-{{- printf "%s-%s" .Release.Name .Values.vminsert.name | trunc 63 | trimSuffix "-" -}}
-{{- else -}}
-{{- printf "%s-%s-%s" .Release.Name $name .Values.vminsert.name | trunc 63 | trimSuffix "-" -}}
-{{- end -}}
-{{- end -}}
+{{- define "victoria-metrics.vmauth.labels" -}}
+{{ include "victoria-metrics.vmauth.matchLabels" . }}
+{{ include "victoria-metrics.common.metaLabels" . }}
{{- end -}}
-{{- define "victoria-metrics.vminsert.vmstorage-pod-fqdn" -}}
- {{- $svc := include "victoria-metrics.vmstorage.fullname" . -}}
- {{- $namespace := (include "vm.namespace" .) -}}
- {{- $dnsSuffix := .Values.clusterDomainSuffix -}}
- {{- $storageNodes := default list -}}
- {{- range $i := until (.Values.vmstorage.replicaCount | int) -}}
- {{- $value := printf "%s-%d.%s.%s.svc.%s:8400" $svc $i $svc $namespace $dnsSuffix -}}
- {{- $storageNodes = append $storageNodes $value -}}
- {{- end -}}
- {{- toYaml (dict "storageNode" $storageNodes) -}}
+{{- define "victoria-metrics.vmauth.podLabels" -}}
+{{ include "victoria-metrics.vmauth.matchLabels" . }}
+{{ include "victoria-metrics.common.podLabels" . }}
{{- end -}}
-{{- define "victoria-metrics.vmselect.vmstorage-pod-fqdn" -}}
- {{- $svc := include "victoria-metrics.vmstorage.fullname" . -}}
- {{- $namespace := (include "vm.namespace" .) -}}
- {{- $dnsSuffix := .Values.clusterDomainSuffix -}}
- {{- $storageNodes := default list -}}
- {{- range $i := until (.Values.vmstorage.replicaCount | int) -}}
- {{- $value := printf "%s-%d.%s.%s.svc.%s:8401" $svc $i $svc $namespace $dnsSuffix -}}
- {{- $storageNodes = append $storageNodes $value -}}
- {{- end -}}
- {{- toYaml (dict "storageNode" $storageNodes) -}}
+{{- define "victoria-metrics.vmauth.matchLabels" -}}
+{{- $Values := (.helm).Values | default .Values -}}
+app: {{ $Values.vmauth.name | default "vmauth" }}
+{{ include "victoria-metrics.common.matchLabels" . }}
{{- end -}}
-{{- define "victoria-metrics.vmselect.vmselect-pod-fqdn" -}}
- {{- $svc := include "victoria-metrics.vmselect.fullname" . -}}
- {{- $namespace := (include "vm.namespace" .) -}}
- {{- $dnsSuffix := .Values.clusterDomainSuffix -}}
- {{- $port := "8481" }}
- {{- with .Values.vmselect.extraArgs.httpListenAddr }}
- {{- $port = regexReplaceAll ".*:(\\d+)" . "${1}" }}
- {{- end -}}
- {{- $selectNodes := default list -}}
- {{- range $i := until (.Values.vmselect.replicaCount | int) -}}
- {{- $value := printf "%s-%d.%s.%s.svc.%s:%s" $svc $i $svc $namespace $dnsSuffix $port -}}
- {{- $selectNodes = append $selectNodes $value -}}
+{{- define "vminsert.args" -}}
+ {{- $Values := (.helm).Values | default .Values -}}
+ {{- $app := $Values.vminsert -}}
+ {{- $args := default dict -}}
+ {{- $_ := set . "style" "plain" }}
+ {{- $_ := set . "appKey" "vmstorage" }}
+ {{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" .)) -}}
+ {{- $args = mergeOverwrite $args $app.extraArgs -}}
+ {{- $storage := $Values.vmstorage }}
+ {{- if and (not $app.suppressStorageFQDNsRender) (and $storage.enabled $storage.replicaCount) }}
+ {{- $storageNodes := default list }}
+ {{- $fqdn := include "vm.fqdn" . }}
+ {{- if or $args.license $args.licenseFile }}
+ {{- $storageNode := printf "srv+_vminsert._tcp.%s" $fqdn }}
+ {{- $storageNodes = append $storageNodes $storageNode }}
+ {{- else }}
+ {{- $port := "8400" }}
+ {{- range $i := until ($storage.replicaCount | int) -}}
+ {{- $_ := set $ "appIdx" $i }}
+ {{- $storageNode := include "vm.fqdn" $ -}}
+ {{- $storageNodes = append $storageNodes (printf "%s:%s" $storageNode $port) -}}
+ {{- end -}}
+ {{- $_ := unset $ "appIdx" }}
+ {{- end }}
+ {{- $_ := set $args "storageNode" (concat ($args.storageNode | default list) $storageNodes) }}
{{- end -}}
- {{- toYaml (dict "selectNode" $selectNodes) -}}
+ {{- if empty $args.storageNode }}
+ {{- fail "no storageNodes found. Either set vmstorage.enabled to true or add nodes to vminsert.extraArgs.storageNode"}}
+ {{- end }}
+ {{- toYaml (fromYaml (include "vm.args" $args)).args -}}
{{- end -}}
-{{- define "vminsert.args" -}}
- {{- $app := .Values.vminsert -}}
+{{- define "vmauth.args" -}}
+ {{- $Values := (.helm).Values | default .Values }}
+ {{- $app := $Values.vmauth -}}
{{- $args := default dict -}}
- {{- if not (or $app.suppresStorageFQDNsRender $app.suppressStorageFQDNsRender) }}
- {{- $args = (fromYaml (include "victoria-metrics.vminsert.vmstorage-pod-fqdn" .)) }}
- {{- end -}}
+ {{- $_ := 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 "vmselect.args" -}}
- {{- $app := .Values.vmselect -}}
+ {{- $Values := (.helm).Values | default .Values -}}
+ {{- $app := $Values.vmselect -}}
{{- $args := default dict -}}
- {{- if not (or $app.suppressStorageFQDNsRender $app.suppresStorageFQDNsRender) }}
- {{- $args = (fromYaml (include "victoria-metrics.vmselect.vmstorage-pod-fqdn" .)) -}}
- {{- end -}}
- {{- if .Values.vmselect.statefulSet.enabled }}
- {{- with (include "victoria-metrics.vmselect.vmselect-pod-fqdn" .) -}}
- {{- $args = mergeOverwrite $args (fromYaml .) -}}
- {{- end -}}
- {{- end -}}
+ {{- $_ := set . "style" "plain" }}
+ {{- $_ := set . "appKey" "vmstorage" }}
{{- $_ := set $args "cacheDataPath" $app.cacheMountPath -}}
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" .)) -}}
{{- $args = mergeOverwrite $args $app.extraArgs -}}
+ {{- $storage := $Values.vmstorage }}
+ {{- if and (not $app.suppressStorageFQDNsRender) (and $storage.enabled $storage.replicaCount) }}
+ {{- $storageNodes := default list }}
+ {{- $fqdn := include "vm.fqdn" . }}
+ {{- if or $args.license $args.licenseFile }}
+ {{- $storageNode := printf "srv+_vmselect._tcp.%s" $fqdn }}
+ {{- $storageNodes = append $storageNodes $storageNode }}
+ {{- else }}
+ {{- $port := "8401" }}
+ {{- range $i := until ($storage.replicaCount | int) -}}
+ {{- $_ := set $ "appIdx" $i }}
+ {{- $storageNode := include "vm.fqdn" $ -}}
+ {{- $storageNodes = append $storageNodes (printf "%s:%s" $storageNode $port) -}}
+ {{- end -}}
+ {{- $_ := unset . "appIdx" }}
+ {{- end }}
+ {{- $_ := set $args "storageNode" (concat ($args.storageNode | default list) $storageNodes) }}
+ {{- end }}
+ {{- if and $app.statefulSet.enabled $app.enabled $app.replicaCount }}
+ {{- $selectNodes := default list }}
+ {{- $_ := set . "appKey" "vmselect" }}
+ {{- $fqdn := include "vm.fqdn" . }}
+ {{- if or $args.license $args.licenseFile }}
+ {{- $selectNode := printf "srv+_http._tcp.%s" $fqdn }}
+ {{- $selectNodes = append $selectNodes $selectNode }}
+ {{- else }}
+ {{- $port := "8481" }}
+ {{- with $app.extraArgs.httpListenAddr }}
+ {{- $port = regexReplaceAll ".*:(\\d+)" . "${1}" }}
+ {{- end -}}
+ {{- range $i := until ($app.replicaCount | int) -}}
+ {{- $_ := set $ "appIdx" $i }}
+ {{- $selectNode := include "vm.fqdn" $ -}}
+ {{- $selectNodes = append $selectNodes (printf "%s:%s" $selectNode $port) -}}
+ {{- end -}}
+ {{- $_ := unset $ "appIdx" }}
+ {{- end }}
+ {{- $_ := set $args "selectNode" (concat ($args.selectNode | default list) $selectNodes) }}
+ {{- end -}}
+ {{- if empty $args.storageNode }}
+ {{- fail "no storageNodes found. Either set vmstorage.enabled to true or add nodes to vmselect.extraArgs.storageNode"}}
+ {{- end }}
{{- toYaml (fromYaml (include "vm.args" $args)).args -}}
{{- end -}}
{{- define "vmstorage.args" -}}
- {{- $app := .Values.vmstorage -}}
+ {{- $Values := (.helm).Values | default .Values -}}
+ {{- $app := $Values.vmstorage -}}
{{- $args := default dict -}}
{{- $_ := set $args "retentionPeriod" (toString $app.retentionPeriod) -}}
{{- $_ := set $args "storageDataPath" $app.persistentVolume.mountPath -}}
@@ -240,7 +196,8 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- end -}}
{{- define "vmbackupmanager.args" -}}
- {{- $app := .Values.vmstorage -}}
+ {{- $Values := (.helm).Values | default .Values -}}
+ {{- $app := $Values.vmstorage -}}
{{- $manager := $app.vmbackupmanager -}}
{{- $args := default dict -}}
{{- $_ := set $args "disableHourly" $manager.disableHourly -}}
@@ -261,7 +218,8 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- end -}}
{{- define "vmbackupmanager.restore.args" -}}
- {{- $app := .Values.vmstorage -}}
+ {{- $Values := (.helm).Values | default .Values -}}
+ {{- $app := $Values.vmstorage -}}
{{- $manager := $app.vmbackupmanager -}}
{{- $args := default dict -}}
{{- $_ := set $args "storageDataPath" $app.persistentVolume.mountPath -}}
@@ -271,3 +229,112 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- $output = concat (list "restore") $output -}}
{{- toYaml $output -}}
{{- end -}}
+
+{{- define "vmselect.ports" -}}
+- name: http
+ port: {{ .service.servicePort }}
+ protocol: TCP
+ targetPort: {{ .service.targetPort }}
+{{- range .service.extraPorts }}
+- name: {{ .name }}
+ port: {{ .port }}
+ protocol: TCP
+ targetPort: {{ .targetPort }}
+{{- end }}
+{{- with .extraArgs.clusternativeListenAddr }}
+- name: cluster-tcp
+ protocol: TCP
+ port: {{ include "vm.port.from.flag" (dict "flag" .) }}
+ targetPort: cluster-tcp
+{{- end }}
+{{- end -}}
+
+{{- define "vminsert.ports" -}}
+- name: http
+ port: {{ .service.servicePort }}
+ protocol: TCP
+ targetPort: {{ .service.targetPort }}
+{{- range .service.extraPorts }}
+- name: {{ .name }}
+ port: {{ .port }}
+ protocol: TCP
+ targetPort: {{ .targetPort }}
+{{- end }}
+{{- with .extraArgs.clusternativeListenAddr }}
+- name: cluster-tcp
+ protocol: TCP
+ port: {{ include "vm.port.from.flag" (dict "flag" .) }}
+ targetPort: cluster-tcp
+{{- end }}
+{{- with .extraArgs.graphiteListenAddr }}
+- name: graphite-tcp
+ protocol: TCP
+ port: {{ include "vm.port.from.flag" (dict "flag" .) }}
+ targetPort: graphite-tcp
+- name: graphite-udp
+ protocol: UDP
+ port: {{ include "vm.port.from.flag" (dict "flag" .) }}
+ targetPort: graphite-udp
+{{- end }}
+{{- with .extraArgs.influxListenAddr }}
+- name: influx-tcp
+ protocol: TCP
+ port: {{ include "vm.port.from.flag" (dict "flag" .) }}
+ targetPort: influx-tcp
+- name: influx-udp
+ protocol: UDP
+ port: {{ include "vm.port.from.flag" (dict "flag" .) }}
+ targetPort: influx-udp
+{{- end }}
+{{- with .extraArgs.opentsdbHTTPListenAddr }}
+- name: opentsdbhttp
+ port: {{ include "vm.port.from.flag" (dict "flag" .) }}
+ targetPort: opentsdbhttp
+{{- end }}
+{{- with .extraArgs.opentsdbListenAddr }}
+{{- if or .service.udp (ne .service.type "LoadBalancer") }}
+- name: opentsdb-udp
+ protocol: UDP
+ port: {{ include "vm.port.from.flag" (dict "flag" .) }}
+ targetPort: opentsdb-udp
+{{- end }}
+- name: opentsdb-tcp
+ protocol: TCP
+ port: {{ include "vm.port.from.flag" (dict "flag" .) }}
+ targetPort: opentsdb-tcp
+{{- end }}
+{{- end -}}
+
+{{- define "vmstorage.ports" -}}
+- port: {{ .service.servicePort }}
+ targetPort: http
+ protocol: TCP
+ name: http
+- port: {{ .service.vmselectPort }}
+ targetPort: vmselect
+ protocol: TCP
+ name: vmselect
+- port: {{ .service.vminsertPort }}
+ targetPort: vminsert
+ protocol: TCP
+ name: vminsert
+{{- range .service.extraPorts }}
+- name: {{ .name }}
+ port: {{ .port }}
+ protocol: TCP
+ targetPort: {{ .targetPort }}
+{{- end }}
+{{- end -}}
+
+{{- define "vmauth.ports" -}}
+- port: {{ .service.servicePort }}
+ targetPort: http
+ protocol: TCP
+ name: http
+{{- range .service.extraPorts }}
+- name: {{ .name }}
+ port: {{ .port }}
+ protocol: TCP
+ targetPort: {{ .targetPort }}
+{{- end }}
+{{- end -}}
diff --git a/charts/victoria-metrics-cluster/templates/hpa.yaml b/charts/victoria-metrics-cluster/templates/hpa.yaml
new file mode 100644
index 000000000..284b729d9
--- /dev/null
+++ b/charts/victoria-metrics-cluster/templates/hpa.yaml
@@ -0,0 +1,28 @@
+{{- $ctx := dict "helm" . }}
+{{- range $name, $app := .Values }}
+{{- if and (kindIs "map" $app) $app.enabled ($app.horizontalPodAutoscaler).enabled }}
+{{- $hpa := $app.horizontalPodAutoscaler }}
+{{- $_ := set $ctx "extraLabels" $app.extraLabels }}
+---
+apiVersion: autoscaling/v2
+kind: HorizontalPodAutoscaler
+metadata:
+ {{- $labelsTpl := printf "victoria-metrics.%s.labels" $name }}
+ labels: {{ include $labelsTpl $ctx | nindent 4 }}
+ {{- $nameTpl := printf "victoria-metrics.%s.fullname" $name }}
+ {{- $name := include $nameTpl $ }}
+ name: {{ $name }}
+ namespace: {{ include "vm.namespace" $ }}
+spec:
+ maxReplicas: {{ $hpa.maxReplicas }}
+ minReplicas: {{ $hpa.minReplicas }}
+ scaleTargetRef:
+ apiVersion: apps/v1
+ kind: Deployment
+ name: {{ $name }}
+ metrics: {{ toYaml $hpa.metrics | nindent 4 }}
+ {{- with $hpa.behavior }}
+ behavior: {{ toYaml . | nindent 4 }}
+ {{- end -}}
+{{- end }}
+{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/ingress.yaml b/charts/victoria-metrics-cluster/templates/ingress.yaml
new file mode 100644
index 000000000..d86843389
--- /dev/null
+++ b/charts/victoria-metrics-cluster/templates/ingress.yaml
@@ -0,0 +1,41 @@
+{{- $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 }}
+{{- $serviceName := include "vm.plain.fullname" $ctx }}
+---
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+ {{- with $ingress.annotations }}
+ annotations: {{ toYaml . | nindent 4 }}
+ {{- end }}
+ {{- $labelsTpl := printf "victoria-metrics.%s.labels" $name }}
+ labels: {{ include $labelsTpl $ctx | nindent 4 }}
+ name: {{ $serviceName }}
+ namespace: {{ include "vm.namespace" $ }}
+spec:
+ {{- with $ingress.ingressClassName }}
+ ingressClassName: {{ . }}
+ {{- end }}
+ {{- with $ingress.tls }}
+ tls: {{ toYaml . | nindent 4 }}
+ {{- end }}
+ rules:
+ {{- range $ingress.hosts }}
+ - host: {{ tpl .name $ }}
+ http:
+ paths:
+ - path: {{ .path }}
+ {{- with $ingress.pathType }}
+ pathType: {{ . }}
+ {{- end }}
+ backend:
+ service:
+ name: {{ $serviceName }}
+ port: {{ include "vm.ingress.port" . | nindent 18 }}
+ {{- end }}
+{{- end }}
+{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/pdb.yaml b/charts/victoria-metrics-cluster/templates/pdb.yaml
new file mode 100644
index 000000000..441b24485
--- /dev/null
+++ b/charts/victoria-metrics-cluster/templates/pdb.yaml
@@ -0,0 +1,26 @@
+{{- $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 }}
+---
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+ {{- $_ := set $ctx "appKey" $name }}
+ name: {{ include "vm.plain.fullname" $ctx }}
+ namespace: {{ include "vm.namespace" $ }}
+ {{- $labelsTpl := printf "victoria-metrics.%s.labels" $name }}
+ labels: {{ include $labelsTpl $ctx | nindent 4 }}
+spec:
+ {{- with $pdb.minAvailable }}
+ minAvailable: {{ . }}
+ {{- end }}
+ {{- with $pdb.maxUnavailable }}
+ maxUnavailable: {{ . }}
+ {{- end }}
+ selector:
+ {{- $selectorTpl := printf "victoria-metrics.%s.matchLabels" $name }}
+ matchLabels: {{ include $selectorTpl $ | nindent 6 }}
+{{- end }}
+{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vmstorage-service-monitor.yaml b/charts/victoria-metrics-cluster/templates/service-monitor.yaml
similarity index 61%
rename from charts/victoria-metrics-cluster/templates/vmstorage-service-monitor.yaml
rename to charts/victoria-metrics-cluster/templates/service-monitor.yaml
index c21df7ba4..6c3222a4f 100644
--- a/charts/victoria-metrics-cluster/templates/vmstorage-service-monitor.yaml
+++ b/charts/victoria-metrics-cluster/templates/service-monitor.yaml
@@ -1,23 +1,29 @@
-{{- if and .Values.vmstorage.enabled .Values.vmstorage.serviceMonitor.enabled -}}
-{{- $serviceMonitor := .Values.vmstorage.serviceMonitor -}}
+{{- $ctx := dict "helm" . }}
+{{- range $name, $app := .Values }}
+{{- if and (kindIs "map" $app) $app.enabled ($app.serviceMonitor).enabled }}
+{{- $serviceMonitor := $app.serviceMonitor }}
+{{- $_ := set $ctx "extraLabels" $serviceMonitor.extraLabels }}
+---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- with $serviceMonitor.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
- {{- $ctx := merge (deepCopy .) (dict "extraLabels" $serviceMonitor.extraLabels) }}
- labels: {{ include "victoria-metrics.vmstorage.labels" $ctx | nindent 4 }}
- name: {{ include "victoria-metrics.vmstorage.fullname" . }}
+ {{- $labelsTpl := printf "victoria-metrics.%s.labels" $name }}
+ labels: {{ include $labelsTpl $ctx | nindent 4 }}
+ {{- $_ := set $ctx "appKey" $name }}
+ name: {{ include "vm.plain.fullname" $ctx }}
{{- with $serviceMonitor.namespace }}
namespace: {{ . }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- - {{ include "vm.namespace" . }}
+ - {{ include "vm.namespace" $ }}
selector:
- matchLabels: {{ include "victoria-metrics.vmstorage.matchLabels" . | nindent 6 }}
+ {{- $selectorTpl := printf "victoria-metrics.%s.matchLabels" $name }}
+ matchLabels: {{ include $selectorTpl $ | nindent 6 }}
endpoints:
- port: http
{{- with $serviceMonitor.basicAuth }}
@@ -41,4 +47,5 @@ spec:
{{- with $serviceMonitor.metricRelabelings }}
metricRelabelings: {{ toYaml . | nindent 8 }}
{{- end }}
- {{- end }}
+{{- end }}
+{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/service.yaml b/charts/victoria-metrics-cluster/templates/service.yaml
new file mode 100644
index 000000000..0fbad9f7d
--- /dev/null
+++ b/charts/victoria-metrics-cluster/templates/service.yaml
@@ -0,0 +1,59 @@
+{{- $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 }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ {{- with $service.annotations }}
+ annotations: {{ toYaml . | nindent 4 }}
+ {{- end }}
+ {{- $labelsTpl := printf "victoria-metrics.%s.labels" $name }}
+ labels: {{ include $labelsTpl $ctx | nindent 4 }}
+ {{- $_ := set $ctx "appKey" $name }}
+ name: {{ include "vm.plain.fullname" $ctx }}
+ namespace: {{ include "vm.namespace" $ }}
+spec:
+ {{- $clusterIP := $service.clusterIP }}
+ {{- if and (not $clusterIP) ($app.statefulSet).enabled }}
+ {{- $clusterIP = "None" }}
+ {{- end }}
+ {{- with $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 }}
+ {{- if and (not $type) ($app.statefulSet).enabled }}
+ {{- $type = "ClusterIP" }}
+ {{- end }}
+ type: {{ $type }}
+ {{- 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 }}
+ {{- end }}
+ {{- $selectorTpl := printf "victoria-metrics.%s.matchLabels" $name }}
+ selector: {{ include $selectorTpl $ | nindent 4 }}
+{{- end }}
+{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/serviceaccount.yaml b/charts/victoria-metrics-cluster/templates/serviceaccount.yaml
index 9fb75492a..11c7e49cd 100644
--- a/charts/victoria-metrics-cluster/templates/serviceaccount.yaml
+++ b/charts/victoria-metrics-cluster/templates/serviceaccount.yaml
@@ -1,16 +1,13 @@
-{{- if .Values.serviceAccount.create }}
+{{- $sa := .Values.serviceAccount }}
+{{- $ctx := dict "helm" . "extraLabels" $sa.extraLabels }}
+{{- if $sa.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
- labels:
- {{- include "victoria-metrics.common.metaLabels" . | nindent 4 }}
- {{- if .Values.serviceAccount.extraLabels }}
-{{ toYaml .Values.serviceAccount.extraLabels | indent 4}}
+ labels: {{ include "victoria-metrics.common.metaLabels" $ctx | nindent 4 }}
+ {{- with $sa.annotations }}
+ annotations: {{ toYaml . | indent 4 }}
{{- end }}
-{{- with .Values.serviceAccount.annotations }}
- annotations:
-{{ toYaml . | indent 4 }}
-{{- end }}
- name: {{ include "victoria-metrics.serviceAccountName" . }}
+ name: {{ include "vm.sa.name" . }}
namespace: {{ include "vm.namespace" . }}
{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vmauth-config.yaml b/charts/victoria-metrics-cluster/templates/vmauth-config.yaml
new file mode 100644
index 000000000..ff18a1b28
--- /dev/null
+++ b/charts/victoria-metrics-cluster/templates/vmauth-config.yaml
@@ -0,0 +1,26 @@
+{{- if and (empty .Values.vmauth.configSecretName) .Values.vmauth.enabled }}
+{{- $ctx := dict "helm" . "appKey" "vmauth" }}
+apiVersion: v1
+kind: Secret
+metadata:
+ name: {{ include "vm.plain.fullname" $ctx }}
+ namespace: {{ include "vm.namespace" $ctx }}
+ labels: {{ include "victoria-metrics.vmauth.labels" . | nindent 4 }}
+type: Opaque
+data:
+ {{- $config := .Values.vmauth.config }}
+ {{- $ctx := dict "helm" . "style" "plain" }}
+ {{- $urlMap := ($config.unauthorized_user).url_map | default list }}
+ {{- range $appKey := list "vmselect" "vminsert" }}
+ {{- $app := index $.Values $appKey }}
+ {{- $service := $app.service }}
+ {{- if and $app.enabled $service.enabled }}
+ {{- $_ := set $ctx "appKey" $appKey }}
+ {{- $url := include "vm.url" $ctx }}
+ {{- $path := printf "/%s/.*" (trimPrefix "vm" $appKey) }}
+ {{- $urlMap = append $urlMap (dict "src_paths" (list $path) "url_prefix" $url "discover_backend_ips" true) }}
+ {{- end }}
+ {{- end }}
+ {{- $_ := set $config.unauthorized_user "url_map" $urlMap }}
+ auth.yml: | {{ toYaml $config | b64enc | nindent 4 }}
+{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vmauth-deployment.yaml b/charts/victoria-metrics-cluster/templates/vmauth-deployment.yaml
new file mode 100644
index 000000000..f518df053
--- /dev/null
+++ b/charts/victoria-metrics-cluster/templates/vmauth-deployment.yaml
@@ -0,0 +1,106 @@
+{{- $app := .Values.vmauth -}}
+{{- $ctx := dict "helm" . "extraLabels" $app.extraLabels "appKey" "vmauth" }}
+{{- if $app.enabled -}}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ {{- with $app.annotations }}
+ annotations: {{ toYaml . | nindent 4 }}
+ {{- end }}
+ labels: {{ include "victoria-metrics.vmauth.labels" $ctx | nindent 4 }}
+ name: {{ include "vm.plain.fullname" $ctx }}
+ namespace: {{ include "vm.namespace" . }}
+spec:
+ selector:
+ matchLabels: {{ include "victoria-metrics.vmauth.matchLabels" . | 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 "victoria-metrics.vmauth.podLabels" $ctx | nindent 8 }}
+ spec:
+ {{- with $app.priorityClassName }}
+ priorityClassName: {{ . }}
+ {{- end }}
+ automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
+ {{- 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" (dict "helm" . "app" $app) }}
+ imagePullPolicy: {{ $app.image.pullPolicy }}
+ {{- with $app.containerWorkingDir }}
+ workingDir: {{ . }}
+ {{- end }}
+ {{- if $app.securityContext.enabled }}
+ securityContext: {{ include "vm.compatibility.renderSecurityContext" (dict "secContext" $app.securityContext "context" .) | nindent 12 }}
+ {{- end }}
+ args: {{ include "vmauth.args" . | nindent 12 }}
+ {{- with $app.envFrom }}
+ envFrom: {{ toYaml . | nindent 12 }}
+ {{- end }}
+ {{- with $app.env }}
+ env: {{ toYaml . | 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.compatibility.renderSecurityContext" (dict "secContext" $app.podSecurityContext "context" .) | nindent 8 }}
+ {{- end }}
+ serviceAccountName: {{ include "vm.sa.name" . }}
+ {{- with $app.tolerations }}
+ tolerations: {{ toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with $app.affinity }}
+ affinity: {{ toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with $app.topologySpreadConstraints }}
+ topologySpreadConstraints: {{ toYaml . | nindent 8 }}
+ {{- end }}
+ volumes:
+ - name: config
+ secret:
+ secretName: {{ ternary (include "vm.plain.fullname" $ctx) .Values.configSecretName (empty .Values.configSecretName) }}
+ {{- with $app.extraVolumes }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- include "vm.license.volume" . | nindent 8 }}
+{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vminsert-deployment.yaml b/charts/victoria-metrics-cluster/templates/vminsert-deployment.yaml
index a205135f8..5db64174b 100644
--- a/charts/victoria-metrics-cluster/templates/vminsert-deployment.yaml
+++ b/charts/victoria-metrics-cluster/templates/vminsert-deployment.yaml
@@ -1,5 +1,5 @@
-{{- $global := (dict "Values" (deepCopy .Values) "Release" (deepCopy .Release) "Chart" (deepCopy .Chart) "Template" (deepCopy .Template)) -}}
{{- $app := .Values.vminsert -}}
+{{- $ctx := dict "helm" . "appKey" "vminsert" "extraLabels" $app.extraLabels }}
{{- if $app.enabled -}}
apiVersion: apps/v1
kind: Deployment
@@ -7,9 +7,8 @@ metadata:
{{- with $app.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
- {{- $ctx := mergeOverwrite (deepCopy $global) (dict "extraLabels" $app.extraLabels) }}
labels: {{ include "victoria-metrics.vminsert.labels" $ctx | nindent 4 }}
- name: {{ include "victoria-metrics.vminsert.fullname" . }}
+ name: {{ include "vm.plain.fullname" $ctx }}
namespace: {{ include "vm.namespace" . }}
spec:
selector:
@@ -40,7 +39,7 @@ spec:
{{- end }}
containers:
- name: vminsert
- image: {{ include "vm.image" (merge (deepCopy $global) (dict "app" $app)) }}
+ image: {{ include "vm.image" (dict "helm" . "app" $app) }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- with $app.containerWorkingDir }}
workingDir: {{ . }}
@@ -120,7 +119,7 @@ spec:
{{- if $app.podSecurityContext.enabled }}
securityContext: {{ include "vm.compatibility.renderSecurityContext" (dict "secContext" $app.podSecurityContext "context" .) | nindent 8 }}
{{- end }}
- serviceAccountName: {{ include "victoria-metrics.serviceAccountName" . }}
+ serviceAccountName: {{ include "vm.sa.name" . }}
{{- with $app.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vminsert-hpa.yaml b/charts/victoria-metrics-cluster/templates/vminsert-hpa.yaml
deleted file mode 100644
index 0f48db061..000000000
--- a/charts/victoria-metrics-cluster/templates/vminsert-hpa.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-{{- if .Values.vminsert.horizontalPodAutoscaler.enabled }}
-apiVersion: autoscaling/v2
-kind: HorizontalPodAutoscaler
-metadata:
- labels:
- {{- include "victoria-metrics.vminsert.labels" . | nindent 4 }}
-{{- with .Values.vminsert.extraLabels }}
-{{ toYaml . | indent 4 }}
-{{- end }}
- name: {{ include "victoria-metrics.vminsert.fullname" . }}
- namespace: {{ include "vm.namespace" . }}
-spec:
- maxReplicas: {{ .Values.vminsert.horizontalPodAutoscaler.maxReplicas }}
- minReplicas: {{ .Values.vminsert.horizontalPodAutoscaler.minReplicas }}
- scaleTargetRef:
- apiVersion: apps/v1
- kind: Deployment
- name: {{ include "victoria-metrics.vminsert.fullname" . }}
- metrics:
-{{ toYaml .Values.vminsert.horizontalPodAutoscaler.metrics | indent 4 }}
-{{- if .Values.vminsert.horizontalPodAutoscaler.behavior }}
- behavior:
-{{ toYaml .Values.vminsert.horizontalPodAutoscaler.behavior | indent 4 }}
-{{- end -}}
-{{- end -}}
diff --git a/charts/victoria-metrics-cluster/templates/vminsert-ingress.yaml b/charts/victoria-metrics-cluster/templates/vminsert-ingress.yaml
deleted file mode 100644
index 74fbf246b..000000000
--- a/charts/victoria-metrics-cluster/templates/vminsert-ingress.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-{{- $app := .Values.vminsert }}
-{{- if and $app.enabled $app.ingress.enabled }}
-{{- $serviceName := include "victoria-metrics.vminsert.fullname" . }}
-apiVersion: networking.k8s.io/v1
-kind: Ingress
-metadata:
- {{- with $app.ingress.annotations }}
- annotations: {{ toYaml . | nindent 4 }}
- {{- end }}
- {{- $ctx := merge (deepCopy .) (dict "extraLabels" $app.ingress.extraLabels) }}
- labels: {{ include "victoria-metrics.vminsert.labels" $ctx | nindent 4 }}
- name: {{ $serviceName }}
- namespace: {{ include "vm.namespace" . }}
-spec:
- {{- with $app.ingress.ingressClassName }}
- ingressClassName: {{ . }}
- {{- end }}
- {{- with $app.ingress.tls }}
- tls: {{ toYaml . | nindent 4 }}
- {{- end }}
- rules:
- {{- range $app.ingress.hosts }}
- - host: {{ tpl .name $ }}
- http:
- paths:
- - path: {{ .path }}
- {{- with $app.ingress.pathType }}
- pathType: {{ . }}
- {{- end }}
- backend:
- service:
- name: {{ $serviceName }}
- port: {{ include "vm.ingress.port" . | nindent 18 }}
- {{- end }}
-{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vminsert-pdb.yaml b/charts/victoria-metrics-cluster/templates/vminsert-pdb.yaml
deleted file mode 100644
index a61f8ae51..000000000
--- a/charts/victoria-metrics-cluster/templates/vminsert-pdb.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-{{- if .Values.vminsert.podDisruptionBudget.enabled }}
-apiVersion: policy/v1
-kind: PodDisruptionBudget
-metadata:
- name: {{ include "victoria-metrics.vminsert.fullname" . }}
- namespace: {{ include "vm.namespace" . }}
- {{- $ctx := merge (deepCopy .) (dict "extraLabels" .Values.vminsert.podDisruptionBudget.labels) }}
- labels: {{ include "victoria-metrics.vminsert.labels" $ctx | nindent 4 }}
-spec:
- {{- with .Values.vminsert.podDisruptionBudget.minAvailable }}
- minAvailable: {{ . }}
- {{- end }}
- {{- with .Values.vminsert.podDisruptionBudget.maxUnavailable }}
- maxUnavailable: {{ . }}
- {{- end }}
- selector:
- matchLabels: {{ include "victoria-metrics.vminsert.matchLabels" . | nindent 6 }}
-{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vminsert-service-monitor.yaml b/charts/victoria-metrics-cluster/templates/vminsert-service-monitor.yaml
deleted file mode 100644
index 446930112..000000000
--- a/charts/victoria-metrics-cluster/templates/vminsert-service-monitor.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-{{- if and .Values.vminsert.enabled .Values.vminsert.serviceMonitor.enabled -}}
-{{- $serviceMonitor := .Values.vminsert.serviceMonitor -}}
-apiVersion: monitoring.coreos.com/v1
-kind: ServiceMonitor
-metadata:
- {{- with $serviceMonitor.annotations }}
- annotations: {{ toYaml . | nindent 4 }}
- {{- end }}
- {{- $ctx := merge (deepCopy .) (dict "extraLabels" $serviceMonitor.extraLabels) }}
- labels: {{ include "victoria-metrics.vminsert.labels" $ctx | nindent 4 }}
- name: {{ include "victoria-metrics.vminsert.fullname" . }}
- {{- with $serviceMonitor.namespace }}
- namespace: {{ . }}
- {{- end }}
-spec:
- namespaceSelector:
- matchNames:
- - {{ include "vm.namespace" . }}
- selector:
- matchLabels: {{ include "victoria-metrics.vminsert.matchLabels" . | 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 }}
diff --git a/charts/victoria-metrics-cluster/templates/vminsert-service.yaml b/charts/victoria-metrics-cluster/templates/vminsert-service.yaml
deleted file mode 100644
index 995b2b8a4..000000000
--- a/charts/victoria-metrics-cluster/templates/vminsert-service.yaml
+++ /dev/null
@@ -1,94 +0,0 @@
-{{- $app := .Values.vminsert }}
-{{- if $app.enabled -}}
-apiVersion: v1
-kind: Service
-metadata:
- {{- with $app.service.annotations }}
- annotations: {{ toYaml . | nindent 4 }}
- {{- end }}
- {{- $ctx := merge (deepCopy .) (dict "extraLabels" $app.service.labels) }}
- labels: {{ include "victoria-metrics.vminsert.labels" $ctx | nindent 4 }}
- name: {{ include "victoria-metrics.vminsert.fullname" . }}
- namespace: {{ include "vm.namespace" . }}
-spec:
- {{- with $app.service.clusterIP }}
- clusterIP: {{ . }}
- {{- end }}
- {{- with $app.service.externalIPs }}
- externalIPs: {{ toYaml . | nindent 4 }}
- {{- end }}
- {{- with $app.service.loadBalancerIP }}
- loadBalancerIP: {{ . }}
- {{- end }}
- {{- with $app.service.loadBalancerSourceRanges }}
- loadBalancerSourceRanges: {{ toYaml . | nindent 4 }}
- {{- end }}
- type: {{ $app.service.type }}
- {{- with $app.service.healthCheckNodePort }}
- healthCheckNodePort: {{ . }}
- {{- end }}
- {{- with $app.service.externalTrafficPolicy }}
- externalTrafficPolicy: {{ . }}
- {{- end }}
- {{- with $app.service.ipFamilyPolicy }}
- ipFamilyPolicy: {{ . }}
- {{- end }}
- {{- with $app.service.ipFamilies }}
- ipFamilies: {{ toYaml . | nindent 4 }}
- {{- end }}
- ports:
- - name: http
- port: {{ $app.service.servicePort }}
- protocol: TCP
- targetPort: {{ $app.service.targetPort }}
- {{- range $app.service.extraPorts }}
- - name: {{ .name }}
- port: {{ .port }}
- protocol: TCP
- targetPort: {{ .targetPort }}
- {{- end }}
- {{- with $app.extraArgs.clusternativeListenAddr }}
- - name: cluster-tcp
- protocol: TCP
- port: {{ include "vm.port.from.flag" (dict "flag" .) }}
- targetPort: cluster-tcp
- {{- end }}
- {{- with $app.extraArgs.graphiteListenAddr }}
- - name: graphite-tcp
- protocol: TCP
- port: {{ include "vm.port.from.flag" (dict "flag" .) }}
- targetPort: graphite-tcp
- - name: graphite-udp
- protocol: UDP
- port: {{ include "vm.port.from.flag" (dict "flag" .) }}
- targetPort: graphite-udp
- {{- end }}
- {{- with $app.extraArgs.influxListenAddr }}
- - name: influx-tcp
- protocol: TCP
- port: {{ include "vm.port.from.flag" (dict "flag" .) }}
- targetPort: influx-tcp
- - name: influx-udp
- protocol: UDP
- port: {{ include "vm.port.from.flag" (dict "flag" .) }}
- targetPort: influx-udp
- {{- end }}
- {{- with $app.extraArgs.opentsdbHTTPListenAddr }}
- - name: opentsdbhttp
- port: {{ include "vm.port.from.flag" (dict "flag" .) }}
- targetPort: opentsdbhttp
- {{- end }}
- {{- with $app.extraArgs.opentsdbListenAddr }}
- {{- if or $app.service.udp (ne $app.service.type "LoadBalancer") }}
- - name: opentsdb-udp
- protocol: UDP
- port: {{ include "vm.port.from.flag" (dict "flag" .) }}
- targetPort: opentsdb-udp
- {{- end }}
- - name: opentsdb-tcp
- protocol: TCP
- port: {{ include "vm.port.from.flag" (dict "flag" .) }}
- targetPort: opentsdb-tcp
- {{- end }}
- selector: {{ include "victoria-metrics.vminsert.matchLabels" . | nindent 4 }}
-{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vmselect-deployment.yaml b/charts/victoria-metrics-cluster/templates/vmselect-deployment.yaml
index afb1fb65a..f257ae016 100644
--- a/charts/victoria-metrics-cluster/templates/vmselect-deployment.yaml
+++ b/charts/victoria-metrics-cluster/templates/vmselect-deployment.yaml
@@ -1,6 +1,6 @@
-{{- $global := (dict "Values" (deepCopy .Values) "Release" (deepCopy .Release) "Chart" (deepCopy .Chart) "Template" (deepCopy .Template)) -}}
{{- $app := .Values.vmselect -}}
-{{- $fullname := (include "victoria-metrics.vmselect.fullname" .) }}
+{{- $ctx := dict "helm" . "extraLabels" $app.extraLabels "appKey" "vmselect" }}
+{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- if and $app.enabled (not $app.statefulSet.enabled) -}}
apiVersion: apps/v1
kind: Deployment
@@ -8,7 +8,6 @@ metadata:
{{- with $app.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
- {{- $ctx := mergeOverwrite (deepCopy $global) (dict "extraLabels" $app.extraLabels) }}
labels: {{ include "victoria-metrics.vmselect.labels" $ctx | nindent 4 }}
name: {{ $fullname }}
namespace: {{ include "vm.namespace" . }}
@@ -41,7 +40,7 @@ spec:
{{- end }}
containers:
- name: vmselect
- image: {{ include "vm.image" (merge (deepCopy $global) (dict "app" $app)) }}
+ image: {{ include "vm.image" (dict "helm" . "app" $app) }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- with $app.containerWorkingDir }}
workingDir: {{ . }}
@@ -102,7 +101,7 @@ spec:
{{- if $app.podSecurityContext.enabled }}
securityContext: {{ include "vm.compatibility.renderSecurityContext" (dict "secContext" $app.podSecurityContext "context" .) | nindent 8 }}
{{- end }}
- serviceAccountName: {{ include "victoria-metrics.serviceAccountName" . }}
+ serviceAccountName: {{ include "vm.sa.name" . }}
{{- with $app.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vmselect-hpa.yaml b/charts/victoria-metrics-cluster/templates/vmselect-hpa.yaml
deleted file mode 100644
index 5c5962c02..000000000
--- a/charts/victoria-metrics-cluster/templates/vmselect-hpa.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-{{- if .Values.vmselect.horizontalPodAutoscaler.enabled }}
-apiVersion: autoscaling/v2
-kind: HorizontalPodAutoscaler
-metadata:
- labels:
- {{- include "victoria-metrics.vmselect.labels" . | nindent 4 }}
-{{- with .Values.vmselect.extraLabels }}
-{{ toYaml . | indent 4 }}
-{{- end }}
- name: {{ include "victoria-metrics.vmselect.fullname" . }}
- namespace: {{ include "vm.namespace" . }}
-spec:
- maxReplicas: {{ .Values.vmselect.horizontalPodAutoscaler.maxReplicas }}
- minReplicas: {{ .Values.vmselect.horizontalPodAutoscaler.minReplicas }}
- scaleTargetRef:
- apiVersion: apps/v1
- kind: Deployment
- name: {{ include "victoria-metrics.vmselect.fullname" . }}
- metrics:
-{{ toYaml .Values.vmselect.horizontalPodAutoscaler.metrics | indent 4 }}
-{{- if .Values.vmselect.horizontalPodAutoscaler.behavior }}
- behavior:
-{{ toYaml .Values.vmselect.horizontalPodAutoscaler.behavior | indent 4 }}
-{{- end -}}
-{{- end -}}
diff --git a/charts/victoria-metrics-cluster/templates/vmselect-ingress.yaml b/charts/victoria-metrics-cluster/templates/vmselect-ingress.yaml
deleted file mode 100644
index ab1a19082..000000000
--- a/charts/victoria-metrics-cluster/templates/vmselect-ingress.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-{{- $app := .Values.vmselect }}
-{{- if and $app.enabled $app.ingress.enabled }}
-{{- $serviceName := include "victoria-metrics.vmselect.fullname" . }}
-apiVersion: networking.k8s.io/v1
-kind: Ingress
-metadata:
- {{- with $app.ingress.annotations }}
- annotations: {{ toYaml . | nindent 4 }}
- {{- end }}
- {{- $ctx := merge (deepCopy .) (dict "extraLabels" $app.ingress.extraLabels) }}
- labels: {{ include "victoria-metrics.vmselect.labels" $ctx | nindent 4 }}
- name: {{ $serviceName }}
- namespace: {{ include "vm.namespace" . }}
-spec:
- {{- with $app.ingress.ingressClassName }}
- ingressClassName: {{ . }}
- {{- end }}
- {{- with $app.ingress.tls }}
- tls: {{ toYaml . | nindent 4 }}
- {{- end }}
- rules:
- {{- range $app.ingress.hosts }}
- - host: {{ tpl .name $ }}
- http:
- paths:
- - path: {{ .path }}
- {{- with $app.ingress.pathType }}
- pathType: {{ . }}
- {{- end }}
- backend:
- service:
- name: {{ $serviceName }}
- port: {{ include "vm.ingress.port" . | nindent 18 }}
- {{- end }}
-{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vmselect-pdb.yaml b/charts/victoria-metrics-cluster/templates/vmselect-pdb.yaml
deleted file mode 100644
index 527dea890..000000000
--- a/charts/victoria-metrics-cluster/templates/vmselect-pdb.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-{{- if .Values.vmselect.podDisruptionBudget.enabled }}
-apiVersion: policy/v1
-kind: PodDisruptionBudget
-metadata:
- name: {{ include "victoria-metrics.vmselect.fullname" . }}
- namespace: {{ include "vm.namespace" . }}
- {{- $ctx := merge (deepCopy .) (dict "extraLabels" .Values.vmselect.podDisruptionBudget.labels) }}
- labels: {{ include "victoria-metrics.vmselect.labels" $ctx | nindent 4 }}
-spec:
- {{- with .Values.vmselect.podDisruptionBudget.minAvailable }}
- minAvailable: {{ . }}
- {{- end }}
- {{- with .Values.vmselect.podDisruptionBudget.maxUnavailable }}
- maxUnavailable: {{ . }}
- {{- end }}
- selector:
- matchLabels: {{ include "victoria-metrics.vmselect.matchLabels" . | nindent 6 }}
-{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vmselect-service-monitor.yaml b/charts/victoria-metrics-cluster/templates/vmselect-service-monitor.yaml
deleted file mode 100644
index c437a7ac4..000000000
--- a/charts/victoria-metrics-cluster/templates/vmselect-service-monitor.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-{{- if and .Values.vmselect.enabled .Values.vmselect.serviceMonitor.enabled -}}
-{{- $serviceMonitor := .Values.vmselect.serviceMonitor -}}
-apiVersion: monitoring.coreos.com/v1
-kind: ServiceMonitor
-metadata:
- {{- with $serviceMonitor.annotations }}
- annotations: {{ toYaml . | nindent 4 }}
- {{- end }}
- {{- $ctx := merge (deepCopy .) (dict "extraLabels" $serviceMonitor.extraLabels) }}
- labels: {{ include "victoria-metrics.vmselect.labels" $ctx | nindent 4 }}
- name: {{ include "victoria-metrics.vmselect.fullname" . }}
- {{- with $serviceMonitor.namespace }}
- namespace: {{ . }}
- {{- end }}
-spec:
- namespaceSelector:
- matchNames:
- - {{ include "vm.namespace" . }}
- selector:
- matchLabels: {{ include "victoria-metrics.vmselect.matchLabels" . | 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 }}
diff --git a/charts/victoria-metrics-cluster/templates/vmselect-service.yaml b/charts/victoria-metrics-cluster/templates/vmselect-service.yaml
deleted file mode 100644
index 263a83da1..000000000
--- a/charts/victoria-metrics-cluster/templates/vmselect-service.yaml
+++ /dev/null
@@ -1,61 +0,0 @@
-{{- $app := .Values.vmselect }}
-{{- if $app.enabled -}}
-apiVersion: v1
-kind: Service
-metadata:
- {{- with $app.service.annotations }}
- annotations: {{ toYaml . | nindent 4 }}
- {{- end }}
- {{- $ctx := merge (deepCopy .) (dict "extraLabels" $app.service.labels) }}
- labels: {{ include "victoria-metrics.vmselect.labels" $ctx | nindent 4 }}
- name: {{ include "victoria-metrics.vmselect.fullname" . }}
- namespace: {{ include "vm.namespace" . }}
-spec:
- {{- $clusterIP := ternary "None" $app.service.clusterIP $app.statefulSet.enabled }}
- {{- with $clusterIP }}
- clusterIP: {{ . }}
- {{- end }}
- {{- $externalIPs := ternary (default list) $app.service.externalIPs $app.statefulSet.enabled }}
- {{- with $externalIPs }}
- externalIPs: {{ toYaml . | nindent 4 }}
- {{- end }}
- {{- $loadBalancerIP := ternary "" $app.service.loadBalancerIP $app.statefulSet.enabled }}
- {{- with $loadBalancerIP }}
- loadBalancerIP: {{ . }}
- {{- end }}
- {{- $loadBalancerSourceRanges := ternary (default list) $app.service.loadBalancerSourceRanges $app.statefulSet.enabled }}
- {{- with $loadBalancerSourceRanges }}
- loadBalancerSourceRanges: {{ toYaml . | nindent 4 }}
- {{- end }}
- type: {{ ternary "ClusterIP" $app.service.type $app.statefulSet.enabled }}
- {{- with $app.service.healthCheckNodePort }}
- healthCheckNodePort: {{ . }}
- {{- end }}
- {{- with $app.service.externalTrafficPolicy }}
- externalTrafficPolicy: {{ . }}
- {{- end }}
- {{- with $app.service.ipFamilyPolicy }}
- ipFamilyPolicy: {{ . }}
- {{- end }}
- {{- with $app.service.ipFamilies }}
- ipFamilies: {{ toYaml . | nindent 4 }}
- {{- end }}
- ports:
- - name: http
- port: {{ $app.service.servicePort }}
- protocol: TCP
- targetPort: {{ $app.service.targetPort }}
- {{- range $app.service.extraPorts }}
- - name: {{ .name }}
- port: {{ .port }}
- protocol: TCP
- targetPort: {{ .targetPort }}
- {{- end }}
- {{- with $app.extraArgs.clusternativeListenAddr }}
- - name: cluster-tcp
- protocol: TCP
- port: {{ include "vm.port.from.flag" (dict "flag" .) }}
- targetPort: cluster-tcp
- {{- end }}
- selector: {{ include "victoria-metrics.vmselect.matchLabels" . | nindent 4 }}
-{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vmselect-statefulset.yaml b/charts/victoria-metrics-cluster/templates/vmselect-statefulset.yaml
index b0f972792..565a49f4f 100644
--- a/charts/victoria-metrics-cluster/templates/vmselect-statefulset.yaml
+++ b/charts/victoria-metrics-cluster/templates/vmselect-statefulset.yaml
@@ -1,5 +1,5 @@
-{{- $global := (dict "Values" (deepCopy .Values) "Release" (deepCopy .Release) "Chart" (deepCopy .Chart) "Template" (deepCopy .Template)) -}}
{{- $app := .Values.vmselect }}
+{{- $ctx := dict "helm" . "appKey" "vmselect" }}
{{- if and $app.enabled $app.statefulSet.enabled -}}
apiVersion: apps/v1
kind: StatefulSet
@@ -7,12 +7,11 @@ metadata:
{{- with $app.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
- {{- $ctx := merge (deepCopy $global) (dict "extraLabels" $app.extraLabels) }}
labels: {{ include "victoria-metrics.vmselect.labels" $ctx | nindent 4 }}
- name: {{ include "victoria-metrics.vmselect.fullname" . }}
- namespace: {{ include "vm.namespace" . }}
+ name: {{ include "vm.plain.fullname" $ctx }}
+ namespace: {{ include "vm.namespace" $ctx }}
spec:
- serviceName: {{ include "victoria-metrics.vmselect.fullname" . }}
+ serviceName: {{ include "vm.plain.fullname" $ctx }}
selector:
matchLabels: {{ include "victoria-metrics.vmselect.matchLabels" . | nindent 6 }}
replicas: {{ $app.replicaCount }}
@@ -37,7 +36,7 @@ spec:
{{- end }}
containers:
- name: vmselect
- image: {{ include "vm.image" (merge (deepCopy $global) (dict "app" $app)) }}
+ image: {{ include "vm.image" (dict "helm" . "app" $app) }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- with $app.containerWorkingDir }}
workingDir: {{ . }}
@@ -98,7 +97,7 @@ spec:
{{- if $app.podSecurityContext.enabled }}
securityContext: {{ include "vm.compatibility.renderSecurityContext" (dict "secContext" $app.podSecurityContext "context" .) | nindent 8 }}
{{- end }}
- serviceAccountName: {{ include "victoria-metrics.serviceAccountName" . }}
+ serviceAccountName: {{ include "vm.sa.name" . }}
{{- with $app.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vmstorage-pdb.yaml b/charts/victoria-metrics-cluster/templates/vmstorage-pdb.yaml
deleted file mode 100644
index d995adc57..000000000
--- a/charts/victoria-metrics-cluster/templates/vmstorage-pdb.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-{{- if and .Values.vmstorage.enabled .Values.vmstorage.podDisruptionBudget.enabled }}
-apiVersion: policy/v1
-kind: PodDisruptionBudget
-metadata:
- name: {{ include "victoria-metrics.vmstorage.fullname" . }}
- namespace: {{ include "vm.namespace" . }}
- {{- $ctx := merge (deepCopy .) (dict "extraLabels" .Values.vmstorage.podDisruptionBudget.labels) }}
- labels: {{ include "victoria-metrics.vmstorage.labels" $ctx | nindent 4 }}
-spec:
- {{- with .Values.vmstorage.podDisruptionBudget.minAvailable }}
- minAvailable: {{ . }}
- {{- end }}
- {{- with .Values.vmstorage.podDisruptionBudget.maxUnavailable }}
- maxUnavailable: {{ . }}
- {{- end }}
- selector:
- matchLabels: {{ include "victoria-metrics.vmstorage.matchLabels" . | nindent 6 }}
-{{- end }}
diff --git a/charts/victoria-metrics-cluster/templates/vmstorage-service.yaml b/charts/victoria-metrics-cluster/templates/vmstorage-service.yaml
deleted file mode 100644
index 9f0ffef25..000000000
--- a/charts/victoria-metrics-cluster/templates/vmstorage-service.yaml
+++ /dev/null
@@ -1,48 +0,0 @@
-{{- $app := .Values.vmstorage }}
-{{- if $app.enabled -}}
-apiVersion: v1
-kind: Service
-metadata:
- {{- with $app.service.annotations }}
- annotations: {{ toYaml . | nindent 4 }}
- {{- end }}
- {{- $ctx := merge (deepCopy .) (dict "extraLabels" $app.service.labels) }}
- labels: {{ include "victoria-metrics.vmstorage.labels" $ctx | nindent 4 }}
- name: {{ include "victoria-metrics.vmstorage.fullname" . }}
- namespace: {{ include "vm.namespace" . }}
-spec:
- clusterIP: None
- type: ClusterIP
- {{- with $app.service.healthCheckNodePort }}
- healthCheckNodePort: {{ . }}
- {{- end }}
- {{- with $app.service.externalTrafficPolicy }}
- externalTrafficPolicy: {{ . }}
- {{- end }}
- {{- with $app.service.ipFamilyPolicy }}
- ipFamilyPolicy: {{ . }}
- {{- end }}
- {{- with $app.service.ipFamilies }}
- ipFamilies: {{ toYaml . | nindent 4 }}
- {{- end }}
- ports:
- - port: {{ $app.service.servicePort }}
- targetPort: http
- protocol: TCP
- name: http
- - port: {{ $app.service.vmselectPort }}
- targetPort: vmselect
- protocol: TCP
- name: vmselect
- - port: {{ $app.service.vminsertPort }}
- targetPort: vminsert
- protocol: TCP
- name: vminsert
- {{- range $app.service.extraPorts }}
- - name: {{ .name }}
- port: {{ .port }}
- protocol: TCP
- targetPort: {{ .targetPort }}
- {{- end }}
- selector: {{ include "victoria-metrics.vmstorage.matchLabels" . | nindent 4 }}
-{{- end -}}
diff --git a/charts/victoria-metrics-cluster/templates/vmstorage-statefulset.yaml b/charts/victoria-metrics-cluster/templates/vmstorage-statefulset.yaml
index 6d0e2933a..ea1078769 100644
--- a/charts/victoria-metrics-cluster/templates/vmstorage-statefulset.yaml
+++ b/charts/victoria-metrics-cluster/templates/vmstorage-statefulset.yaml
@@ -1,5 +1,5 @@
-{{- $global := (dict "Values" (deepCopy .Values) "Release" (deepCopy .Release) "Chart" (deepCopy .Chart) "Template" (deepCopy .Template)) -}}
{{- $app := .Values.vmstorage }}
+{{- $ctx := dict "helm" . "extraLabels" $app.extraLabels "appKey" "vmstorage" }}
{{- if $app.enabled -}}
apiVersion: apps/v1
kind: StatefulSet
@@ -7,12 +7,11 @@ metadata:
{{- with $app.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
- {{- $ctx := mergeOverwrite (deepCopy $global) (dict "extraLabels" $app.extraLabels) }}
labels: {{ include "victoria-metrics.vmstorage.labels" $ctx | nindent 4 }}
- name: {{ include "victoria-metrics.vmstorage.fullname" . }}
+ name: {{ include "vm.plain.fullname" $ctx }}
namespace: {{ include "vm.namespace" . }}
spec:
- serviceName: {{ include "victoria-metrics.vmstorage.fullname" . }}
+ serviceName: {{ include "vm.plain.fullname" $ctx }}
selector:
matchLabels: {{ include "victoria-metrics.vmstorage.matchLabels" . | nindent 6 }}
replicas: {{ $app.replicaCount }}
@@ -77,7 +76,7 @@ spec:
{{- end }}
containers:
- name: vmstorage
- image: {{ include "vm.image" (merge (deepCopy $global) (dict "app" $app)) }}
+ image: {{ include "vm.image" (dict "helm" . "app" $app) }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- with $app.containerWorkingDir }}
workingDir: {{ . }}
@@ -159,7 +158,7 @@ spec:
{{- if $manager.enabled }}
{{- include "vm.enterprise.only" . }}
- name: vmbackupmanager
- image: {{ include "vm.image" (merge (deepCopy $global) (dict "app" $manager)) }}
+ image: {{ include "vm.image" (dict "helm" . "app" $manager) }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- if $app.securityContext.enabled }}
securityContext: {{ include "vm.compatibility.renderSecurityContext" (dict "secContext" $app.securityContext "context" .) | nindent 12 }}
@@ -217,7 +216,7 @@ spec:
{{- if $app.podSecurityContext.enabled }}
securityContext: {{ include "vm.compatibility.renderSecurityContext" (dict "secContext" $app.podSecurityContext "context" .) | nindent 8 }}
{{- end }}
- serviceAccountName: {{ include "victoria-metrics.serviceAccountName" . }}
+ serviceAccountName: {{ include "vm.sa.name" . }}
{{- with $app.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
diff --git a/charts/victoria-metrics-cluster/values.yaml b/charts/victoria-metrics-cluster/values.yaml
index bd7bf126d..8f37346e0 100644
--- a/charts/victoria-metrics-cluster/values.yaml
+++ b/charts/victoria-metrics-cluster/values.yaml
@@ -8,9 +8,10 @@ global:
compatibility:
openshift:
adaptSecurityContext: "auto"
+ # -- k8s cluster domain suffix, uses for building storage pods' FQDN. Details are [here](https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/)
+ cluster:
+ dnsDomain: cluster.local
-# -- k8s cluster domain suffix, uses for building storage pods' FQDN. Details are [here](https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/)
-clusterDomainSuffix: cluster.local
printNotes: true
rbac:
@@ -42,7 +43,7 @@ vmselect:
# -- Enable deployment of vmselect component. Can be deployed as Deployment(default) or StatefulSet
enabled: true
# -- Vmselect container name
- name: vmselect
+ name: ""
strategy: {}
# rollingUpdate:
# maxSurge: 25%
@@ -189,6 +190,7 @@ vmselect:
# -- Cache root folder
cacheMountPath: /cache
service:
+ enabled: true
# -- Service annotations
annotations: {}
# -- Service labels
@@ -294,7 +296,7 @@ vminsert:
# -- Enable deployment of vminsert component. Deployment is used
enabled: true
# -- vminsert container name
- name: vminsert
+ name: ""
strategy: {}
# rollingUpdate:
# maxSurge: 25%
@@ -432,6 +434,7 @@ vminsert:
podSecurityContext:
enabled: false
service:
+ enabled: true
# -- Service annotations
annotations: {}
# -- Service labels
@@ -507,11 +510,231 @@ vminsert:
# -- Service Monitor metricRelabelings
metricRelabelings: []
+vmauth:
+ # -- Enable deployment of vmauth component. Deployment is used
+ enabled: false
+ # -- vmauth container name
+ name: ""
+ configSecretName: ""
+ config:
+ unauthorized_user: {}
+ strategy: {}
+ # rollingUpdate:
+ # maxSurge: 25%
+ # maxUnavailable: 25%
+ # type: RollingUpdate
+ image:
+ # -- Image registry
+ registry: ""
+ # -- Image repository
+ repository: victoriametrics/vmauth
+ # -- Image tag
+ # override Chart.AppVersion
+ tag: ""
+ # Variant of the image to use.
+ # e.g. cluster, enterprise-cluster
+ variant: ""
+ # -- Image pull policy
+ pullPolicy: IfNotPresent
+ ports:
+ name: "http"
+ # -- Name of Priority Class
+ priorityClassName: ""
+ # -- Overrides the full name of vmauth component
+ fullnameOverride: ""
+ # Extra command line arguments for vmauth component
+ extraArgs:
+ envflag.enable: "true"
+ envflag.prefix: VM_
+ loggerFormat: json
+ annotations: {}
+ extraLabels: {}
+ podLabels: {}
+ # -- Additional environment variables (ex.: secret tokens, flags) https://docs.victoriametrics.com/#environment-variables
+ env: []
+ envFrom: []
+ #- configMapRef:
+ # name: special-config
+
+ # -- Suppress rendering `--storageNode` FQDNs based on `vmstorage.replicaCount` value. If true suppress rendering `--storageNodes`, they can be re-defined in extraArgs
+ suppressStorageFQDNsRender: false
+ automountServiceAccountToken: true
+ # Readiness & Liveness probes
+ probe:
+ # -- vmauth readiness probe
+ readiness:
+ httpGet: {}
+ initialDelaySeconds: 5
+ periodSeconds: 15
+ timeoutSeconds: 5
+ failureThreshold: 3
+ # -- vmauth liveness probe
+ liveness:
+ tcpSocket: {}
+ initialDelaySeconds: 5
+ periodSeconds: 15
+ timeoutSeconds: 5
+ failureThreshold: 3
+ # -- vmauth startup probe
+ startup: {}
+
+# Horizontal Pod Autoscaling
+ horizontalPodAutoscaler:
+ # -- Use HPA for vmauth component
+ enabled: false
+ # -- Maximum replicas for HPA to use to to scale the vmauth component
+ maxReplicas: 10
+ # -- Minimum replicas for HPA to use to scale the vmauth component
+ minReplicas: 2
+ # -- Metric for HPA to use to scale the vmauth component
+ metrics: []
+ # -- Behavior settings for scaling by the HPA
+ behavior: {}
+
+ # 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
+
+ initContainers:
+ []
+ # - name: example
+ # image: example-image
+
+ podDisruptionBudget:
+ # -- See `kubectl explain poddisruptionbudget.spec` for more. Details are [here](https://kubernetes.io/docs/tasks/run-application/configure-pdb/)
+ enabled: false
+ # minAvailable: 1
+ # maxUnavailable: 1
+ labels: {}
+
+ # -- Array of tolerations object. Details are [here](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/)
+ tolerations: []
+ # - key: "key"
+ # operator: "Equal|Exists"
+ # value: "value"
+ # effect: "NoSchedule|PreferNoSchedule"
+
+ # -- Pod's node selector. Details are [here](https://kubernetes.io/docs/user-guide/node-selection/)
+ nodeSelector: {}
+ # -- Pod affinity
+ affinity: {}
+ # -- Pod topologySpreadConstraints
+ topologySpreadConstraints: []
+ # -- Pod's annotations
+ podAnnotations: {}
+ # -- Count of vmauth pods
+ replicaCount: 2
+ # -- Container workdir
+ containerWorkingDir: ""
+ # -- Resource object
+ resources: {}
+ # limits:
+ # cpu: 50m
+ # memory: 64Mi
+ # requests:
+ # cpu: 50m
+ # memory: 64Mi
+ # -- Pod's security context. Details are [here](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
+ securityContext:
+ enabled: false
+ podSecurityContext:
+ enabled: false
+ service:
+ enabled: true
+ # -- Service annotations
+ annotations: {}
+ # -- Service labels
+ labels: {}
+ # -- Service ClusterIP
+ clusterIP: ""
+ # -- Service External IPs. Details are [here]( https://kubernetes.io/docs/user-guide/services/#external-ips)
+ externalIPs: []
+ # -- Extra service ports
+ extraPorts: []
+ # -- Service load balancer IP
+ loadBalancerIP: ""
+ # -- Load balancer source range
+ loadBalancerSourceRanges: []
+ # -- Service port
+ servicePort: 8427
+ # -- Target port
+ targetPort: http
+ # -- Service type
+ type: ClusterIP
+ # -- Enable UDP port. used if you have "spec.opentsdbListenAddr" specified
+ # -- Make sure that service is not type "LoadBalancer", as it requires "MixedProtocolLBService" feature gate. ref: https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/
+ udp: false
+ healthCheckNodePort: ""
+ externalTrafficPolicy: ""
+ ipFamilyPolicy: ""
+ ipFamilies: []
+ ingress:
+ # -- Enable deployment of ingress for vmauth component
+ enabled: false
+ # -- Ingress annotations
+ annotations: {}
+ # kubernetes.io/ingress.class: nginx
+ # kubernetes.io/tls-acme: 'true'
+ extraLabels: {}
+ # -- Array of host objects
+ hosts: []
+ # - name: vmauth.local
+ # path: /insert
+ # port: http
+ # -- Array of TLS objects
+ tls: []
+ # - secretName: vmauth-ingress-tls
+ # hosts:
+ # - vmauth.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
+ serviceMonitor:
+ # -- Enable deployment of Service Monitor for vmauth component. This is Prometheus operator object
+ enabled: false
+ # -- Target namespace of ServiceMonitor manifest
+ namespace: ""
+ # -- Service Monitor labels
+ extraLabels: {}
+ # -- Service Monitor annotations
+ annotations: {}
+ # -- Basic auth params for Service Monitor
+ basicAuth: {}
+ # Commented. Prometheus scare interval for vmauth component
+# interval: 15s
+ # Commented. Prometheus pre-scrape timeout for vmauth component
+# scrapeTimeout: 5s
+ # -- Commented. HTTP scheme to use for scraping.
+# scheme: https
+ # -- Commented. TLS configuration to use when scraping the endpoint
+# tlsConfig:
+# insecureSkipVerify: true
+ # -- Service Monitor relabelings
+ relabelings: []
+ # -- Service Monitor metricRelabelings
+ metricRelabelings: []
+
vmstorage:
# -- Enable deployment of vmstorage component. StatefulSet is used
enabled: true
# -- vmstorage container name
- name: vmstorage
+ name: ""
image:
# -- Image registry
registry: ""
@@ -677,6 +900,9 @@ vmstorage:
podSecurityContext:
enabled: false
service:
+ clusterIP: None
+ type: ClusterIP
+ enabled: true
# -- Service annotations
annotations: {}
# -- Service labels
@@ -712,6 +938,21 @@ vmstorage:
failureThreshold: 10
# -- vmstorage startup probe
startup: {}
+
+ horizontalPodAutoscaler:
+ # -- Use HPA for vmstorage component
+ enabled: false
+ # -- Maximum replicas for HPA to use to to scale the vmstorage component
+ maxReplicas: 10
+ # -- Minimum replicas for HPA to use to scale the vmstorage component
+ minReplicas: 2
+ # -- Metric for HPA to use to scale the vmstorage component
+ metrics: []
+ # -- Behavior settings for scaling by the HPA
+ behavior:
+ scaleDown:
+ selectPolicy: Disabled
+
vmbackupmanager:
# -- enable automatic creation of backup via vmbackupmanager. vmbackupmanager is part of Enterprise packages
enabled: false