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,29 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
*.md.gotmpl
CHANGELOG.md
_changelog.md
_index.md
e2e/
lint/
tests/
@@ -0,0 +1,70 @@
# victoria-metrics-cluster 버전 갱신 가이드
> **카탈로그 업데이트 방식**: 기존 버전 디렉토리는 유지하고, 신규 버전 디렉토리를 새로 생성한다.
> `manifests/helm/victoria-metrics-cluster/<new-version>/` 디렉토리를 직접 추가하는 방식으로 관리한다.
## 1. git 작업 환경 구성
- dip-catalog git 다운로드
```sh
git clone https://github.com/paasup/dip-catalog.git
```
- 작업 브랜치로 체크아웃
```sh
git checkout -b update-victoria-metrics-cluster/<new-version>
```
## 2. helm chart 업데이트
### 1) 기존 버전 디렉토리 복사
신규 버전 디렉토리를 기존 버전에서 복사하여 시작한다.
`BUILD-README.md`, `CUSTOM-README.md`, `custom-values.yaml`가 함께 복사된다.
```sh
cd ~/dip-catalog/manifests/helm/victoria-metrics-cluster
# 기존 버전에서 신규 버전 디렉토리 복사
cp -r 0.43.0 <new-version>
```
### 2) 업스트림 차트 파일 업데이트
신규 버전 디렉토리에서 업스트림 차트 파일만 교체한다.
`BUILD-README.md`, `CUSTOM-README.md`, `custom-values.yaml`는 유지한다.
```sh
cd ~/dip-catalog/manifests/helm/victoria-metrics-cluster
# helm repo 추가
helm repo add victoria-metrics https://victoriametrics.github.io/helm-charts/
helm repo update
# 신규 버전 차트 다운로드 후 압축 해제
helm pull victoria-metrics/victoria-metrics-cluster --version="<new-version>"
tar xzvf victoria-metrics-cluster-<new-version>.tgz -C <new-version> --strip-components=1
# 불필요한 파일 삭제
rm victoria-metrics-cluster-<new-version>.tgz
```
## 3. git push 및 tag 추가
```sh
git add .
git commit -m "update victoria-metrics-cluster/<new-version>"
git checkout main
git merge update-victoria-metrics-cluster/<new-version>
git push -u origin main
git branch -d update-victoria-metrics-cluster/<new-version>
git tag victoria-metrics-cluster/<new-version>
git push origin victoria-metrics-cluster/<new-version>
```
## 4. 차트 버전 정보
- victoria-metrics-cluster/0.43.0
- Chart version: 0.43.0
- App version: v1.144.0
- 업스트림: https://victoriametrics.github.io/helm-charts/
@@ -0,0 +1,42 @@
# VictoriaMetrics Cluster 배포
URL 기반 멀티테넌시를 지원하는 고가용 시계열 메트릭 스토리지. vminsert(쓰기)·vmselect(조회)·vmstorage(저장) 3개 컴포넌트로 구성된다.
## 1. 배포 방법
```sh
helm upgrade vmcluster ./ -f custom-values.yaml --install -n monitoring
```
배포 시 주의:
- `vmstorage`는 StatefulSet + PVC를 사용한다. `persistentVolume.size`(기본 10Gi)와 StorageClass를 환경에 맞게 조정한다.
- 인증/라우팅은 이 차트가 담당하지 않는다. 사용자/외부 접근은 **victoria-metrics-auth(vmauth)** 차트를 앞단에 둔다.
## 2. custom-values.yaml 설정 설명
| 컴포넌트 | 포트 | 역할 |
|----------|------|------|
| vminsert | 8480 | 쓰기 수신 — `/insert/{accountID}/prometheus/api/v1/write` |
| vmselect | 8481 | 쿼리 — `/select/{accountID}/prometheus/api/v1/query` |
| vmstorage | 8482 | 데이터 저장 (PVC, 보존기간 `retentionPeriod`) |
## 3. 멀티테넌시
`accountID`를 URL 경로에 포함하여 **스토리지 레벨에서 완전 격리**된다.
- 쓰기: vmagent가 `/insert/{accountID}/...`로 전송
- 조회: vmauth가 JWT `vm_access`의 accountID로 `/select/{accountID}/...` 라우팅
- 전체 집계: `/select/multitenant/prometheus` (vmalert 등 플랫폼 레벨)
## 4. 의존 관계
- **쓰기**: vmagent → vminsert:8480
- **조회**: vmauth → vmselect:8481, vmalert → vmselect multitenant
- **알림 메트릭**: vmalert remoteWrite → vminsert:8480 `/insert/0/`
## 5. 검증
```sh
kubectl get pods -n monitoring -l app.kubernetes.io/instance=vmcluster
kubectl port-forward -n monitoring svc/vmcluster-victoria-metrics-cluster-vmselect 8481:8481
curl -s 'http://localhost:8481/select/0/prometheus/api/v1/query?query=up' | jq '.status'
```
@@ -0,0 +1,6 @@
dependencies:
- name: victoria-metrics-common
repository: oci://ghcr.io/victoriametrics/helm-charts
version: 0.3.0
digest: sha256:cadb4ced35cde20c5f8437f6ff223ded677542490848e1b3a3b5f330f3069ebc
generated: "2026-04-16T10:13:39.389936005Z"
@@ -0,0 +1,48 @@
annotations:
artifacthub.io/category: monitoring-logging
artifacthub.io/changes: |
- bump version of VM components to [v1.144.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.144.0)
artifacthub.io/license: Apache-2.0
artifacthub.io/links: |
- name: Sources
url: https://github.com/VictoriaMetrics/helm-charts/tree/master/charts/victoria-metrics-cluster
- name: Charts repo
url: https://victoriametrics.github.io/helm-charts/
- name: Docs
url: https://docs.victoriametrics.com/victoriametrics/cluster-victoriametrics/
- name: Changelog
url: https://docs.victoriametrics.com/victoriametrics/changelog/
artifacthub.io/readme: |
# VictoriaMetrics Cluster Helm chart
Chart documentation is available [here](https://docs.victoriametrics.com/helm/victoria-metrics-cluster/).
Changelog is [here](https://docs.victoriametrics.com/helm/victoria-metrics-cluster/changelog/).
apiVersion: v2
appVersion: v1.144.0
dependencies:
- name: victoria-metrics-common
repository: oci://ghcr.io/victoriametrics/helm-charts
version: 0.3.*
description: VictoriaMetrics Cluster version - high-performance, cost-effective and
scalable TSDB, long-term remote storage for Prometheus
home: https://github.com/VictoriaMetrics/helm-charts
icon: https://avatars.githubusercontent.com/u/43720803?s=200&v=4
keywords:
- victoriametrics
- vmcluster
- vmselect
- vminsert
- vmstorage
- tsdb
- monitoring
- kubernetes
- observability
- metrics
- metricsql
- timeseries
kubeVersion: '>=1.25.0-0'
name: victoria-metrics-cluster
sources:
- https://github.com/VictoriaMetrics/helm-charts
type: application
version: 0.43.0
@@ -0,0 +1,4 @@
# VictoriaMetrics Cluster Helm chart
Chart documentation is available [here](https://docs.victoriametrics.com/helm/victoria-metrics-cluster/).
Changelog is [here](https://docs.victoriametrics.com/helm/victoria-metrics-cluster/changelog/).
@@ -0,0 +1,7 @@
# Release notes for version 0.43.0
**Release date:** 25 May 2026
![Helm: v3](https://img.shields.io/badge/Helm-v3.14%2B-informational?color=informational&logo=helm&link=https%3A%2F%2Fgithub.com%2Fhelm%2Fhelm%2Freleases%2Ftag%2Fv3.14.0) ![AppVersion: v1.144.0](https://img.shields.io/badge/v1.144.0-success?logo=VictoriaMetrics&labelColor=gray&link=https%3A%2F%2Fdocs.victoriametrics.com%2Fvictoriametrics%2Fchangelog%2F%23v11440)
- bump version of VM components to [v1.144.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.144.0)
@@ -0,0 +1,26 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
*.md.gotmpl
CHANGELOG.md
_changelog.md
_index.md
@@ -0,0 +1,3 @@
dependencies: []
digest: sha256:643d5437104296e21d906ecb15b2c96ad278f20cfc4af53b12bb6069bd853726
generated: "2024-11-13T12:10:17.363248379Z"
@@ -0,0 +1,33 @@
annotations:
artifacthub.io/category: monitoring-logging
artifacthub.io/changes: |
- reverted usage of `app` label in `vm.selectorLabels`
artifacthub.io/license: Apache-2.0
artifacthub.io/links: |
- name: Sources
url: https://github.com/VictoriaMetrics/helm-charts/tree/master/charts/victoria-metrics-common
- name: Charts repo
url: https://victoriametrics.github.io/helm-charts/
artifacthub.io/readme: |
# VictoriaMetrics Common Helm chart
Chart documentation is available [here](https://docs.victoriametrics.com/helm/victoria-metrics-common/).
Changelog is [here](https://docs.victoriametrics.com/helm/victoria-metrics-common/changelog/).
apiVersion: v2
description: VictoriaMetrics Common - contains shared templates for all Victoria Metrics
helm charts
keywords:
- victoriametrics
- monitoring
- kubernetes
- observability
- tsdb
- metrics
- metricsql
- timeseries
kubeVersion: '>=1.23.0-0'
name: victoria-metrics-common
sources:
- https://github.com/VictoriaMetrics/helm-charts
type: library
version: 0.3.0
@@ -0,0 +1,4 @@
# VictoriaMetrics Common Helm chart
Chart documentation is available [here](https://docs.victoriametrics.com/helm/victoria-metrics-common/).
Changelog is [here](https://docs.victoriametrics.com/helm/victoria-metrics-common/changelog/).
@@ -0,0 +1,7 @@
# Release notes for version 0.3.0
**Release date:** 16 Apr 2026
![Helm: v3](https://img.shields.io/badge/Helm-v3.14%2B-informational?color=informational&logo=helm&link=https%3A%2F%2Fgithub.com%2Fhelm%2Fhelm%2Freleases%2Ftag%2Fv3.14.0)
- reverted usage of `app` label in `vm.selectorLabels`
@@ -0,0 +1,87 @@
{{- define "vm.license.secret.key" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $plain := (($Values.license).secret).key | default ((($Values.global).license).secret).key -}}
{{- $managed := (($Values.license).keyRef).key | default ((($Values.global).license).keyRef).key }}
{{- if $plain -}}
{{- $plain -}}
{{- else if $managed -}}
{{- $managed -}}
{{- end -}}
{{- end -}}
{{- define "vm.license.secret.name" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $plain := (($Values.license).secret).name | default ((($Values.global).license).secret).name -}}
{{- $managed := (($Values.license).keyRef).name | default ((($Values.global).license).keyRef).name -}}
{{- if $plain -}}
{{- $plain -}}
{{- else if $managed -}}
{{- $managed -}}
{{- end -}}
{{- end -}}
{{- define "vm.license.key" -}}
{{- $Values := (.helm).Values | default .Values }}
{{- ($Values.license).key | default (($Values.global).license).key | default "" -}}
{{- end -}}
{{- define "vm.enterprise.disabled" -}}
{{- $licenseKey := (include "vm.license.key" .) -}}
{{- $licenseSecretKey := (include "vm.license.secret.key" .) -}}
{{- $licenseSecretName := (include "vm.license.secret.name" .) -}}
{{- or .noEnterprise (and (empty $licenseKey) (and (empty $licenseSecretName) (empty $licenseSecretKey))) -}}
{{- end -}}
{{- define "vm.enterprise.only" -}}
{{- if eq (include "vm.enterprise.disabled" .) "true" }}
{{ fail `Pass valid license at .Values.license or .Values.global.license if you have an enterprise license for running this software.
See https://victoriametrics.com/legal/esa/ for details.
Documentation - https://docs.victoriametrics.com/victoriametrics/enterprise/
for more information, visit https://victoriametrics.com/products/enterprise/
To request a trial license, go to https://victoriametrics.com/products/enterprise/trial/` }}
{{- end -}}
{{- end -}}
{{/*
Return license volume mount
*/}}
{{- define "vm.license.volume" -}}
{{- $licenseSecretKey := (include "vm.license.secret.key" .) -}}
{{- $licenseSecretName := (include "vm.license.secret.name" .) -}}
{{- if and $licenseSecretName $licenseSecretKey -}}
- name: license-key
secret:
secretName: {{ $licenseSecretName }}
{{- end -}}
{{- end -}}
{{/*
Return license volume mount for container
*/}}
{{- define "vm.license.mount" -}}
{{- $licenseSecretKey := (include "vm.license.secret.key" .) -}}
{{- $licenseSecretName := (include "vm.license.secret.name" .) -}}
{{- if and $licenseSecretName $licenseSecretKey -}}
- name: license-key
mountPath: /etc/vm-license-key
readOnly: true
{{- end -}}
{{- end -}}
{{/*
Return license flag if necessary.
*/}}
{{- define "vm.license.flag" -}}
{{- $licenseKey := (include "vm.license.key" .) -}}
{{- $licenseSecretKey := (include "vm.license.secret.key" .) -}}
{{- $licenseSecretName := (include "vm.license.secret.name" .) -}}
{{- if $licenseKey -}}
license: {{ $licenseKey }}
{{- else if and $licenseSecretName $licenseSecretKey -}}
{{- $flagName := "licenseFile" -}}
{{- if eq .flagStyle "kebab" }}
{{- $flagName = "license-file" -}}
{{- end -}}
{{- $flagName }}: /etc/vm-license-key/{{ $licenseSecretKey }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,249 @@
{{- define "vm.namespace" -}}
{{- include "vm.validate.args" . -}}
{{- $Release := (.helm).Release | default .Release -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $Values.namespaceOverride | default ($Values.global).namespaceOverride | default $Release.Namespace -}}
{{- end -}}
{{- define "vm.validate.args" -}}
{{- $Chart := (.helm).Chart | default .Chart -}}
{{- $Capabilities := (.helm).Capabilities | default .Capabilities -}}
{{- if semverCompare "<3.14.0" $Capabilities.HelmVersion.Version }}
{{- fail "This chart requires helm version 3.14.0 or higher" }}
{{- end }}
{{- if empty $Chart -}}
{{- fail "invalid template data" -}}
{{- end -}}
{{- end -}}
{{- /* Expand the name of the chart. */ -}}
{{- define "vm.name" -}}
{{- include "vm.validate.args" . -}}
{{- $Chart := (.helm).Chart | default .Chart -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $nameOverride := $Values.nameOverride | default ($Values.global).nameOverride | default $Chart.Name -}}
{{- if or ($Values.global).disableNameTruncation $Values.disableNameTruncation -}}
{{- $nameOverride -}}
{{- else -}}
{{- $nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- 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 "vm.fullname" -}}
{{- include "vm.validate.args" . -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $Chart := (.helm).Chart | default .Chart -}}
{{- $Release := (.helm).Release | default .Release -}}
{{- $fullname := "" -}}
{{- if $Values.fullnameOverride -}}
{{- $fullname = $Values.fullnameOverride -}}
{{- else if ($Values.global).fullnameOverride -}}
{{- $fullname = $Values.global.fullnameOverride -}}
{{- else -}}
{{- $name := default $Chart.Name $Values.nameOverride -}}
{{- if contains $name $Release.Name -}}
{{- $fullname = $Release.Name -}}
{{- else -}}
{{- $fullname = (printf "%s-%s" $Release.Name $name) }}
{{- end -}}
{{- end -}}
{{- $fullname = tpl $fullname . -}}
{{- if or ($Values.global).disableNameTruncation $Values.disableNameTruncation -}}
{{- $fullname -}}
{{- else -}}
{{- $fullname | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end }}
{{- define "vm.cr.fullname" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $_ := set . "overrideKey" "name" -}}
{{- $fullname := include "vm.internal.key" . -}}
{{- $_ := unset . "overrideKey" -}}
{{- if empty $fullname -}}
{{- $fullname = include "vm.fullname" . -}}
{{- end -}}
{{- $fullname = tpl $fullname . -}}
{{- if or ($Values.global).disableNameTruncation $Values.disableNameTruncation -}}
{{- $fullname -}}
{{- else -}}
{{- $fullname | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- define "vm.managed.fullname" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $_ := set . "overrideKey" "name" -}}
{{- $fullname := include "vm.internal.key" . -}}
{{- $_ := unset . "overrideKey" -}}
{{- if empty $fullname -}}
{{- $fullname = include "vm.fullname" . -}}
{{- end -}}
{{- with include "vm.internal.key.default" . -}}
{{- $prefix := ternary . (printf "vm%s" .) (or (hasPrefix "vm" .) (hasPrefix "vl" .)) -}}
{{- $fullname = printf "%s-%s" $prefix $fullname -}}
{{- end -}}
{{- $fullname = tpl $fullname . -}}
{{- if or ($Values.global).disableNameTruncation $Values.disableNameTruncation -}}
{{- $fullname -}}
{{- else -}}
{{- $fullname | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- define "vm.plain.fullname" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $_ := set . "overrideKey" "fullnameOverride" -}}
{{- $fullname := include "vm.internal.key" . -}}
{{- $_ := unset . "overrideKey" -}}
{{- if empty $fullname -}}
{{- $fullname = include "vm.fullname" . -}}
{{- with include "vm.internal.key.default" . -}}
{{- $fullname = printf "%s-%s" $fullname . -}}
{{- end -}}
{{- end -}}
{{- $fullname = tpl $fullname . -}}
{{- if or ($Values.global).disableNameTruncation $Values.disableNameTruncation -}}
{{- $fullname -}}
{{- else -}}
{{- $fullname | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- define "vm.internal.key" -}}
{{- include "vm.validate.args" . -}}
{{- $overrideKey := .overrideKey | default "fullnameOverride" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $key := "" -}}
{{- if .appKey -}}
{{- $appKey := ternary (list .appKey) .appKey (kindIs "string" .appKey) -}}
{{- $ctx := . -}}
{{- $values := $Values -}}
{{- range $ak := $appKey }}
{{- $values = ternary (dict) (index $values $ak | default dict) (empty $values) -}}
{{- $ctx = ternary (dict) (index $ctx $ak | default dict) (empty $ctx) -}}
{{- if and (empty $values) (empty $ctx) -}}
{{- fail (printf "No data for appKey %s" (join "->" $appKey)) -}}
{{- end -}}
{{- if and (kindIs "map" $values) (index $values $overrideKey) -}}
{{- $key = index $values $overrideKey -}}
{{- else if and (kindIs "map" $ctx) (index $ctx $overrideKey) -}}
{{- $key = index $ctx $overrideKey -}}
{{- end -}}
{{- end }}
{{- if and (empty $key) .fallback -}}
{{- $key = include "vm.internal.key.default" . -}}
{{- end -}}
{{- end -}}
{{- $key -}}
{{- end -}}
{{- define "vm.internal.key.default" -}}
{{- with .appKey -}}
{{- $key := ternary (list .) . (kindIs "string" .) -}}
{{- last (without $key "spec") -}}
{{- end -}}
{{- end -}}
{{- /* Create chart name and version as used by the chart label. */ -}}
{{- define "vm.chart" -}}
{{- include "vm.validate.args" . -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $Chart := (.helm).Chart | default .Chart -}}
{{- $chart := printf "%s-%s" $Chart.Name $Chart.Version | replace "+" "_" -}}
{{- if or ($Values.global).disableNameTruncation $Values.disableNameTruncation -}}
{{- $chart -}}
{{- else -}}
{{- $chart | trunc 63 | trimSuffix "-" -}}
{{- end }}
{{- end }}
{{- /* Create the name of the service account to use */ -}}
{{- define "vm.sa.name" -}}
{{- include "vm.validate.args" . -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- if $Values.serviceAccount.create }}
{{- default (include "vm.fullname" .) $Values.serviceAccount.name }}
{{- else -}}
{{- default "default" $Values.serviceAccount.name -}}
{{- end }}
{{- end }}
{{- define "vm.metaLabels" -}}
{{- include "vm.validate.args" . -}}
{{- $Release := (.helm).Release | default .Release -}}
{{- $labels := .extraLabels | default dict -}}
{{- $_ := set $labels "helm.sh/chart" (include "vm.chart" .) -}}
{{- $_ := set $labels "app.kubernetes.io/managed-by" $Release.Service -}}
{{- toYaml $labels -}}
{{- end -}}
{{- define "vm.podLabels" -}}
{{- include "vm.validate.args" . -}}
{{- $Release := (.helm).Release | default .Release -}}
{{- $labels := fromYaml (include "vm.selectorLabels" .) -}}
{{- with $labels.app -}}
{{- $_ := set $labels "app.kubernetes.io/component" . -}}
{{- end -}}
{{- $labels = mergeOverwrite $labels (.extraLabels | default dict) -}}
{{- $_ := set $labels "app.kubernetes.io/managed-by" $Release.Service -}}
{{- toYaml $labels -}}
{{- end -}}
{{- /* Common labels */ -}}
{{- define "vm.labels" -}}
{{- include "vm.validate.args" . -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $globalLabels := deepCopy (($Values.global).extraLabels | default dict) -}}
{{- $labels := fromYaml (include "vm.commonLabels" .) -}}
{{- $labels = mergeOverwrite $globalLabels $labels (fromYaml (include "vm.metaLabels" .)) -}}
{{- with (include "vm.image.tag" .) }}
{{- $_ := set $labels "app.kubernetes.io/version" (regexReplaceAll "(.*)(@sha.*)" . "${1}") -}}
{{- end -}}
{{- toYaml $labels -}}
{{- end -}}
{{- define "vm.release" -}}
{{- include "vm.validate.args" . -}}
{{- $Release := (.helm).Release | default .Release -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $release := default $Release.Name $Values.argocdReleaseOverride -}}
{{- if or ($Values.global).disableNameTruncation $Values.disableNameTruncation -}}
{{- $release -}}
{{- else -}}
{{- $release | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- define "vm.app.name" -}}
{{- $_ := set . "overrideKey" "name" -}}
{{- $_ := set . "fallback" true -}}
{{- tpl (include "vm.internal.key" .) . -}}
{{- $_ := unset . "overrideKey" -}}
{{- $_ := unset . "fallback" -}}
{{- end -}}
{{- /* Selector labels */ -}}
{{- define "vm.selectorLabels" -}}
{{- $labels := .extraLabels | default dict -}}
{{- $_ := set $labels "app.kubernetes.io/name" (include "vm.name" .) -}}
{{- $_ := set $labels "app.kubernetes.io/instance" (include "vm.release" .) -}}
{{- with (include "vm.app.name" .) -}}
{{- $_ := set $labels "app" . -}}
{{- end -}}
{{- toYaml $labels -}}
{{- end }}
{{- define "vm.commonLabels" -}}
{{- $labels := fromYaml (include "vm.selectorLabels" . ) -}}
{{- with $labels.app -}}
{{- $_ := set $labels "app.kubernetes.io/component" . -}}
{{- $_ := unset $labels "app" -}}
{{- end -}}
{{- toYaml $labels -}}
{{- end -}}
@@ -0,0 +1,61 @@
{{/*
Victoria Metrics Image
*/}}
{{- define "vm.image" -}}
{{- $image := (fromYaml (include "vm.internal.image" .)).image | default dict -}}
{{- $tag := include "vm.image.tag" . -}}
{{- if empty $image.repository -}}
{{- fail "cannot create image without `.repository` defined" -}}
{{- end -}}
{{- $result := tpl (printf "%s:%s" $image.repository $tag) . -}}
{{- with $image.registry | default "" -}}
{{- $result = (printf "%s/%s" . $result) -}}
{{- end -}}
{{- $result -}}
{{- end -}}
{{- define "vm.image.tag" -}}
{{- $Chart := (.helm).Chart | default .Chart -}}
{{- $image := (fromYaml (include "vm.internal.image" .)).image | default dict -}}
{{- $tag := $image.tag -}}
{{- if empty $tag }}
{{- $tag = $Chart.AppVersion -}}
{{- $variant := $image.variant }}
{{- if eq (include "vm.enterprise.disabled" .) "false" -}}
{{- if $variant }}
{{- $variant = printf "enterprise-%s" $variant }}
{{- else }}
{{- $variant = "enterprise" }}
{{- end }}
{{- end -}}
{{- with $variant -}}
{{- $tag = (printf "%s-%s" $tag .) -}}
{{- end -}}
{{- end -}}
{{- $tag -}}
{{- end -}}
{{- define "vm.internal.image" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $values := $Values -}}
{{- $ctx := . -}}
{{- with .appKey -}}
{{- $appKey := ternary (list .) . (kindIs "string" .) -}}
{{- range $ak := $appKey -}}
{{- $values = ternary (dict) (index $values $ak | default dict) (empty $values) -}}
{{- $ctx = ternary (dict) (index $ctx $ak | default dict) (empty $ctx) -}}
{{- if and (empty $values) (empty $ctx) -}}
{{- fail (printf "No data for appKey %s" (join "->" $appKey)) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $image := ternary (deepCopy ($ctx.image | default dict)) (deepCopy ($values.image | default dict)) (hasKey $ctx "image") -}}
{{- if not $image.registry }}
{{- if (($Values.global).image).registry -}}
{{- $_ := set $image "registry" (($Values.global).image).registry -}}
{{- else if hasKey $image "registry" -}}
{{- $_ := unset $image "registry" -}}
{{- end -}}
{{- end -}}
{{- toYaml (dict "image" $image) -}}
{{- end -}}
@@ -0,0 +1,8 @@
{{- define "vm.ingress.port" }}
{{- $port := dict "name" "http" }}
{{- with .port }}
{{- $numberTypes := list "int" "float64" }}
{{- $port = dict (ternary "number" "name" (has (kindOf .) $numberTypes)) . }}
{{- end -}}
{{- toYaml $port -}}
{{- end }}
@@ -0,0 +1,117 @@
{{- define "vm.port.from.flag" -}}
{{- $port := .default -}}
{{- with .flag -}}
{{- $port = regexReplaceAll ".*:(\\d+)" . "${1}" -}}
{{- end -}}
{{- $port -}}
{{- end }}
{{- /*
Return true if the detected platform is Openshift
Usage:
{{- include "vm.isOpenshift" . -}}
*/ -}}
{{- define "vm.isOpenshift" -}}
{{- $Capabilities := (.helm).Capabilities | default .Capabilities -}}
{{- if $Capabilities.APIVersions.Has "security.openshift.io/v1" -}}
{{- true -}}
{{- end -}}
{{- end -}}
{{- /*
Render a compatible securityContext depending on the platform.
Usage:
{{- include "vm.securityContext" (dict "securityContext" .Values.containerSecurityContext "helm" .) -}}
*/ -}}
{{- define "vm.securityContext" -}}
{{- $securityContext := omit .securityContext "enabled" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $adaptMode := (((($Values).global).compatibility).openshift).adaptSecurityContext | default "" -}}
{{- if or (eq $adaptMode "force") (and (eq $adaptMode "auto") (include "vm.isOpenshift" .)) -}}
{{- $securityContext = omit $securityContext "fsGroup" "runAsUser" "runAsGroup" "seLinuxOptions" -}}
{{- end -}}
{{- toYaml $securityContext -}}
{{- end -}}
{{- /*
Render probe
*/ -}}
{{- define "vm.probe" -}}
{{- /* undefined value */ -}}
{{- $null := (fromYaml "value: null").value -}}
{{- $probe := dig .type (dict) .app.probe -}}
{{- $probeType := "" -}}
{{- $defaultProbe := dict -}}
{{- if ne (dig "httpGet" $null $probe) $null -}}
{{- /* httpGet probe */ -}}
{{- $defaultProbe = dict "path" (include "vm.probe.http.path" .) "scheme" (include "vm.probe.http.scheme" .) "port" (include "vm.probe.port" .) -}}
{{- $probeType = "httpGet" -}}
{{- else if ne (dig "tcpSocket" $null $probe) $null -}}
{{- /* tcpSocket probe */ -}}
{{- $defaultProbe = dict "port" (include "vm.probe.port" .) -}}
{{- $probeType = "tcpSocket" -}}
{{- end -}}
{{- $defaultProbe = ternary (dict) (dict $probeType $defaultProbe) (empty $probeType) -}}
{{- $probe = mergeOverwrite $defaultProbe $probe -}}
{{- range $key, $value := $probe -}}
{{- if and (has (kindOf $value) (list "object" "map")) (ne $key $probeType) -}}
{{- $_ := unset $probe $key -}}
{{- end -}}
{{- end -}}
{{- tpl (toYaml $probe) . -}}
{{- end -}}
{{- /*
HTTP GET probe path
*/ -}}
{{- define "vm.probe.http.path" -}}
{{- index .app.extraArgs "http.pathPrefix" | default "" | trimSuffix "/" -}}/health
{{- end -}}
{{- /*
HTTP GET probe scheme
*/ -}}
{{- define "vm.probe.http.scheme" -}}
{{- $isSecure := false -}}
{{- with ((.app).extraArgs).tls -}}
{{- $isSecure = eq (toString .) "true" -}}
{{- end -}}
{{- ternary "HTTPS" "HTTP" $isSecure -}}
{{- end -}}
{{- /*
Net probe port
*/ -}}
{{- define "vm.probe.port" -}}
{{- dig "ports" "name" "http" (.app | dict) -}}
{{- end -}}
{{- define "vm.arg" -}}
{{- if and (empty .value) (kindIs "string" .value) (ne (toString .list) "true") }}
{{- .key -}}
{{- else if eq (toString .value) "true" -}}
-{{ ternary "" "-" (eq (len .key) 1) }}{{ .key }}
{{- else -}}
-{{ ternary "" "-" (eq (len .key) 1) }}{{ .key }}={{ ternary (toJson .value | squote) .value (has (kindOf .value) (list "map" "slice")) }}
{{- end -}}
{{- end -}}
{{- /*
command line arguments
*/ -}}
{{- define "vm.args" -}}
{{- $args := list -}}
{{- range $key, $value := . -}}
{{- if not $key -}}
{{- fail "Empty key in command line args is not allowed" -}}
{{- end -}}
{{- if kindIs "slice" $value -}}
{{- range $v := $value -}}
{{- $args = append $args (include "vm.arg" (dict "key" $key "value" $v "list" true)) -}}
{{- end -}}
{{- else -}}
{{- $args = append $args (include "vm.arg" (dict "key" $key "value" $value)) -}}
{{- end -}}
{{- end -}}
{{- toYaml (dict "args" $args) -}}
{{- end -}}
@@ -0,0 +1,88 @@
{{- /* Create the name for VM service */ -}}
{{- define "vm.service" -}}
{{- include "vm.validate.args" . -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $nameTpl := "" -}}
{{- if eq .style "managed" -}}
{{- $nameTpl = "vm.managed.fullname" }}
{{- else if eq .style "plain" -}}
{{- $nameTpl = "vm.plain.fullname" }}
{{- else -}}
{{- fail ".style argument should be either `plain` or `managed`"}}
{{- end -}}
{{- include $nameTpl . -}}
{{- end }}
{{- define "vm.fqdn" -}}
{{- $name := (include "vm.service" .) -}}
{{- if hasKey . "appIdx" -}}
{{- $name = (printf "%s-%d.%s" $name .appIdx $name) -}}
{{- end -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $ns := (include "vm.namespace" .) -}}
{{- $fqdn := printf "%s.%s.svc" $name $ns -}}
{{- with (($Values.global).cluster).dnsDomain -}}
{{- $fqdn = printf "%s.%s" $fqdn . -}}
{{- end -}}
{{- $fqdn -}}
{{- end -}}
{{- define "vm.host" -}}
{{- $fqdn := (include "vm.fqdn" .) -}}
{{- $port := 80 -}}
{{- $isSecure := ternary false true (empty .appSecure) -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- if .appKey -}}
{{- $appKey := ternary (list .appKey) .appKey (kindIs "string" .appKey) -}}
{{- $values := $Values -}}
{{- $ctx := . -}}
{{- range $ak := $appKey -}}
{{- $values = ternary (dict) (index $values $ak | default dict) (empty $values) -}}
{{- $ctx = ternary (dict) (index $ctx $ak | default dict) (empty $ctx) -}}
{{- end -}}
{{- $spec := dict -}}
{{- if $ctx -}}
{{- $spec = $ctx -}}
{{- else if $values -}}
{{- $spec = $values -}}
{{- end -}}
{{- with ($spec.extraArgs).tls -}}
{{- $isSecure = eq (toString .) "true" -}}
{{- end -}}
{{- $port = (ternary 443 80 $isSecure) -}}
{{- $port = $spec.port | default ($spec.service).servicePort | default ($spec.service).port | default $port -}}
{{- if hasKey . "appIdx" -}}
{{- $port = (include "vm.port.from.flag" (dict "flag" ($spec.extraArgs).httpListenAddr "default" $port)) -}}
{{- end }}
{{- end }}
{{- $fqdn }}:{{ $port }}
{{- end -}}
{{- define "vm.url" -}}
{{- $host := (include "vm.host" .) -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $proto := "http" -}}
{{- $path := .appRoute | default "/" -}}
{{- $isSecure := ternary false true (empty .appSecure) -}}
{{- if .appKey -}}
{{- $appKey := ternary (list .appKey) .appKey (kindIs "string" .appKey) -}}
{{- $values := $Values -}}
{{- $ctx := . -}}
{{- range $ak := $appKey -}}
{{- $values = ternary (dict) (index $values $ak | default dict) (empty $values) -}}
{{- $ctx = ternary (dict) (index $ctx $ak | default dict) (empty $ctx) -}}
{{- end -}}
{{- $spec := dict -}}
{{- if $values -}}
{{- $spec = $values -}}
{{- else if $ctx -}}
{{- $spec = $ctx -}}
{{- end -}}
{{- with ($spec.extraArgs).tls -}}
{{- $isSecure = eq (toString .) "true" -}}
{{- end -}}
{{- $proto = (ternary "https" "http" $isSecure) -}}
{{- $path = dig "http.pathPrefix" $path ($spec.extraArgs | default dict) -}}
{{- end -}}
{{- printf "%s://%s%s" $proto $host (trimSuffix "/" $path) -}}
{{- end -}}
@@ -0,0 +1,46 @@
# =============================================================================
# VictoriaMetrics Cluster — PaaSup 커스텀 오버라이드
# 차트: victoria-metrics/victoria-metrics-cluster
# 멀티테넌시: URL 기반 (/insert/{accountID}/, /select/{accountID}/)
# - 쓰기: vminsert:8480 /insert/{accountID}/prometheus/api/v1/write
# - 조회: vmselect:8481 /select/{accountID}/prometheus/api/v1/query
# 인증/라우팅 프록시는 victoria-metrics-auth(vmauth) 차트가 담당한다.
# =============================================================================
# ── vminsert (쓰기 수신) ─────────────────────────────────────────────────────
vminsert:
replicaCount: 1
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
# ── vmselect (쿼리) ──────────────────────────────────────────────────────────
vmselect:
replicaCount: 1
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
# ── vmstorage (저장) ─────────────────────────────────────────────────────────
vmstorage:
replicaCount: 1
retentionPeriod: 1 # 데이터 보존 기간(개월). 운영 규모에 맞게 조정
persistentVolume:
enabled: true
size: 10Gi
# storageClass: "longhorn" # 환경의 기본 StorageClass 사용 시 생략
resources:
requests:
cpu: 100m
memory: 512Mi
limits:
cpu: 1000m
memory: 1Gi
@@ -0,0 +1,88 @@
{{- if .Values.printNotes }}
{{- $ctx := dict "helm" . "style" "plain" }}
{{- $ns := include "vm.namespace" $ctx }}
{{- if .Values.vminsert.enabled }}
{{- if .Values.vmauth.enabled }}
{{- $_ := set $ctx "appKey" "vmauth" }}
{{- else }}
{{- $_ := set $ctx "appKey" "vminsert" }}
{{- end }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
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 "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 {{ $ns }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ $fullname }})
export NODE_IP=$(kubectl get nodes --namespace {{ $ns }} -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 {{ $ns }} -w {{ $fullname }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ $ns }} {{ $fullname }} -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 {{ $ns }} -l "app.kubernetes.io/component={{ include "vm.app.name" $ctx }}" -l "app.kubernetes.io/instance={{ include "vm.release" $ctx }}" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace {{ $ns }} port-forward $POD_NAME {{ .Values.vminsert.service.servicePort }}
{{- end }}
You need to update your Prometheus configuration file and add the following lines to it:
prometheus.yml
remote_write:
- url: "http://<insert-service>/insert/0/prometheus/"
for example - inside the Kubernetes cluster:
remote_write:
- url: {{ include "vm.url" $ctx }}/insert/0/prometheus/
{{- end }}
{{- if .Values.vmselect.enabled }}
{{- if .Values.vmauth.enabled }}
{{- $_ := set $ctx "appKey" "vmauth" }}
{{- else }}
{{- $_ := set $ctx "appKey" "vmselect" }}
{{- end }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
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 "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 {{ $ns }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ $fullname }})
export NODE_IP=$(kubectl get nodes --namespace {{ $ns }} -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 {{ $ns }} -w {{ $fullname }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ $ns }} {{ $fullname }} -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 {{ $ns }} -l "app.kubernetes.io/component={{ include "vm.app.name" $ctx }}" -l "app.kubernetes.io/instance={{ include "vm.release" $ctx }}" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace {{ $ns }} port-forward $POD_NAME {{ .Values.vmselect.service.servicePort }}
{{- end }}
You need to specify select service URL into your Grafana:
NOTE: you need to use the Prometheus Data Source
Input this URL field into Grafana
http://<select-service>/select/0/prometheus/
for example - inside the Kubernetes cluster:
{{ include "vm.url" $ctx }}/select/0/prometheus/
{{- end }}
{{- end }}
@@ -0,0 +1,268 @@
{{- define "vminsert.relabel.config.name" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $app := $Values.vminsert }}
{{- $fullname := include "vm.plain.fullname" . -}}
{{- $app.relabel.configMap | default (printf "%s-relabelconfig" $fullname) -}}
{{- end -}}
{{- define "vminsert.args" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $app := $Values.vminsert -}}
{{- $args := dict -}}
{{- $ctx := dict "style" "plain" "appKey" "vmstorage" "helm" .helm }}
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" $ctx)) -}}
{{- $args = mergeOverwrite $args $app.extraArgs -}}
{{- $storage := $Values.vmstorage }}
{{- if and (not $app.suppressStorageFQDNsRender) $storage.enabled $storage.replicaCount }}
{{- $storageNodes := list }}
{{- $fqdn := include "vm.fqdn" $ctx }}
{{- if $Values.autoDiscovery }}
{{- if eq (include "vm.enterprise.disabled" $ctx ) "true" }}
{{- fail "SRV autodiscovery is only supported in enterprise. Either define license or set `autoDiscovery` to `false`" }}
{{- end }}
{{- $storageNode := printf "srv+_vminsert._tcp.%s" $fqdn }}
{{- $storageNodes = append $storageNodes $storageNode }}
{{- else }}
{{- $port := "8400" }}
{{- 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" }}
{{- end }}
{{- $_ := set $args "storageNode" (concat ($args.storageNode | default list) $storageNodes) }}
{{- end -}}
{{- if $app.relabel.enabled -}}
{{- $_ := set $args "relabelConfig" "/relabelconfig/relabel.yml" -}}
{{- end -}}
{{- 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 "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 "vmselect.args" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $app := $Values.vmselect -}}
{{- $args := dict -}}
{{- $ctx := dict "style" "plain" "appKey" "vmstorage" "helm" .helm }}
{{- $_ := set $args "cacheDataPath" $app.cacheMountPath -}}
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" $ctx)) -}}
{{- $args = mergeOverwrite $args $app.extraArgs -}}
{{- $storage := $Values.vmstorage }}
{{- if and (not $app.suppressStorageFQDNsRender) $storage.enabled $storage.replicaCount }}
{{- $storageNodes := list }}
{{- $fqdn := include "vm.fqdn" $ctx }}
{{- if $Values.autoDiscovery }}
{{- if eq (include "vm.enterprise.disabled" $ctx) "true" }}
{{- fail "SRV autodiscovery is only supported in enterprise. Either define license or set `autoDiscovery` to `false`" }}
{{- end }}
{{- $storageNode := printf "srv+_vmselect._tcp.%s" $fqdn }}
{{- $storageNodes = append $storageNodes $storageNode }}
{{- else }}
{{- $port := "8401" }}
{{- 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" }}
{{- end }}
{{- $_ := set $args "storageNode" (concat ($args.storageNode | default list) $storageNodes) }}
{{- end }}
{{- $mode := $app.mode }}
{{- if and $mode (eq $mode "statefulSet") $app.enabled $app.replicaCount }}
{{- $selectNodes := list }}
{{- $_ := set $ctx "appKey" "vmselect" }}
{{- $fqdn := include "vm.fqdn" $ctx }}
{{- $port := "8481" }}
{{- with $app.extraArgs.httpListenAddr }}
{{- $port = regexReplaceAll ".*:(\\d+)" . "${1}" }}
{{- end -}}
{{- range $i := until ($app.replicaCount | int) -}}
{{- $_ := set $ctx "appIdx" $i }}
{{- $selectNode := include "vm.fqdn" $ctx -}}
{{- $selectNodes = append $selectNodes (printf "%s:%s" $selectNode $port) -}}
{{- end -}}
{{- $_ := unset $ctx "appIdx" }}
{{- $_ := 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" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $app := $Values.vmstorage -}}
{{- $args := dict -}}
{{- $_ := set $args "retentionPeriod" (toString $app.retentionPeriod) -}}
{{- $_ := 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 "vmbackupmanager.args" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $app := $Values.vmstorage -}}
{{- $manager := $app.vmbackupmanager -}}
{{- $args := dict -}}
{{- $_ := set $args "disableHourly" $manager.disableHourly -}}
{{- $_ := set $args "disableDaily" $manager.disableDaily -}}
{{- $_ := set $args "disableWeekly" $manager.disableWeekly -}}
{{- $_ := set $args "disableMonthly" $manager.disableMonthly -}}
{{- $_ := set $args "keepLastHourly" $manager.retention.keepLastHourly -}}
{{- $_ := set $args "keepLastDaily" $manager.retention.keepLastDaily -}}
{{- $_ := set $args "keepLastWeekly" $manager.retention.keepLastWeekly -}}
{{- $_ := set $args "keepLastMonthly" $manager.retention.keepLastMonthly -}}
{{- $_ := set $args "storageDataPath" $app.persistentVolume.mountPath -}}
{{- $_ := set $args "dst" (printf "%s/$(POD_NAME)" $manager.destination) -}}
{{- $_ := set $args "snapshot.createURL" "http://localhost:8482/snapshot/create" -}}
{{- $_ := set $args "snapshot.deleteURL" "http://localhost:8482/snapshot/delete" -}}
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" .)) -}}
{{- $args = mergeOverwrite $args $manager.extraArgs -}}
{{- toYaml (fromYaml (include "vm.args" $args)).args -}}
{{- end -}}
{{- define "vmbackupmanager.restore.args" -}}
{{- $Values := (.helm).Values | default .Values -}}
{{- $app := $Values.vmstorage -}}
{{- $manager := $app.vmbackupmanager -}}
{{- $args := dict -}}
{{- $_ := set $args "storageDataPath" $app.persistentVolume.mountPath -}}
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" .)) -}}
{{- $args = mergeOverwrite $args $manager.extraArgs -}}
{{- $output := (fromYaml (include "vm.args" $args)).args -}}
{{- $output = concat (list "restore") $output -}}
{{- toYaml $output -}}
{{- end -}}
{{- define "vmselect.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 }}
{{- with $extraArgs.clusternativeListenAddr }}
- name: cluster-tcp
protocol: TCP
port: {{ include "vm.port.from.flag" (dict "flag" .) }}
targetPort: cluster-tcp
{{- end }}
{{- end -}}
{{- define "vminsert.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 }}
{{- 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" -}}
{{- $service := .service -}}
- 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" -}}
{{- $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,21 @@
{{- if .Values.extraSecrets }}
{{- $ctx := dict "helm" . }}
{{- range .Values.extraSecrets }}
---
apiVersion: v1
kind: Secret
metadata:
{{- with .annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- $_ := set $ctx "extraLabels" .labels }}
labels: {{ include "vm.metaLabels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ .name }}
namespace: {{ include "vm.namespace" $ }}
type: Opaque
{{- with .data }}
data: {{- tpl . $ | nindent 2 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,28 @@
{{- $ctx := dict "helm" . }}
{{- range $name, $app := .Values }}
{{- if and (kindIs "map" $app) $app.enabled ($app.horizontalPodAutoscaler).enabled }}
{{- $isStatefulSet := or (eq $name "vmstorage") (eq $app.mode "statefulSet") }}
{{- $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: {{ include "vm.namespace" $ }}
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,51 @@
{{- $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 }}
{{- $_ := set $ctx "appKey" $name }}
{{ $fullname := include "vm.plain.fullname" $ctx }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- with $serviceMonitor.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
name: {{ $fullname }}
{{- with $serviceMonitor.namespace }}
namespace: {{ . }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ include "vm.namespace" $ }}
selector:
matchLabels: {{ include "vm.commonLabels" $ctx | nindent 6 }}
endpoints:
- port: http
{{- with $serviceMonitor.basicAuth }}
basicAuth: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $serviceMonitor.scheme }}
scheme: {{ . }}
{{- end }}
{{- with $serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with $serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with $serviceMonitor.tlsConfig }}
tlsConfig: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $serviceMonitor.relabelings }}
relabelings: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $serviceMonitor.metricRelabelings }}
metricRelabelings: {{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- 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,13 @@
{{- $app := .Values.vminsert }}
{{- if and $app.relabel.enabled (empty $app.relabel.configMap) }}
{{- $ctx := dict "helm" . "appKey" "vminsert" }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "vminsert.relabel.config.name" $ctx }}
namespace: {{ $ns }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
data:
relabel.yml: |{{- toYaml $app.relabel.config | nindent 4 }}
{{- end }}
@@ -0,0 +1,46 @@
{{- $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.timeouts }}
timeouts: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $route.filters }}
filters: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $route.matches }}
matches: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,60 @@
{{- $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:
{{- $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 }}
{{- with $service.trafficDistribution }}
trafficDistribution: {{ . }}
{{- end }}
{{- $portsTpl := printf "%s.ports" $name }}
{{- with include $portsTpl $app }}
ports: {{ . | nindent 4 }}
{{- 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,36 @@
{{- 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 $ctx "appKey" "vminsert" -}}
{{- $writeURL := urlParse (include "vm.url" $ctx) -}}
{{- $_ := set $writeURL "path" (printf "%s/insert" $writeURL.path) -}}
{{- $_ := set $ctx "appKey" "vmselect" -}}
{{- $readURL := urlParse (include "vm.url" $ctx) -}}
{{- $_ := 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.vmselect.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.vminsert.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,125 @@
{{- $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:
{{- with $app.podAnnotations }}
annotations: {{ toYaml . | nindent 8 }}
{{- end }}
{{- $_ := 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: {{ 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.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 (tpl $app.configSecretName $ctx) (empty $app.configSecretName) }}
{{- with $app.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "vm.license.volume" . | nindent 8 }}
{{- end }}
@@ -0,0 +1,168 @@
{{- $app := merge (deepCopy .Values.vminsert) (deepCopy .Values.common) -}}
{{- $_ := set .Values "vminsert" $app }}
{{- if $app.enabled -}}
{{- $ctx := dict "helm" . "appKey" "vminsert" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $relabelConfig := include "vminsert.relabel.config.name" $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: vminsert
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 "vminsert.args" $ctx | 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" "8480") }}
{{- with $app.extraArgs.clusternativeListenAddr }}
- name: cluster-tcp
protocol: TCP
containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
{{- end }}
{{- with $app.extraArgs.graphiteListenAddr }}
- name: graphite-tcp
protocol: TCP
containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
- name: graphite-udp
protocol: UDP
containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
{{- end }}
{{- with $app.extraArgs.influxListenAddr }}
- name: influx-tcp
protocol: TCP
containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
- name: influx-udp
protocol: UDP
containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
{{- end }}
{{- with $app.extraArgs.opentsdbHTTPListenAddr }}
- name: opentsdbhttp
protocol: TCP
containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
{{- end }}
{{- with $app.extraArgs.opentsdbListenAddr }}
- name: opentsdb-tcp
protocol: TCP
containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
- name: opentsdb-udp
protocol: UDP
containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
{{- 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 }}
{{- if or $app.extraVolumeMounts (include "vm.license.mount" .) $app.relabel.enabled }}
volumeMounts:
{{- if $app.relabel.enabled }}
- name: relabelconfig
mountPath: /relabelconfig
{{- end }}
{{- with $app.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- include "vm.license.mount" . | 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 }}
{{- if or (and (include "vm.license.secret.key" .) (include "vm.license.secret.name" .)) $app.extraVolumes $app.relabel.enabled }}
volumes:
{{- if $app.relabel.enabled }}
- name: relabelconfig
configMap:
name: {{ $relabelConfig }}
{{- end }}
{{- with $app.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "vm.license.volume" . | nindent 8 }}
{{- end }}
{{- end }}
@@ -0,0 +1,214 @@
{{- $storageName := "cache-volume" }}
{{- $app := merge (deepCopy .Values.vmselect) (deepCopy .Values.common) -}}
{{- $pvc := $app.persistentVolume }}
{{- $_ := set .Values "vmselect" $app }}
{{- $mode := $app.mode }}
{{- if and $mode $app.enabled (hasKey $app $mode) -}}
{{- $modeOpts := index $app $mode }}
{{- $ctx := dict "helm" . "appKey" "vmselect" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $sa := include "vm.fullname" . }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: apps/v1
kind: {{ title $mode }}
metadata:
name: {{ $fullname }}
namespace: {{ $ns }}
{{- $_ := set $ctx "extraLabels" $app.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
{{- with $app.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with $modeOpts.spec }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- if not $app.horizontalPodAutoscaler.enabled }}
replicas: {{ $app.replicaCount }}
{{- end }}
{{- if eq $mode "statefulSet" }}
serviceName: {{ $fullname }}
{{- end }}
selector:
matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 6 }}
template:
metadata:
{{- $_ := set $ctx "extraLabels" $app.podLabels }}
labels: {{ include "vm.podLabels" $ctx | nindent 8 }}
{{- $_ := unset $ctx "extraLabels" }}
{{- with $app.podAnnotations }}
annotations: {{ toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with $app.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- with $app.schedulerName }}
schedulerName: {{ . }}
{{- end }}
{{- if or (.Values.serviceAccount).name (.Values.serviceAccount).create }}
serviceAccountName: {{ tpl ((.Values.serviceAccount).name | default $sa) $ctx }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
{{- end }}
{{- if $app.podSecurityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.podSecurityContext "helm" .) | nindent 8 }}
{{- end }}
{{- with $app.initContainers }}
initContainers: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with ($app.imagePullSecrets | default .Values.global.imagePullSecrets) }}
imagePullSecrets: {{ toYaml . | nindent 8 }}
{{- end }}
containers:
- name: vmselect
{{- if $app.securityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
{{- end }}
image: {{ include "vm.image" $ctx }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- with $app.lifecycle }}
lifecycle: {{ . | toYaml | nindent 12 }}
{{- end }}
{{- with $app.containerWorkingDir }}
workingDir: {{ . }}
{{- end }}
args: {{ include "vmselect.args" $ctx | 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" "8481") }}
{{- with $app.extraArgs.clusternativeListenAddr }}
- name: cluster-tcp
protocol: TCP
containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
{{- 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:
- mountPath: {{ $app.cacheMountPath }}
name: {{ $storageName }}
{{- range $app.extraHostPathMounts }}
- name: {{ tpl .name $ctx }}
mountPath: {{ .mountPath }}
{{- with .subPath }}
subPath: {{ . }}
{{- end }}
{{- with .readOnly }}
readOnly: {{ . }}
{{- 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 }}
{{- with $app.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $app.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := . }}
- {{ toYaml $constraint | nindent 10 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 14 }}
{{- end }}
{{- end }}
{{- end }}
{{- with $app.affinity }}
affinity: {{ toYaml . | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: {{ $app.terminationGracePeriodSeconds }}
volumes:
{{- with $app.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or (eq $mode "deployment") (not $pvc.enabled) $pvc.existingClaim }}
- name: {{ $storageName }}
{{- if or (and (eq $mode "deployment") $pvc.enabled) $pvc.existingClaim }}
persistentVolumeClaim:
claimName: {{ $pvc.existingClaim | default $fullname }}
{{- else }}
emptyDir: {{ toYaml $app.emptyDir | nindent 12 }}
{{- end }}
{{- end }}
{{- include "vm.license.volume" . | nindent 8 }}
{{- if and (eq $mode "statefulSet") $pvc.enabled (not $pvc.existingClaim) }}
volumeClaimTemplates:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ tpl $pvc.name $ctx | default $storageName }}
{{- 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 }}
{{- if and $pvc.enabled (not $pvc.existingClaim) (eq $app.mode "deployment") }}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ tpl $pvc.name $ctx | default $fullname }}
namespace: {{ $ns }}
{{- $_ := set $ctx "extraLabels" $pvc.extraLabels }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
{{- $_ := unset $ctx "extraLabels" }}
{{- with $pvc.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with $pvc.accessModes }}
accessModes: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with $pvc.volumeAttributeClassName }}
volumeAttributesClassName: {{ . }}
{{- end }}
resources:
requests:
storage: {{ $pvc.size }}
{{- with $pvc.storageClassName }}
storageClassName: {{ . }}
{{- end }}
{{- with $pvc.matchLabels }}
selector:
matchLabels: {{ toYaml . | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,292 @@
{{- $app := merge (deepCopy .Values.vmstorage) (deepCopy .Values.common) -}}
{{- $pvc := $app.persistentVolume }}
{{- $_ := set .Values "vmstorage" $app }}
{{- if $app.enabled -}}
{{- $ctx := dict "helm" . "appKey" "vmstorage" }}
{{- $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.schedulerName }}
schedulerName: {{ . }}
{{- end }}
{{- $manager := $app.vmbackupmanager }}
{{- if or $app.initContainers $manager.restore.onStart.enabled }}
initContainers:
{{- with $app.initContainers -}}
{{- toYaml . | nindent 8 }}
{{- end -}}
{{- if $manager.restore.onStart.enabled }}
{{- include "vm.enterprise.only" . }}
- name: vmbackupmanager-restore
{{- $_ := set $ctx "appKey" (list "vmstorage" "vmbackupmanager") }}
image: {{ include "vm.image" $ctx }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- if $app.securityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
{{- end }}
args: {{ include "vmbackupmanager.restore.args" $ctx | nindent 12 }}
{{- with $manager.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
{{- with $manager.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: manager-http
containerPort: 8300
volumeMounts:
- name: vmstorage-volume
mountPath: {{ $pvc.mountPath }}
subPath: {{ $pvc.subPath }}
{{- range $manager.extraSecretMounts }}
- name: {{ tpl .name $ctx }}
mountPath: {{ .mountPath }}
subPath: {{ .subPath }}
{{- end }}
{{- end }}
{{- end }}
{{- with ($app.imagePullSecrets | default .Values.global.imagePullSecrets) }}
imagePullSecrets: {{ toYaml . | nindent 8 }}
{{- end }}
containers:
- name: vmstorage
{{- $_ := set $ctx "appKey" "vmstorage" }}
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 "vmstorage.args" $ctx | nindent 12 }}
ports:
- name: {{ $app.ports.name | default "http" }}
containerPort: {{ include "vm.port.from.flag" (dict "flag" $app.extraArgs.httpListenAddr "default" "8482") }}
- name: vminsert
containerPort: 8400
- name: vmselect
containerPort: 8401
{{- with $app.envFrom }}
envFrom: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with $app.env }}
env: {{ toYaml . | 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: {{ tpl .name $ctx }}
mountPath: {{ .mountPath }}
{{- with .subPath }}
subPath: {{ . }}
{{- end }}
{{- end }}
{{- range $app.extraHostPathMounts }}
- name: {{ tpl .name $ctx }}
mountPath: {{ .mountPath }}
{{- with .subPath }}
subPath: {{ . }}
{{- end }}
{{- with .readOnly }}
readOnly: {{ . }}
{{- end }}
{{- end }}
{{- range $app.extraConfigmapMounts }}
- name: {{ $app.name }}-{{ .name }}
mountPath: {{ .mountPath }}
{{- with .subPath }}
subPath: {{ . }}
{{- end }}
{{- with .readOnly }}
readOnly: {{ . }}
{{- end }}
{{- end }}
{{- range $app.extraSecretMounts }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
{{- with .subPath }}
subPath: {{ . }}
{{- end }}
{{- with .readOnly }}
readOnly: {{ . }}
{{- end }}
{{- end }}
{{- with $app.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- include "vm.license.mount" . | nindent 12 }}
{{- if $manager.enabled }}
{{- include "vm.enterprise.only" . }}
- name: vmbackupmanager
{{- $_ := set $ctx "appKey" (list "vmstorage" "vmbackupmanager") }}
image: {{ include "vm.image" $ctx }}
imagePullPolicy: {{ $app.image.pullPolicy }}
{{- if $app.securityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
{{- end }}
args: {{ include "vmbackupmanager.args" $ctx | nindent 12 }}
{{- with $manager.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with (fromYaml (include "vm.probe" (dict "app" $manager "type" "readiness"))) }}
readinessProbe: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with (fromYaml (include "vm.probe" (dict "app" $manager "type" "liveness"))) }}
livenessProbe: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with (fromYaml (include "vm.probe" (dict "app" $manager "type" "startup"))) }}
startupProbe: {{ toYaml . | nindent 12 }}
{{- end }}
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
{{- with $manager.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: manager-http
containerPort: 8300
volumeMounts:
{{- with $pvc }}
- name: {{ tpl .name $ctx }}
mountPath: {{ .mountPath }}
{{- with .subPath }}
subPath: {{ . }}
{{- end }}
{{- end }}
{{- range $manager.extraSecretMounts }}
- name: {{ tpl .name $ctx }}
mountPath: {{ .mountPath }}
{{- with .subPath }}
subPath: {{ . }}
{{- end }}
{{- with .readOnly }}
readOnly: {{ . }}
{{- end }}
{{- end }}
{{- include "vm.license.mount" . | 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 }}
{{- if or $app.extraVolumes (not $pvc.enabled) $pvc.existingClaim (include "vm.license.volume" .) }}
volumes:
{{- with $app.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or (not $pvc.enabled) $pvc.existingClaim }}
- name: vmstorage-volume
{{- if $pvc.enabled }}
persistentVolumeClaim:
claimName: {{ $pvc.existingClaim }}
{{- else }}
emptyDir: {{ toYaml $app.emptyDir | nindent 12 }}
{{- end }}
{{- end }}
{{- include "vm.license.volume" . | 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,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 := or (eq $name "vmstorage") (eq $app.mode "statefulSet") }}
{{- $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 }}
@@ -0,0 +1,58 @@
# Example extra values files to add an auth proxy sidecar container
---
extraContainers: &extraContainers
- name: vmauth
securityContext:
{}
image: "victoriametrics/vmauth:latest"
workingDir: /
args:
- -auth.config=/config/auth.yml
- -envflag.enable=true
- -envflag.prefix=VM_
- -loggerFormat=json
imagePullPolicy: IfNotPresent
ports:
- name: proxy
containerPort: 8427
readinessProbe:
httpGet:
path: /health
port: proxy
initialDelaySeconds: 5
periodSeconds: 15
livenessProbe:
tcpSocket:
port: proxy
initialDelaySeconds: 5
periodSeconds: 15
timeoutSeconds: 5
volumeMounts:
- name: auth-config
mountPath: /config
resources:
{}
vminsert:
extraContainers: *extraContainers
extraVolumes:
- name: auth-config
secret:
secretName: vminsert-auth-config
service:
extraPorts:
- name: proxy
port: 8427
targetPort: proxy
vmselect:
extraContainers: *extraContainers
extraVolumes:
- name: auth-config
secret:
secretName: vmselect-auth-config
service:
extraPorts:
- name: proxy
port: 8427
targetPort: proxy
File diff suppressed because it is too large Load Diff