Skip to content

fix(platform): add cert-manager dependency to webhook-cert consumers - #2726

Merged
myasnikovdaniil merged 2 commits into
mainfrom
ci/cert-manager-dependsOn
May 27, 2026
Merged

myasnikovdaniil merged 2 commits into
mainfrom
ci/cert-manager-dependsOn

Conversation

@myasnikovdaniil

@myasnikovdaniil myasnikovdaniil commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Adds cert-manager as a dependsOn entry to the five PackageSources whose charts apply cert-manager.io/v1 Certificate CRs and need the webhook ready before their first reconcile. Without this, the helm install renders Certificate manifests, the cert-manager webhook isn't admitting requests yet (cold cluster), the apply fails, and helm-controller retries until the webhook eventually comes up — burning ~2-3 minutes per affected package on cold installs.

The five PackageSources: capi-operator, cozystack-engine, ingress-nginx, kamaji, and rabbitmq-operator (the platform cozy-system set with webhook-cert consumers; not the apps layer).

In cozystack-engine, the dependency is added to both the default and oidc variants — the oidc variant installs the same cozystack-api and lineage-controller-webhook components that render Certificate resources, so it had the same race.

Origin

First commit lifted unchanged from #2619. Second commit (oidc variant) added in response to review feedback.

Release note

NONE

Summary by CodeRabbit

Release Notes

  • Chores
    • Updated package source dependencies across multiple components to ensure proper installation sequencing.

Review Change Stack

@github-actions github-actions Bot added size/XS This PR changes 0-9 lines, ignoring generated files area/platform Issues or PRs related to platform infrastructure (bundle, flux, talos, installer) kind/bug Categorizes issue or PR as related to a bug labels May 25, 2026
@coderabbitai

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0f56d8a6-e7f0-4a3c-addc-a1ae6009fad7

📥 Commits

Reviewing files that changed from the base of the PR and between 1ff3fc9 and 535f881.

📒 Files selected for processing (5)
  • packages/core/platform/sources/capi-operator.yaml
  • packages/core/platform/sources/cozystack-engine.yaml
  • packages/core/platform/sources/ingress-nginx.yaml
  • packages/core/platform/sources/kamaji.yaml
  • packages/core/platform/sources/rabbitmq-operator.yaml
✅ Files skipped from review due to trivial changes (1)
  • packages/core/platform/sources/capi-operator.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/core/platform/sources/ingress-nginx.yaml
  • packages/core/platform/sources/rabbitmq-operator.yaml
  • packages/core/platform/sources/kamaji.yaml

📝 Walkthrough

Walkthrough

Six package source manifests now declare cozystack.cert-manager in their variant dependsOn lists: capi-operator, cozystack-engine (default and oidc), ingress-nginx, kamaji, and rabbitmq-operator.

Changes

Cert-manager dependency additions

Layer / File(s) Summary
Add cert-manager dependency to multiple package sources
packages/core/platform/sources/capi-operator.yaml, packages/core/platform/sources/cozystack-engine.yaml, packages/core/platform/sources/ingress-nginx.yaml, packages/core/platform/sources/kamaji.yaml, packages/core/platform/sources/rabbitmq-operator.yaml
PackageSource manifests updated to include cozystack.cert-manager in spec.variants[].dependsOn for the listed variants (cozystack-engine updated for both default and oidc).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

kind/bug, size/XS, area/platform

Suggested reviewers

  • androndo
  • sircthulhu
  • kvaps
  • lllamnyp
  • IvanHunters

Poem

🐰 A tiny hop, a single line,
Cert-manager joins the stack just fine,
Defaults and oidc now aligned,
Manifests updated, dependencies signed.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding cert-manager as a dependency to five PackageSources that render webhook certificates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/cert-manager-dependsOn

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 optimizes the platform deployment sequence by explicitly defining a dependency on cert-manager for several core components. By ensuring that cert-manager is ready before these packages attempt to reconcile their Certificate resources, the changes eliminate unnecessary retry loops during initial cluster provisioning, significantly improving deployment speed and reliability.

Highlights

  • Dependency Management: Added 'cozystack.cert-manager' as a 'dependsOn' entry to multiple PackageSources to ensure proper initialization order.
  • Performance Optimization: Reduced deployment time on cold clusters by preventing failed reconciliations caused by missing cert-manager webhooks.
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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates several core platform component definitions to include cozystack.cert-manager in their dependsOn lists, ensuring proper initialization order. Review feedback suggests that the oidc variant of cozystack-engine should also include this dependency to maintain consistency across variants. Additionally, it was noted that modifications to the platform package require a migration update or an explicit note on backward compatibility according to the project's style guidelines.

- name: default
dependsOn:
- cozystack.networking
- cozystack.cert-manager

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The oidc variant of cozystack-engine (defined at line 58) also includes the lineage-controller-webhook and other components that likely depend on cert-manager being ready. It should probably also have cozystack.cert-manager added to its dependsOn list (around line 59) to ensure consistent behavior across variants and avoid reconcile delays.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — the oidc variant installs the same components (cozystack-api and lineage-controller-webhook) that render cert-manager.io/v1 Certificate resources, so it needs the dependency too. Added cozystack.cert-manager to the oidc variant's dependsOn in 1ff3fc9.

- name: default
dependsOn:
- cozystack.networking
- cozystack.cert-manager

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

Per the repository style guide (line 78), changes to the platform package should include a migration update or a note on backward compatibility. While adding a dependency is generally safe, please confirm if a migration version bump is needed for existing clusters to apply these new dependency constraints correctly.

References
  1. Flag any change to the platform package that lacks a corresponding migration update or an explicit note that backward compatibility is preserved. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No migration update is needed here. The change is purely a declarative addition to PackageSource.spec.variants[].dependsOn, which cozystack-controller reads on each reconcile and translates into HelmRelease.spec.dependsOn. New installs pick up the constraint at first reconcile; existing clusters get the updated ordering applied non-destructively, since cozystack.cert-manager was always installed before these consumers in practice — this PR just makes the ordering explicit. No data or schema migration is involved, so backward compatibility is preserved.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/platform/sources/cozystack-engine.yaml`:
- Line 16: Update the PR summary to include
packages/core/platform/sources/cozystack-engine.yaml and add
cozystack.cert-manager to the oidc variant's dependsOn list to ensure webhook
cert consumers install after cert-manager; specifically, in
cozystack-engine.yaml add "- cozystack.cert-manager" under
variants.default.dependsOn (already present) and also under the oidc variant's
dependsOn so that system/cozystack-api and system/lineage-controller-webhook
have cert-manager available before they render cert-manager.io/v1 Certificate
resources; ensure the PR description lists cert-manager alongside
cert-manager-issuers, keycloak, kubevirt, kubevirt-cdi-operator, and
victoria-metrics-operator.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 39bee7f8-2746-484e-a495-b6d141c48db3

📥 Commits

Reviewing files that changed from the base of the PR and between 1810263 and 6197bf3.

📒 Files selected for processing (5)
  • packages/core/platform/sources/capi-operator.yaml
  • packages/core/platform/sources/cozystack-engine.yaml
  • packages/core/platform/sources/ingress-nginx.yaml
  • packages/core/platform/sources/kamaji.yaml
  • packages/core/platform/sources/rabbitmq-operator.yaml

Comment thread packages/core/platform/sources/cozystack-engine.yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Minimal correctness fix (+6 lines across 5 files), each of the 5 packages does render cert-manager.io/v1 Certificate CRs, and the oidc variant of cozystack-engine is correctly covered.

Verified each chart actually renders a cert-manager Certificate (so the dependency is justified, not cargo-cult):

  • system/capi-operator → charts/cluster-api-operator/templates/operator-components.yaml (cert-manager.io/v1 block in the vendored CAPI operator chart)
  • system/cozystack-api → templates/certmanager.yaml
  • system/lineage-controller-webhook → templates/certmanager.yaml
  • system/ingress-nginx → charts/ingress-nginx/templates/admission-webhooks/cert-manager.yaml
  • system/kamaji → charts/kamaji/templates/{certmanager_issuer,certmanager_certificate}.yaml
  • system/rabbitmq-operator → templates/messaging-topology-operator.yml

oidc variant coverage: yq '.spec.variants[] | select(.name == "oidc") | .components[].path' on cozystack-engine.yaml gives cozystack-api and lineage-controller-webhook among its components — both render Certificates — so the oidc variant needs the same gate. Daniil's second commit lifts the dependency into oidc as well, matching what Gemini flagged.

Why this matters on cold installs (matches PR body): without dependsOn: cozystack.cert-manager, helm-controller renders the Certificate manifest, the cert-manager webhook isn't admitting requests yet (its own pod is still rolling out / its Service endpoints haven't reconciled), the apply gets a webhook-not-available rejection, and helm-controller retries on its interval cadence until the webhook comes up — typically 2-3 min per affected package, sometimes more under contention. With the dependency added, the dependent HR doesn't even reconcile until cert-manager's HR is Ready, which for cert-manager is gated on the webhook Deployment's readiness probe (which only flips Ready once the webhook can actually admit). Net: one of the more common "first install is slow" complaints on cold clusters is fixed deterministically.

Bot nudges:

  • Gemini medium (oidc variant missing the dep) — addressed in the second commit.
  • Gemini low ("per style guide, platform changes might need a migration update") — N/A here. PackageSource.spec.variants[].dependsOn is helm-controller orchestration metadata, not a chart-rendered manifest. There's no runtime state to migrate — on next reconcile the platform controller picks up the new dependency declaration and gates accordingly. No migrations/ script needed.

No CI failures on the path I can read (DCO + CodeRabbit pass; e2e in progress on this SHA but the pre-rebase ancestor's e2e was green and these 6 lines can't plausibly regress anything).

The Slack message that flagged this PR for review is one of the few cozystack-org PRs in #review-plz I hadn't picked up yet — happy to land it as soon as someone with merge rights wants to.

Five PackageSources whose charts apply cert-manager Certificate CRs and
mount the resulting Secret on a webhook Deployment lacked an explicit
dependsOn: cozystack.cert-manager. Under Flux v2.8 helm-controller v1.5.0
kstatus, the dependent Deployment trips progressDeadlineSeconds (10m
default) when cert-manager controller isn't running yet, and the HR is
failed early. Repeatedly observed on PR #2619 with capi-operator,
kamaji, rabbitmq-operator, cozystack-api (cozystack-engine), and
ingress-nginx all cascading to InstallFailed at ~12-15m into a fresh
install.

The mariadb-operator, kubeovn-webhook, snapshot-controller, etcd-operator,
postgres-operator, mongodb-operator, victoria-metrics-operator, linstor,
and linstor-scheduler PackageSources already had the dependency, which
is why they weren't in the failure set.

Assisted-By: Claude <[email protected]>
Signed-off-by: Myasnikov Daniil <[email protected]>
(cherry picked from commit 0fc0796)
The oidc variant installs system/cozystack-api and
system/lineage-controller-webhook, both of which render
cert-manager.io/v1 Certificate resources. Add cozystack.cert-manager to
the oidc variant's dependsOn so it matches the default variant and
webhook-cert consumers do not race the cert-manager controller on cold
installs.

Address review feedback from gemini-code-assist and coderabbitai on
packages/core/platform/sources/cozystack-engine.yaml.

Assisted-By: Claude <[email protected]>
Signed-off-by: Myasnikov Daniil <[email protected]>
@myasnikovdaniil myasnikovdaniil added the debug Debugging in progress label May 27, 2026
@myasnikovdaniil
myasnikovdaniil force-pushed the ci/cert-manager-dependsOn branch from e7fdaf3 to 535f881 Compare May 27, 2026 15:40
@myasnikovdaniil
myasnikovdaniil merged commit 6b76db6 into main May 27, 2026
10 checks passed
@myasnikovdaniil
myasnikovdaniil deleted the ci/cert-manager-dependsOn branch May 27, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/platform Issues or PRs related to platform infrastructure (bundle, flux, talos, installer) debug Debugging in progress kind/bug Categorizes issue or PR as related to a bug size/XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants