Skip to content

vmlertmanagerconfig: make optional route and receivers#1805

Closed
AndrewChubatiuk wants to merge 2 commits intomasterfrom
vmalertmanagerconfig-optional-route-and-receivers
Closed

vmlertmanagerconfig: make optional route and receivers#1805
AndrewChubatiuk wants to merge 2 commits intomasterfrom
vmalertmanagerconfig-optional-route-and-receivers

Conversation

@AndrewChubatiuk
Copy link
Contributor

@AndrewChubatiuk AndrewChubatiuk commented Feb 16, 2026

fixes #1800
additionally fixed removed deletionTimestamp check from PodIsready function. Execution of this function should be skipped in case of pod which is being deleted


Summary by cubic

Make VMAlertmanagerConfig.spec.route and .receivers optional to support minimal configs (e.g., only inhibition rules) and align with Prometheus Operator. Improves rollout/readiness by skipping terminating pods, filtering to StatefulSet-owned pods, and hardening waitForPodReady; fixes #1800.

  • Bug Fixes
    • API/CRD: mark route, receivers, and route.routes optional; validate only when a route exists; require a non-empty root receiver if route is set; enforce unique receiver names; update docs.
    • Config/Conversion: handle nil route/receivers; build route only when present; pre-convert Prometheus route and fail fast.
    • Rollouts/Readiness: skip terminating pods; filter to StatefulSet-owned pods; fix waitForPodReady pod retrieval and error reporting; verify desired revision.
    • Finalizers: remove VPA objects only when the VPA API is enabled (cluster and vmauth).

Written for commit 2fa4b84. Summary will update on new commits.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 9 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="api/operator/v1beta1/vmalertmanagerconfig_types.go">

<violation number="1" location="api/operator/v1beta1/vmalertmanagerconfig_types.go:133">
P2: Root routes without a receiver now pass validation, but Alertmanager requires a default receiver on the root route. This can lead to config rejection at runtime. Enforce a non-empty root receiver when Route is provided.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@AndrewChubatiuk AndrewChubatiuk force-pushed the vmalertmanagerconfig-optional-route-and-receivers branch 15 times, most recently from 9f78b42 to 339425c Compare February 16, 2026 19:12

// ConvertAlertmanagerConfig creates VMAlertmanagerConfig from prometheus alertmanagerConfig
func ConvertAlertmanagerConfig(promAMCfg *promv1alpha1.AlertmanagerConfig, conf *config.BaseOperatorConf) (*vmv1beta1.VMAlertmanagerConfig, error) {
convertedRoute, err := convertPromRoute(promAMCfg.Spec.Route)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convertPromRoute returns nil, nil when Route is unset, but VMAlertmanagerConfigSpec later requires a valid Route.

I think we should throw an error here / update convertPromRoute

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

route should be valid only if it exists, unset route is allowed

@AndrewChubatiuk AndrewChubatiuk force-pushed the vmalertmanagerconfig-optional-route-and-receivers branch 2 times, most recently from e92da2c to 0017fb7 Compare February 17, 2026 19:04
@vrutkovs vrutkovs force-pushed the vmalertmanagerconfig-optional-route-and-receivers branch from 0017fb7 to 81a885b Compare February 18, 2026 10:42
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func isSTSPod(pod *corev1.Pod) bool {
func isOwnedBySTS(pod *corev1.Pod) bool {

return false
}

func filterSTSPods(pods []corev1.Pod, revision string, minReadySeconds int32, recreate bool) ([]corev1.Pod, []corev1.Pod, []corev1.Pod) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a few unit tests here - I'm concerned about some pods ending up on both readyPods and podsForUpdate list, which would break the expected total calculation

@AndrewChubatiuk AndrewChubatiuk force-pushed the vmalertmanagerconfig-optional-route-and-receivers branch from 8497186 to 2fa4b84 Compare February 18, 2026 11:57
@AndrewChubatiuk
Copy link
Contributor Author

closing this PR as changes from it were merged in #1816 (rebased it against this branch and expected it to be merged first), will address rest of comments here

@AndrewChubatiuk AndrewChubatiuk deleted the vmalertmanagerconfig-optional-route-and-receivers branch February 18, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can VMAlertmangerConfig support defining only inhibit rules as part of global config like Prometheus Alertmanager does?

2 participants

Comments