fix(kubernetes): gate vmop cert-manager-crds dependency on certManager.enabled - #3130
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a dependency issue where the victoria-metrics-operator HelmRelease would fail to reconcile when cert-manager was disabled. By gating the cert-manager-crds dependency on the certManager configuration toggle, the operator can now successfully reach a Ready state in environments where cert-manager is not deployed, preventing a cascade of failures in the dependent monitoring and autoscaling stack. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe Victoria Metrics Operator HelmRelease now conditionally includes the cert-manager-crds dependency based on ChangesVictoria Metrics Operator dependency gating
Estimated code review effort: 2 (Simple) | ~5 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request gates the cert-manager-crds dependency in the victoria-metrics-operator HelmRelease on the addons.certManager.enabled value. It also introduces a comprehensive test suite to verify that the dependency is correctly included or excluded based on this setting. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…r.enabled
The victoria-metrics-operator HelmRelease is gated on
monitoringAgents.enabled but listed cert-manager-crds in dependsOn
unconditionally, while the cert-manager-crds HelmRelease is only
created when certManager.enabled is true. The valid combination
monitoringAgents.enabled=true + certManager.enabled=false therefore
left vmop blocked on a non-existent dependency
("...cert-manager-crds ... not found"), cascading to monitoring-agents
and vertical-pod-autoscaler. Gate the dependency on the same condition
that creates it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
edb573b to
2b1d3e9
Compare
IvanHunters
left a comment
There was a problem hiding this comment.
Verdict
LGTM
The change gates the cert-manager-crds entry in the vmop HelmRelease dependsOn on the exact same addons.certManager.enabled toggle that gates the cert-manager-crds HelmRelease itself; verified correct across both toggle states, on upgrade and fresh install, with matching test coverage.
Caveats
- Root-cause verified:
templates/helmreleases/cert-manager-crds.yaml:1gates the target HR onand .Values.addons.certManager.enabled .Values._namespace.etcd, while the pre-fixvictoria-metrics-operator.yaml(gated only onmonitoringAgents.enabled+_namespace.etcd) referenced it unconditionally. WithmonitoringAgents.enabled=true+certManager.enabled=false(both default tofalseinvalues.yaml:180,201, so this is a valid, schema-reachable combination) vmop pointed at a HelmRelease that is never rendered. The fix attemplates/helmreleases/victoria-metrics-operator.yaml:34-37is the idiomatic Flux resolution. - Cascade claim confirmed:
vertical-pod-autoscaler.yamldependsOnmonitoring-agents,monitoring-agents.yamldependsOncozy-victoria-metrics-operator. A stuck vmop does block the whole monitoring to VPA chain.grep -rn cert-manager-crds templates/shows vmop was the only mis-gated consumer; the siblingcert-manager.yaml:45-46reference is itself inside a block gated oncertManager.enabled, so it is consistent. - vmop genuinely does not need cert-manager: the vendored chart default
admissionWebhooks.certManager.enabled: false(packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/values.yaml:388) is not overridden by the cozystack wrapper (packages/system/victoria-metrics-operator/values.yaml), so the webhook CA is self-generated. Gating (rather than making the CRDs HR unconditional) is the correct direction. - Phase 5b, upgrade (scenario A): no state migration, no CRD/RBAC/Secret/PVC/image/default-value change. For
certManager=trueclusters the rendered dependsOn is byte-identical (both entries present); forcertManager=falseclusters the broken entry is simply dropped and a previously-stuck vmop becomes reconcilable. No numbered migration script needed andmigrations.targetVersioncorrectly left unchanged. No one-way state change, clean rollback. - Phase 5b, fresh install (scenario B): cold-start dependency graph strictly improves (vmop no longer awaits a non-existent HR when cert-manager is off; cilium dep retained). No new PackageSource/bundle/cozyrds/
_cluster/_namespacekeys. Only a template and a test file are touched (files.txt), so nomake generateobligation and novalues.schema.json/README drift. - Tests verified by execution: the new suite
tests/victoria-metrics-operator_test.yamlasserts both toggle states with preciselengthEqualcounts (1 without cert-manager, 2 with), backed bynotContains/containson the exact dependency name.helm unittest .passes 15 suites / 144 tests locally, no regression. The suite'stests/values/common.yamlsets_namespace.etcd: cozy-etcd, satisfying the outer render guard so the assertions are meaningful. - Envelope is clean: 0 cozy_invariants, 0 repo_invariants, 0 warnings. The one
chart_lintrender_error is intalos-reconcile-job.yaml:487from empty runtime-injected_clustervalues during lint (a known non-bug) and is unrelated to the touched files.
Recommended follow-ups
- The PR body states "Full package suite passes (13 suites / 125 tests)", but the current tree runs 15 suites / 144 tests including the new one. Cosmetic staleness in the description only; no code impact.
|
Successfully created backport PR for |
|
Successfully created backport PR for |
What this PR does
The
victoria-metrics-operatorHelmRelease in thekubernetesapp chart is rendered whenaddons.monitoringAgents.enabledis true, but it listedcert-manager-crdsin itsdependsOnunconditionally. Thecert-manager-crdsHelmRelease is only created whenaddons.certManager.enabledis true. These are two independent toggles.The valid combination that triggers it
addons.monitoringAgents.enabled: true+addons.certManager.enabled: false(both default-able, both schema-valid). In this configuration vmop renders but the dependency it points at never does.Before / after
Before:
After:
The cascade
With cert-manager disabled, Flux reports on the vmop HelmRelease:
unable to get '...cert-manager-crds' dependency: helmreleases... not found. Because vmop never goes Ready, the dependency chain fails behind it:monitoring-agents(dependsOncozy-victoria-metrics-operator) → not Ready →vertical-pod-autoscaler(dependsOnmonitoring-agents) → not Ready.Why gating (not unconditional CRDs) is correct
vmop does not require cert-manager. The vendored vmop chart (
packages/system/victoria-metrics-operator) defaultsadmissionWebhooks.certManager.enabledtofalse, and the cozystack wrapper does not override it. With that default the chart self-generates the webhook CA/cert (genCA/genSignedCertin_helpers.tpl); the cert-manager Issuer/Certificate path is fully gated behindcertManager.enabled. So the dependency only belongs there when cert-manager is actually enabled.Principle: a
dependsOnmust never reference a HelmRelease that isn't created under the same value combination.How it was verified
helm templateof the template with a CI values fixture:certManager.enabled=false→ cilium only:certManager.enabled=true→ cilium + cert-manager-crds:A new
helm unittestsuite (tests/victoria-metrics-operator_test.yaml) asserts thedependsOnfor both toggle states. Full package suite passes (13 suites / 125 tests).Release note
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes