Closed mariapoliss closed 1 month ago
Hello, thanks for reporting!
Issue related to the name clash of configSecret and secret created by operator itself. Operator builds the following name for own secret: vmalertmanager-%CR_NAME-config
. And it may clash with exist secret.
an example of config with bug:
apiVersion: v1
kind: Secret
metadata:
name: vmalertmanager-example-config
labels:
app: vm-operator
type: Opaque
stringData:
alertmanager.yaml: |
global:
resolve_timeout: 5m
route:
receiver: 'blachole'
receivers:
- name: 'blachole'
---
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAlertmanager
metadata:
name: example
spec:
replicaCount: 1
configSecret: vmalertmanager-example-config
selectAllByDefault: true
I think, proper fix for it is ignoring any content of secret, if it's name matches the name of secret created by operator.
Will be fixed at the next patch release
Thank you for fast response!
One more detail: I set configSecret
in my custom resource VMAlertManager (not default secret name).
And the fix that is proposed now won`t resolve the problem in the case if I set secret name.
Thank you for fast response!
One more detail: I set
configSecret
in my custom resource VMAlertManager (not default secret name). And the fix that is proposed now won`t resolve the problem in the case if I set secret name.
You have to set value of configSecret
to the different name, it must solve issue. Linked PR must resolve it.
Thanks for the test case, added it to the PR.
Hello!
I found a problem with updating Secret with VM Alert Manager config. I deployed the last release version v0.44.0 for this moment. For example, if I create VMAlertManagerConfig like this:
Victoria Metrics operator watches for
test-amc
, updates secret with name set in VMAlertManager (spec.configSecret) and makes it every reconcile cycle.After updating the secret I see duplicated values (receivers, inhibit_rules and route.routes) in secret data
alertmanager.yaml
:Seems like rootcause is in function
buildConfig
https://github.com/VictoriaMetrics/operator/blob/v0.44.0/controllers/factory/alertmanager/config.go#L55. There is no check for duplicates in existing receivers, inhibit rules and subroutes.Finally, I see error logs in vmalertmanager:
and in the operator after some time (several hours), because secret has too many duplicated values:
I created a test to check the behavior locally. The problem reproduces again.
alertmanager_test.zip
Could you please investigate and fix the problem?