Repository navigation
fix(openshell): remove cert-manager Certificate to fix TLS race condition - #1833
Conversation
cryptography is intentionally pinned to <47 in kagenti/backend because versions 47+ crash with SIGILL on ARM64 Kind clusters. Add a Dependabot ignore rule to prevent it from repeatedly opening PRs that conflict with this constraint. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
…ell-tls-race Signed-off-by: Paolo Dettori <[email protected]> # Conflicts: # .github/dependabot.yml
…tion The chart had two conflicting TLS cert generators targeting the same secrets: 1. certgen.yaml — Helm pre-install hook (creates openshell-server-tls and openshell-client-tls with a self-generated CA) 2. certificate.yaml — cert-manager Certificate resources (overwrites the same secrets with certs signed by a different CA via openshell-ca-issuer) This caused a race condition: the gateway loads certs from certgen during startup, then cert-manager overwrites the secrets with a different CA. Sandbox pods that start later mount the new CA and reject the gateway's stale cert with UnknownCA during mTLS handshake. Fix: remove certificate.yaml so certgen is the sole TLS source. The certgen hook runs before the StatefulSet (Helm hook ordering guarantees this), eliminating the race. Also simplifies deploy-tenant.sh Step 3 — no longer needs the complex cert-manager retry loop since TLS is handled entirely by the certgen hook. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
mrsabath
left a comment
There was a problem hiding this comment.
Bel taglio, Paolo — netto, motivato, e i fatti tornano. I verified the key claims:
- ✅ certgen hook (
charts/openshell/templates/certgen.yaml) writes bothopenshell-server-tlsandopenshell-client-tlswith matching SANs (server,.{tenant},.svc,.svc.cluster.local,localhost,ingress.host). - ✅ Hook ordering: certgen Job uses
helm.sh/hook: pre-install,pre-upgradewithhook-weight: -20(RBAC at-30), so it runs before the StatefulSet. Race eliminated. - ✅
gatewayJwt.enabled: trueis the default invalues.yaml:46, so certgen always runs. - ✅
.Values.tls.*is referenced only in the file being deleted — no leakage. - ✅ −112 lines net; deploy/E2E pending the maintainer
/run-e2etrigger.
Areas reviewed: Helm chart, Shell
Commits: 3 commits, all signed-off ✓ — net diff is only the 3 TLS files (the first two commits' content is already on main via f8ba6ab5/merge from upstream). Squash-on-merge would leave a single clean commit.
CI status: all green; deploy/E2E gated on maintainer trigger (expected).
Left a couple of non-blocking suggestions inline + two off-diff observations below. Approving as-is.
Off-diff observations
1. Stale openshell-ca-issuer setup/teardown. scripts/openshell/deploy-shared.sh:335-348 still installs a ClusterIssuer openshell-ca-issuer, and cleanup-shared.sh:238 removes it. After this PR, nothing in the chart consumes the issuer anymore — it's installed and torn down for no purpose. Candidate for a follow-up cleanup PR.
2. Research doc references. docs/research/openshell-mvp.md (lines 791, 841, 867, 884) still references the deleted tls.* values + cert-manager flow as design. It's a research note rather than user docs, so deferring is fine — just flagging.
| # ── Step 3: Wait for certificates ────────────────────────────────────────── | ||
| log_info "Step 3: Waiting for cert-manager certificates" | ||
| # ── Step 3: Verify TLS secrets ───────────────────────────────────────────── | ||
| log_info "Step 3: Verifying TLS secrets (created by certgen hook)" |
There was a problem hiding this comment.
suggestion (rotation): the deleted Certificate had duration: 8760h (1 year) with renewBefore: 720h (30 days), giving cert-manager auto-renew. With certgen, the secrets are created on pre-install / pre-upgrade, so rotation now requires a helm upgrade to re-run the hook. For an MVP that's a fine trade — but worth either a one-line note here (or in the gateway/install docs) so operators know the rotation model changed, or filing a tracking issue for built-in rotation when this graduates beyond MVP. Not a blocker for this PR.
fix(openshell): remove cert-manager Certificate to fix TLS race condition (cherry picked from commit 20209d6)
Upstream PR rossoctl#1833 removed cert-manager Certificate resources, so the certgen hook is now the sole TLS mechanism. The gatewayJwt.enabled=false workaround (added to avoid cert-manager conflict) is no longer needed. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
Summary
charts/openshell/templates/certificate.yaml— the cert-manager Certificate resourceswere overwriting TLS secrets created by the certgen Helm hook with certs signed by a different CA
tls.*values fromvalues.yamldeploy-tenant.shStep 3 — replace the complex cert-manager retry loop with a simplesecret-existence check (certgen hook now handles all TLS)
Root Cause
The chart had two conflicting TLS generators targeting the same secrets (
openshell-server-tls,openshell-client-tls):certgen.yaml— Helm pre-install hook that generates a self-signed CA + leaf certscertificate.yaml— cert-manager Certificates signed byopenshell-ca-issuer(different CA)Race condition:
UnknownCAFix
Remove
certificate.yamlso certgen is the sole TLS source. Helm hook orderingguarantees certgen completes before the StatefulSet deploys, eliminating the race.
Test plan
scripts/openshell/deploy-tenant.sh team1on Kindopenshell sandbox createsucceeds (noUnknownCAerrors)Assisted-By: Claude Code