VictoriaMetrics / operator

Kubernetes operator for Victoria Metrics
Apache License 2.0
422 stars 140 forks source link

alertmanager templates error #868

Closed KKulishov closed 7 months ago

KKulishov commented 7 months ago

Hi! I have operator to v 0.39.3

image: victoriametrics/operator:v0.39.3

I'm trying to use the example from the documentation

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAlertmanager
metadata:
  name: example-alertmanager
  namespace: monitoring
spec:
  replicaCount: 2
  templates:
    - Name: alertmanager-templates
      Key: my-template-1.tmpl
    - Name: alertmanager-templates
      Key: my-template-2.tmpl
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: alertmanager-templates
  namespace: monitoring
data:
    my-template-1.tmpl: |
        {{ define "hello" -}}
        hello, Victoria!
        {{- end }}
    my-template-2.tmpl: """

and I get an error

error: error validating "test.yaml": error validating data: [ValidationError(VMAlertmanager.spec.templates[0]): unknown field "Key" in com.victoriametrics.operator.v1beta1.VMAlertmanager.spec.templates, ValidationError(VMAlertmanager.spec.templates[0]): unknown field "Name" in com.victoriametrics.operator.v1beta1.VMAlertmanager.spec.templates, ValidationError(VMAlertmanager.spec.templates[0]): missing required field "key" in com.victoriametrics.operator.v1beta1.VMAlertmanager.spec.templates, ValidationError(VMAlertmanager.spec.templates[1]): unknown field "Key" in com.victoriametrics.operator.v1beta1.VMAlertmanager.spec.templates, ValidationError(VMAlertmanager.spec.templates[1]): unknown field "Name" in com.victoriametrics.operator.v1beta1.VMAlertmanager.spec.templates, ValidationError(VMAlertmanager.spec.templates[1]): missing required field "key" in com.victoriametrics.operator.v1beta1.VMAlertmanager.spec.templates]; if you choose to ignore these errors, turn validation off with --validate=false

Can you tell me what the problem might be?

f41gh7 commented 7 months ago

Hello, an issue with capital letters at Key and Name fields. Thanks for reporting, we'll fix examples.

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAlertmanager
metadata:
  name: example-alertmanager
  namespace: monitoring
spec:
  replicaCount: 2
  templates:
    - name: alertmanager-templates
      key: my-template-1.tmpl
    - name: alertmanager-templates
      key: my-template-2.tmpl
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: alertmanager-templates
  namespace: monitoring
data:
    my-template-1.tmpl: |
        {{ define "hello" -}}
        hello, Victoria!
        {{- end }}
    my-template-2.tmpl: """
KKulishov commented 7 months ago

Thank you!