Repository navigation
Install all Helm chart resources into the release namespace - #1823
Conversation
|
/kelos api-review |
|
🤖 Kelos Task Status Task |
|
/kelos review |
|
🤖 Kelos Task Status Task |
There was a problem hiding this comment.
All reported issues were addressed across 21 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
🤖 Kelos API Reviewer Agent @gjkim42 API Design ReviewVerdict: APPROVE FindingsCompatibility
Validation / Docs (guard contract)
Naming / API surface
Suggestions (optional)
/kelos needs-input |
|
🤖 Kelos Reviewer Agent @gjkim42 Review SummaryVerdict: APPROVE Findings Overview
FindingsCorrectness / Upgrade compatibility
Suggestions (optional)
Key takeaways
|
|
Addressed the Kelos reviewer and API reviewer findings (both at [P1] Existing non-
The maintainer can still choose to land this after #1725 instead. The guard and README notes are written so they can be removed then. [P2]/[P3] [P3] |
9c8d3ff to
12871eb
Compare
|
/kelos api-review |
|
/kelos review |
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
View guided diff | Turn on auto-fix | Re-trigger cubic
b6013e3 to
2ee8f9d
Compare
|
Follow-up on the Kelos reviewer and API reviewer findings at
Also in this commit: the |
The controller manager, its ServiceAccount, the conversion and validating webhook Service, Certificate, Issuer, leader-election RBAC, and the telemetry CronJob were hardcoded to kelos-system, so `helm install -n <ns>` split Kelos across two namespaces. They now use the release namespace, along with the webhook and CA references in the generated ValidatingWebhookConfiguration and subchart CRDs. Namespace/kelos-system is rendered only when the release namespace is kelos-system, so `kelos install` and existing kelos-system releases keep owning it. The telemetry CronJob passes its namespace through the new --telemetry-namespace flag instead of relying on a kelos-system constant. CRDs the release does not render (installed by `kelos install`, or kept by crds.keep during a two-phase upgrade) keep sending conversion requests to the namespace they name. With crds.install=false, the chart looks up tasks.kelos.dev and fails if its conversion webhook names a namespace other than the release namespace, instead of moving the kelos-webhook Service away from it. lookup finds nothing under `helm template` and `kelos install`, so offline rendering is unaffected. The chart README documents how to upgrade a release that owns kelos-system from another namespace: upgrade once with crds.install=true, adopt outside-managed CRDs first, and optionally keep the namespace with the helm.sh/resource-policy=keep annotation. The CRD adoption loop now lists every CRD the chart renders. The integration suite renders the chart's ValidatingWebhookConfiguration for envtest, since the template is no longer plain YAML. Fixes #1816 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2ee8f9d to
9cbd4c1
Compare
What type of PR is this?
/kind bug
What this PR does / why we need it:
helm install -n <ns>only moved part of Kelos into<ns>. The controller manager and its supporting resources were hardcoded tokelos-system, and the chart always createdNamespace/kelos-system.This PR makes every namespaced resource follow the release namespace:
kelos-controllerServiceAccount,kelos-webhookService, Certificate (includingdnsNames), Issuer, leader-election Role/RoleBinding,kelos-controller-rolebindingsubject, and the telemetry CronJob use{{ .Release.Namespace }}. The control-plane PodMonitor selects only the release namespace.hack/update-install-manifest.shtemplates the webhook Service namespace andcert-manager.io/inject-ca-frominvalidating-webhook.yamland in the subchart CRDs that carry conversion webhooks. The staticinstall-crd.yaml(applied bykelos install) keepskelos-system.Namespaceobject: rendered only when the release namespace iskelos-system, sokelos installand existingkelos-systemreleases keep owning it. Other namespaces come from--create-namespaceor the user.--telemetry-namespacecontroller flag, set by the CronJob to the release namespace. It is required with--telemetry-report.kelos install/kelos uninstall: no behavior change; they still render intokelos-system.crds.install=false, the chart looks uptasks.kelos.devand fails if its conversion webhook names a namespace other than the release namespace. This stops an upgrade from moving thekelos-webhookService away from CRDs the release does not render (CRDs fromkelos install, or CRDs kept bycrds.keepduring phase 1 of a two-phase upgrade).lookupfinds nothing underhelm templateandkelos install, so offline rendering is unaffected; tools that render withhelm template(such as Argo CD) skip the check, andcrds.install=falsereleases needgetoncustomresourcedefinitions. The failure message points to "Release Namespace" in the chart README.kelos-systemfrom another namespace; the Option 2 CRD adoption loop now liststaskpipelines.kelos.devandwebhookgateways.kelos.dev, which the chart also renders), thepodMonitor.enabledrow indocs/reference.md, and the troubleshooting skill.test/integration/suite_test.gorenders the chart'sValidatingWebhookConfigurationfor envtest instead of readingtemplates/validating-webhook.yaml, which is no longer plain YAML.Which issue(s) this PR is related to:
Fixes #1816
Special notes for your reviewer:
Not waiting on #1725. The issue marks this as blocked on #1725 because of the CRD conversion webhook. This PR templates the conversion
clientConfig.service.namespaceand CA annotation in the subchart CRDs, so Helm-rendered CRDs (crds.install=true) work in any namespace. For CRDs the release does not render, the conversion guard refuses an install or upgrade that would leave them pointing at a namespace without the webhook, and the README migration guide covers the one-phasecrds.install=trueupgrade (adopting outside-managed CRDs first). Once #1725 removes conversion, the guard becomes a no-op (CRDs without a conversion webhook pass) and can be dropped along with the README conversion notes. #1725 will need a small rebase overhack/update-install-manifest.sh, the subchart CRDs,webhook.yaml,render_test.go, and the README.Decision needed:
kelos-systemdeletion on upgrade. Existing releases installed with-n <other>ownNamespace/kelos-system. Upgrading them stops rendering it, so Helm deleteskelos-systemand anything in it, and their telemetry installation ID is regenerated. This follows the approach proposed in the issue. Operators who want to keep the namespace can runkubectl annotate namespace kelos-system helm.sh/resource-policy=keepbefore upgrading; Helm checks the live object's annotation before deleting it (pkg/kube/client.goin Helm v3.20.1). The README and release note document this opt-out.Verification
make verify,make test, andmake test-integrationpass.TestRender_ReleaseNamespacerenders intokelos-systemandkelosand checks namespaced objects, ServiceAccount binding subjects, CertificatednsNames, webhook/CRD conversion service namespaces, CA annotations, the telemetry flag, the PodMonitor selector, and that the Namespace object is rendered only forkelos-system. Reverting the template changes makes it fail.helm install -n team-b --create-namespace --set crds.install=true: deployed; all 11 namespaced objects inteam-b; nokelos-systemnamespace.-n kelos-systemrelease on the previous chart upgraded to this chart:Namespace/kelos-systemkept (same UID, Active).-n team-arelease on the previous chart upgraded to this chart: controller, Service, and Certificate move toteam-a;kelos-systemis deleted, as described above.-n team-arelease on the previous chart with Helm-owned CRDs: phase 1 (crds.install=false) is refused by the conversion guard with nothing applied; afterkubectl annotate namespace kelos-system helm.sh/resource-policy=keep, a singlecrds.install=trueupgrade moves the CRD conversion toteam-aand keepskelos-system; a later phase 1 upgrade passes the guard.TestRender_CRDConversionNamespaceGuardrenders through a fakelookupclient and covers the rejection plus no live CRD, a CRD without conversion, matching namespaces, akelos-systemrelease, andcrds.install=true.Pre-existing, not changed here: on
main, a firsthelm install -n kelos-system --create-namespacefails with Helm v3.20 (namespaces "kelos-system" already exists) because both Helm and the chart create the namespace; a retry succeeds as an upgrade. The behavior forkelos-systemreleases is unchanged by this PR.Does this PR introduce a user-facing change?
🤖 Generated with Claude Code
Summary by cubic
Every namespaced Helm chart resource now follows the release namespace instead of hardcoding
kelos-system, sohelm install -n <ns>no longer splits Kelos across two namespaces.{{ .Release.Namespace }}, as do the webhook Service and CA annotations in the validating webhook and in the subchart CRDs.Namespace/kelos-systemis rendered only forkelos-systemreleases, sokelos installkeeps owning it; other namespaces come from--create-namespaceor the user.--telemetry-namespaceflag.crds.install=false, the chart looks uptasks.kelos.devand fails if its conversion webhook names a namespace other than the release namespace;lookupfinds nothing underhelm template, so offline rendering is unaffected.kelos installandkelos uninstallare unchanged.Migration
kelos-system, including anything else in it; the telemetry installation ID is regenerated. Annotate the namespace withhelm.sh/resource-policy=keepto retain it.crds.install=true, adopting outside-managed CRDs into Helm first; the two-phase flow is not supported for this upgrade.Written for commit 9cbd4c1. Summary will update on new commits.