fix keycloak secrets drift - #509
Conversation
|
Warning Rate limit exceededAndrei Kvapil (@kvaps) has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 2 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
0a5152c to
7b0c93a
Compare
…ions Address the only round-4 code blocker: per-listener Certificates created during an HTTP-01 phase are not deleted when the operator flips certMode to dns01, and the wildcard Certificate created in DNS-01 mode is not deleted when the operator flips back to http01. Both cases leak a `cert-manager.io/Certificate` plus its backing `Secret`, count against LE rate limits indefinitely, and confuse listeners with stale TLS material. reconciler.go changes: - reconcilePerListenerCertificates no longer early-returns when certMode != http01. The provisioning branch is gated on http01, but the GC loop runs unconditionally with desiredNames empty in dns01 mode → every per-listener cert from a prior http01 reconcile is deleted. - reconcileWildcardCertificate runs in both modes too. In dns01 mode it provisions / updates the wildcard cert (unchanged behaviour). In http01 mode it now Get-and-Delete-if-owned the wildcard cert if a stale one exists from a previous dns01 phase. Tests: - TestReconcile_CertModeTransitionHTTP01ToDNS01CleansPerListenerCerts: bootstraps a TenantGateway in http01 with one attached HTTPRoute, asserts the per-listener cert exists, flips certMode to dns01 + fills DNS01.Cloudflare config, runs Reconcile again, asserts the per-listener cert is gone. - TestReconcile_CertModeTransitionDNS01ToHTTP01CleansWildcardCert: bootstraps in dns01 with cloudflare config, asserts the wildcard cert exists, flips to http01, asserts the wildcard cert is gone. Round-4 review's other concerns are non-code or out of scope for this PR: - Documentation PR (cozystack/website #509) is stale relative to this code's seven-layer security model. Tracked as a separate follow-up under the docs repo; will be updated as part of the PR landing dance. - VAP apiVersions tightening (drop v1beta1 from gateway-hostname policy, widen route-hostname policy if HTTPRoute is served at multiple versions) — defer to a follow-up VAP-hardening PR. - Spec-drift Kubernetes Event when controller overwrites Gateway edits — UX nice-to-have, not a correctness gap. - Double conversion in pkg/registry/apps/application/rest.go Delete path — pre-existing code outside this PR's surface. `make test-controllers` clean. `make helm-unit-tests` clean. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
…ions Address the only round-4 code blocker: per-listener Certificates created during an HTTP-01 phase are not deleted when the operator flips certMode to dns01, and the wildcard Certificate created in DNS-01 mode is not deleted when the operator flips back to http01. Both cases leak a `cert-manager.io/Certificate` plus its backing `Secret`, count against LE rate limits indefinitely, and confuse listeners with stale TLS material. reconciler.go changes: - reconcilePerListenerCertificates no longer early-returns when certMode != http01. The provisioning branch is gated on http01, but the GC loop runs unconditionally with desiredNames empty in dns01 mode → every per-listener cert from a prior http01 reconcile is deleted. - reconcileWildcardCertificate runs in both modes too. In dns01 mode it provisions / updates the wildcard cert (unchanged behaviour). In http01 mode it now Get-and-Delete-if-owned the wildcard cert if a stale one exists from a previous dns01 phase. Tests: - TestReconcile_CertModeTransitionHTTP01ToDNS01CleansPerListenerCerts: bootstraps a TenantGateway in http01 with one attached HTTPRoute, asserts the per-listener cert exists, flips certMode to dns01 + fills DNS01.Cloudflare config, runs Reconcile again, asserts the per-listener cert is gone. - TestReconcile_CertModeTransitionDNS01ToHTTP01CleansWildcardCert: bootstraps in dns01 with cloudflare config, asserts the wildcard cert exists, flips to http01, asserts the wildcard cert is gone. Round-4 review's other concerns are non-code or out of scope for this PR: - Documentation PR (cozystack/website #509) is stale relative to this code's seven-layer security model. Tracked as a separate follow-up under the docs repo; will be updated as part of the PR landing dance. - VAP apiVersions tightening (drop v1beta1 from gateway-hostname policy, widen route-hostname policy if HTTPRoute is served at multiple versions) — defer to a follow-up VAP-hardening PR. - Spec-drift Kubernetes Event when controller overwrites Gateway edits — UX nice-to-have, not a correctness gap. - Double conversion in pkg/registry/apps/application/rest.go Delete path — pre-existing code outside this PR's surface. `make test-controllers` clean. `make helm-unit-tests` clean. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
…ions Address the only round-4 code blocker: per-listener Certificates created during an HTTP-01 phase are not deleted when the operator flips certMode to dns01, and the wildcard Certificate created in DNS-01 mode is not deleted when the operator flips back to http01. Both cases leak a `cert-manager.io/Certificate` plus its backing `Secret`, count against LE rate limits indefinitely, and confuse listeners with stale TLS material. reconciler.go changes: - reconcilePerListenerCertificates no longer early-returns when certMode != http01. The provisioning branch is gated on http01, but the GC loop runs unconditionally with desiredNames empty in dns01 mode → every per-listener cert from a prior http01 reconcile is deleted. - reconcileWildcardCertificate runs in both modes too. In dns01 mode it provisions / updates the wildcard cert (unchanged behaviour). In http01 mode it now Get-and-Delete-if-owned the wildcard cert if a stale one exists from a previous dns01 phase. Tests: - TestReconcile_CertModeTransitionHTTP01ToDNS01CleansPerListenerCerts: bootstraps a TenantGateway in http01 with one attached HTTPRoute, asserts the per-listener cert exists, flips certMode to dns01 + fills DNS01.Cloudflare config, runs Reconcile again, asserts the per-listener cert is gone. - TestReconcile_CertModeTransitionDNS01ToHTTP01CleansWildcardCert: bootstraps in dns01 with cloudflare config, asserts the wildcard cert exists, flips to http01, asserts the wildcard cert is gone. Round-4 review's other concerns are non-code or out of scope for this PR: - Documentation PR (cozystack/website #509) is stale relative to this code's seven-layer security model. Tracked as a separate follow-up under the docs repo; will be updated as part of the PR landing dance. - VAP apiVersions tightening (drop v1beta1 from gateway-hostname policy, widen route-hostname policy if HTTPRoute is served at multiple versions) — defer to a follow-up VAP-hardening PR. - Spec-drift Kubernetes Event when controller overwrites Gateway edits — UX nice-to-have, not a correctness gap. - Double conversion in pkg/registry/apps/application/rest.go Delete path — pre-existing code outside this PR's surface. `make test-controllers` clean. `make helm-unit-tests` clean. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
No description provided.