Skip to content

Commit

Permalink
controllers/factory/vmalert: do not add notifier.* flags if notifier.…
Browse files Browse the repository at this point in the history
…blackhole is set by user

Previously, setting "notifier.blackhole" and not using any notifiers would lead to CrashLoopBackoff because vmalert would receive an empty "notifier.url" value.

Updates:
- #894
- #813
  • Loading branch information
zekker6 authored and f41gh7 committed Mar 7, 2024
1 parent 403a78a commit 9caa896
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controllers/factory/vmalert.go
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,12 @@ func BuildNotifiersArgs(cr *victoriametricsv1beta1.VMAlert, ntBasicAuth map[stri
return append(finalArgs, fmt.Sprintf("-notifier.config=%s/%s", notifierConfigMountPath, cr.Spec.NotifierConfigRef.Key))
}

if _, ok := cr.Spec.ExtraArgs["notifier.blackhole"]; ok {
// notifier.blackhole disables sending notifications completely, so we don't need to add any notifier args
// also no need to add notifier.blackhole to args as it will be added with ExtraArgs
return finalArgs
}

url := remoteFlag{flagSetting: "-notifier.url=", isNotNull: true}
authUser := remoteFlag{flagSetting: "-notifier.basicAuth.username="}
authPasswordFile := remoteFlag{flagSetting: "-notifier.basicAuth.passwordFile="}
Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ aliases:

## Next release

- [vmalert](./api.md#vmalert): do not add `notifiers.*` flags in case `notifier.blackhole` is provided via `spec.extraArgs`. See [this issue](https://github.com/VictoriaMetrics/operator/issues/894) for details.

<a name="v0.42.2"></a>
## [v0.42.](https://github.com/VictoriaMetrics/operator/releases/tag/v0.42.2) - 6 Mar 2024

Expand Down

0 comments on commit 9caa896

Please sign in to comment.