Skip to content

Commit

Permalink
charts/victoria-metrics-anomaly: update vmanomaly, bugfixes (#1550)
Browse files Browse the repository at this point in the history
- update vmanomaly to 1.16.1
- update configuration for testing to be able to run vmanomaly
- fix configuration templating
- add option to dump models and data
  • Loading branch information
zekker6 authored Oct 3, 2024
1 parent 9ac71b5 commit 2ca80af
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
5 changes: 4 additions & 1 deletion charts/victoria-metrics-anomaly/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## Next release

- TODO
- Upgraded vmanomaly to [1.16.1](https://docs.victoriametrics.com/anomaly-detection/changelog/#v1161)
- Added the ability to enable persistence for models and data via `.Values.persistentVolume.dumpModels` and `.Values.persistentVolume.dumpData` variables respectively.
- Fix default `podSecurityContext` configuration to ensure fs group matches container user.
- Fix passing empty `tenant_id` in case tenant is not defined in values.

## 1.4.6

Expand Down
4 changes: 2 additions & 2 deletions charts/victoria-metrics-anomaly/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
type: application
name: victoria-metrics-anomaly
description: Victoria Metrics Anomaly Detection - a service that continuously scans Victoria Metrics time series and detects unexpected changes within data patterns in real-time.
version: 1.4.6
appVersion: v1.15.9
version: 1.5.0
appVersion: v1.16.1
sources:
- https://github.com/VictoriaMetrics/helm-charts
icon: https://avatars.githubusercontent.com/u/43720803?s=200&v=4
Expand Down
7 changes: 7 additions & 0 deletions charts/victoria-metrics-anomaly/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{{- if not .Values.config.reader.tenant_id -}}
{{- $ := unset .Values.config.reader "tenant_id" }}
{{- end -}}
{{- if not .Values.config.writer.tenant_id -}}
{{- $ := unset .Values.config.writer "tenant_id" }}
{{- end -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
9 changes: 6 additions & 3 deletions charts/victoria-metrics-anomaly/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ spec:
envFrom: {{ toYaml . | nindent 12 }}
{{- end }}
{{- $env := default list }}
{{- if .Values.persistentVolume.enabled }}
{{- $env = append $env (dict "name" "VMANOMALY_MODEL_DUMPS_DIR" "value" "/tmp/vmanomaly-model-dumps") }}
{{- if and .Values.persistentVolume.enabled .Values.persistentVolume.dumpModels }}
{{- $env = append $env (dict "name" "VMANOMALY_MODEL_DUMPS_DIR" "value" "/tmp/vmanomaly-storage/models") }}
{{- end }}
{{- if and .Values.persistentVolume.enabled .Values.persistentVolume.dumpData }}
{{- $env = append $env (dict "name" "VMANOMALY_DATA_DUMPS_DIR" "value" "/tmp/vmanomaly-storage/data") }}
{{- end }}
{{- with (concat $env (.Values.env | default list)) }}
env: {{ toYaml . | nindent 12 }}
Expand All @@ -74,7 +77,7 @@ spec:
{{- include "vm.license.mount" . | nindent 12 }}
{{- if .Values.persistentVolume.enabled }}
- name: models-dump
mountPath: /tmp/vmanomaly-model-dumps
mountPath: /tmp/vmanomaly-storage
{{- end }}
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
Expand Down
9 changes: 7 additions & 2 deletions charts/victoria-metrics-anomaly/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ image:
# -- Victoria Metrics anomaly Docker repository and image name
repository: victoriametrics/vmanomaly
# -- Tag of Docker image
tag: v1.15.9 # rewrites Chart.AppVersion
tag: v1.16.1 # rewrites Chart.AppVersion
# -- Pull policy of Docker image
pullPolicy: IfNotPresent

Expand Down Expand Up @@ -85,7 +85,7 @@ extraContainers: []
# -- Pod's security context. Details are [here](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
podSecurityContext:
enabled: true
# fsGroup: 2000
fsGroup: 1000

# -- Check [here](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for details.
securityContext:
Expand Down Expand Up @@ -184,6 +184,11 @@ persistentVolume:
# -- Create/use Persistent Volume Claim for models dump.
enabled: false

# -- Enables dumping models to persistence disk. This is helpful to reduce memory usage.
dumpModels: true
# -- Enables dumpling data which is fetched from VictoriaMetrics to persistence disk. This is helpful to reduce memory usage.
dumpData: true

# -- Array of access modes. Must match those of existing PV or dynamic provisioner. Details are [here](http://kubernetes.io/docs/user-guide/persistent-volumes/)
accessModes:
- ReadWriteOnce
Expand Down
8 changes: 8 additions & 0 deletions hack/helm/victoria-metrics-anomaly/e2e/simple.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
config:
preset: "default"
models:
model_univariate_1:
class: 'zscore'
z_threshold: 2.5
reader:
datasource_url: http://cluster-victoria-metrics-cluster-vmselect.default.svc.cluster.local:8481/select/
tenant_id: "123"
queries:
active_timeseries:
expr: 'sum(vm_cache_entries{type="storage/hour_metric_ids"})'
Expand All @@ -14,12 +20,14 @@ config:
expr: 'sum(rate(vm_slow_row_inserts_total[5m])) / sum(rate(vm_rows_inserted_total[5m]))'
writer:
datasource_url: http://cluster-victoria-metrics-cluster-vminsert.default.svc.cluster.local:8480/insert/
tenant_id: "123"
monitoring:
pull:
enabled: true
port: 8440
push:
url: http://cluster-victoria-metrics-cluster-vminsert.default.svc.cluster.local:8480/insert/
tenant_id: "0"
extra_labels:
job: vmanomaly
license:
Expand Down
2 changes: 2 additions & 0 deletions hack/helm/victoria-metrics-anomaly/lint/simple.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ license:
secret:
name: license
key: key
persistentVolume:
enabled: true
config:
schedulers:
oneoff_scheduler_alias:
Expand Down

0 comments on commit 2ca80af

Please sign in to comment.