Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VMAlert] cr.spec.Notifier, cr.spec.notifierConfigRef and discovered alertmanager are empty prevent using flag notifier.blackhole #811

Closed
tantm3 opened this issue Nov 22, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@tantm3
Copy link

tantm3 commented Nov 22, 2023

I am currently using the VictoriaMetrics Operator version: victoria-metrics-k8s-stack-0.18.6.
I want to deploy VMAlert just for using recording rule so I don't need to configure the spec.notifier and I used spec.extraArgs to enable flag notifier.blackhole: "true".
The configuration file looks like this:

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAlert
metadata:
  name: vmalert-vm-k8s
  namespace: monitoring
spec:
  datasource:
    url: "http://vmselect-vm-k8s-victoria-metrics-k8s-stack.monitoring:8481/select/0/prometheus"
  remoteWrite:
    url: "http://vminsert-vm-k8s-victoria-metrics-k8s-stack.monitoring:8480/insert/0/prometheus"
  remoteRead:
    url: "http://vmselect-vm-k8s-victoria-metrics-k8s-stack.monitoring:8481/select/0/prometheus"
  evaluationInterval: "30s"
  ruleSelector:
    matchLabels:
     metric: "true"
  ruleNamespaceSelector: 
    matchLabels:
      kubernetes.io/metadata.name: monitoring
  # for accessing to vmalert via vmauth with path prefix
  extraArgs:
    http.pathPrefix: /vmalert
    notifier.blackhole: "true"

It seems like we have a bug here.
We can not left the cr.spec.Notifier, cr.spec.notifierConfigRef empty If we do the operator can not create VMAlert pod.
But when you enter a random URL just like in the configuration file above, the VMAlert pod shows error:

2023-11-22T08:42:55.943Z	fatal	VictoriaMetrics/app/vmalert/main.go:170	failed to init: failed to init notifier: only one of -notifier.blackhole, -notifier.url and -notifier.config flags must be specified
@Haleygo Haleygo added the bug Something isn't working label Nov 22, 2023
@Haleygo
Copy link
Contributor

Haleygo commented Nov 22, 2023

We should allow notifier and notifiers both to be empty at the first place, since vmalert only needs -notifier.url when there is alerting rules and operator can't check that.

@Haleygo
Copy link
Contributor

Haleygo commented Dec 13, 2023

Should be fixed since 0.39.4, close as completed.

@Haleygo Haleygo closed this as completed Dec 13, 2023
@tantm3
Copy link
Author

tantm3 commented Dec 13, 2023

Thank @Haleygo for your support!

@iPapanya
Copy link

iPapanya commented Mar 8, 2024

@Haleygo Hi! I have the same problem. After updating victoria-metrics-k8s-stack to chart version 0.19.4 with app version v1.99.0 get error message on vmalert
2024-03-08T05:32:06.703Z fatal VictoriaMetrics/app/vmalert/main.go:162 failed to init: failed to init notifier: only one of -notifier.blackhole, -notifier.url and -notifier.config flags must be specified
and I see in pods args

-datasource.url=http://vmsingle-vm-victoria-metrics-k8s-stack.vm.svc:8429/
-evaluationInterval=30s
-external.label=cloud=npe
-external.label=cluster=k8s-pcidss-dev
-httpListenAddr=:8080
-notifier.blackhole=true
-notifier.url=
-remoteRead.url=http://vmsingle-vm-victoria-metrics-k8s-stack.vm.svc:8429/
-remoteWrite.disablePathAppend=true
-remoteWrite.url=http://vmagent-vm-victoria-metrics-k8s-stack.vm.svc:8429/api/v1/write
-rule="/etc/vmalert/config/vm-vm-victoria-metrics-k8s-stack-rulefiles-0/*.yaml"

but in chart I don't write notifier.url arg

my values

vmalert:
  annotations: {}
  enabled: true

  # Controls whether VMAlert should use VMAgent or VMInsert as a target for remotewrite
  remoteWriteVMAgent: true
  # spec for VMAlert crd
  # https://docs.victoriametrics.com/operator/api.html#vmalertspec
  spec:
    selectAllByDefault: true
    image:
      tag: v1.99.0
    evaluationInterval: 30s
    resources:
      limits:
        cpu: "1"
      requests:
        cpu: "600m"
    nodeSelector:
      node-role: victoria-metrics
    tolerations:
      - key: "node-role"
        operator: "Equal"
        value: "victoria-metrics"
        effect: "NoSchedule"
    extraArgs:
      notifier.blackhole: "true"

@tantm3
Copy link
Author

tantm3 commented Mar 8, 2024

Hi @iPapanya!
Could you check again the version of the victoriametrics-operator and make sure it's equal 0.39.4 or higher than that?
It's seem like here docker.io/victoriametrics/operator:v0.39.1

@zekker6
Copy link
Contributor

zekker6 commented Mar 8, 2024

@tantm3 @iPapanya Seems like this issue is the same as #894 (comment). It was fixed in #895 and will be released as a part of the next release.

@iPapanya
Copy link

iPapanya commented Mar 8, 2024

Hi @iPapanya! Could you check again the version of the victoriametrics-operator and make sure it's equal 0.39.4 or higher than that? It's seem like here docker.io/victoriametrics/operator:v0.39.1

victoriametrics/operator:v0.41.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants