Skip to content

Commit

Permalink
vmanomaly: added extra volumes, extra volumesMounts, PDB and PodMonit…
Browse files Browse the repository at this point in the history
…or (#1320)

* vmanomaly: added PDB and PodMonitor

* added extravolumes and extravolumemounts

* bump version
  • Loading branch information
AndrewChubatiuk authored Aug 26, 2024
1 parent 0c6c3a5 commit e6f2435
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 25 deletions.
1 change: 1 addition & 0 deletions charts/victoria-metrics-anomaly/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Fixed image pull secrets. See [this issue](https://github.com/VictoriaMetrics/helm-charts/issues/1285)
- Renamed `.Values.persistentVolume.storageClass` to `.Values.persistentVolume.storageClassName`
- Removed necessity to set `.Values.persistentVolume.existingClaim` when it should be created by chart. See [this issue](https://github.com/VictoriaMetrics/helm-charts/issues/189)
- Added PDB, PodMonitor, extra volumes and extra volumeMounts

## 1.4.1

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.1
appVersion: v1.15.4
version: 1.4.2
appVersion: v1.15.6
sources:
- https://github.com/VictoriaMetrics/helm-charts
icon: https://avatars.githubusercontent.com/u/43720803?s=200&v=4
Expand Down
8 changes: 4 additions & 4 deletions charts/victoria-metrics-anomaly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ Change the values according to the need of the environment in ``victoria-metrics
| persistentVolume.size | string | `"1Gi"` | Size of the volume. Should be calculated based on the metrics you send and retention policy you set. |
| persistentVolume.storageClassName | string | `""` | StorageClass to use for persistent volume. Requires server.persistentVolume.enabled: true. If defined, PVC created automatically |
| podAnnotations | object | `{}` | Annotations to be added to pod |
| podDisruptionBudget | object | `{"enabled":false,"labels":{}}` | See `kubectl explain poddisruptionbudget.spec` for more. Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ |
| podDisruptionBudget | object | `{"enabled":false,"labels":{},"maxUnavailable":1,"minAvailable":1}` | See `kubectl explain poddisruptionbudget.spec` for more. Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ |
| podMonitor.annotations | object | `{}` | |
| podMonitor.enabled | bool | `false` | |
| podMonitor.extraLabels | object | `{}` | |
| podSecurityContext.enabled | bool | `true` | |
| resources | object | `{}` | |
| securityContext.enabled | bool | `true` | |
Expand All @@ -170,7 +173,4 @@ Change the values according to the need of the environment in ``victoria-metrics
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `nil` | |
| serviceMonitor.annotations | object | `{}` | |
| serviceMonitor.enabled | bool | `false` | |
| serviceMonitor.extraLabels | object | `{}` | |
| tolerations | list | `[]` | Tolerations configurations. Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ |
7 changes: 1 addition & 6 deletions charts/victoria-metrics-anomaly/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,4 @@ metadata:
namespace: {{ .Release.Namespace }}
labels: {{- include "chart.labels" . | nindent 4 }}
data:
config.yml: |
{{ with .Values.config }}
{{- . | toYaml | nindent 4}}
{{ end -}}
config.yml: |{{ toYaml (.Values.config | default dict) | nindent 4 }}
6 changes: 6 additions & 0 deletions charts/victoria-metrics-anomaly/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ spec:
- name: models-dump
mountPath: /tmp/vmanomaly-model-dumps
{{- end }}
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -99,6 +102,9 @@ spec:
{{- else }}
emptyDir: {{ toYaml .Values.emptyDir | nindent 12 }}
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and .Values.persistentVolume.enabled (not .Values.persistentVolume.existingClaim) }}
volumeClaimTemplates:
- apiVersion: v1
Expand Down
18 changes: 18 additions & 0 deletions charts/victoria-metrics-anomaly/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ template "chart.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- $ctx := merge (deepCopy .) (dict "extraLabels" .Values.podDisruptionBudget.extraLabels) }}
labels: {{ include "chart.labels" $ctx | nindent 4 }}
spec:
{{- with .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ . }}
{{- end }}
{{- with .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
selector:
matchLabels: {{ include "chart.selectorLabels" . | nindent 6 }}
{{- end }}
44 changes: 44 additions & 0 deletions charts/victoria-metrics-anomaly/templates/pod-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{- if .Values.podMonitor.enabled -}}
{{- $podMonitor := .Values.podMonitor -}}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
{{- with $podMonitor.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- $ctx := merge (deepCopy .) (dict "extraLabels" $podMonitor.extraLabels) }}
labels: {{ include "chart.labels" $ctx | nindent 4 }}
name: {{ template "chart.fullname" . }}
{{- with $podMonitor.namespace }}
namespace: {{ . }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels: {{ include "chart.selectorLabels" . | nindent 6 }}
podMetricsEndpoints:
- port: metrics
{{- with $podMonitor.basicAuth }}
basicAuth: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $podMonitor.scheme }}
scheme: {{ . }}
{{- end }}
{{- with $podMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with $podMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with $podMonitor.tlsConfig }}
tlsConfig: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $podMonitor.relabelings }}
relabelings: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $podMonitor.metricRelabelings }}
metricRelabelings: {{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
23 changes: 12 additions & 11 deletions charts/victoria-metrics-anomaly/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ serviceAccount:
# -- See `kubectl explain poddisruptionbudget.spec` for more. Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
podDisruptionBudget:
enabled: false
# minAvailable: 1
# maxUnavailable: 1
minAvailable: 1
maxUnavailable: 1
labels: {}

extraArgs:
Expand All @@ -56,26 +56,27 @@ extraHostPathMounts: []
# mountPath: /etc/kubernetes/certs
# subPath: ""
# hostPath: /etc/kubernetes/certs
# readOnly: true
# readOnly: true

# -- Extra Volumes for the pod
extraVolumes: []

# - name: example
# configMap:
# name: example
# name: example

# -- Extra Volume Mounts for the container
extraVolumeMounts: []
# - name: example
# mountPath: /example
# mountPath: /example

extraContainers: []
# - name: config-reloader
# image: reloader-image
# image: reloader-image

podSecurityContext:
enabled: true
# fsGroup: 2000
# fsGroup: 2000

## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
securityContext:
Expand All @@ -94,7 +95,7 @@ resources: {}
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# memory: 128Mi

# -- Annotations to be added to the deployment
annotations: {}
Expand All @@ -109,13 +110,13 @@ nodeSelector: {}
tolerations: []
# - key: "key"
# operator: "Equal|Exists"
# value: "value"
# effect: "NoSchedule|PreferNoSchedule"
# value: "value"
# effect: "NoSchedule|PreferNoSchedule"

# -- Affinity configurations
affinity: {}

serviceMonitor:
podMonitor:
enabled: false
extraLabels: {}
annotations: {}
Expand Down
2 changes: 0 additions & 2 deletions hack/helm/victoria-metrics-anomaly/e2e/simple.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ 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/

monitoring:
pull:
enabled: true
Expand All @@ -23,7 +22,6 @@ config:
url: "http://cluster-victoria-metrics-cluster-vminsert.default.svc.cluster.local:8480/insert/"
extra_labels:
job: "vmanomaly"

license:
secret:
name: "vmanomaly-license"
Expand Down
4 changes: 4 additions & 0 deletions hack/helm/victoria-metrics-anomaly/lint/simple.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
podMonitor:
enabled: true
podDisruptionBudget:
enabled: true
eula: true
config:
schedulers:
Expand Down

0 comments on commit e6f2435

Please sign in to comment.