Skip to content

fix: cap autoTls certificate lifetime to the newest CA's remaining lifetime - #777

Merged
xeniape merged 7 commits into
mainfrom
fix/certificate-lifetime
Nov 23, 2026
Merged

xeniape merged 7 commits into
mainfrom
fix/certificate-lifetime

Conversation

@xeniape

@xeniape xeniape commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Description

Fixes #753

This PR

  • Caps the certificate lifetime by the newest CA's lifetime -> sidenote: the issue claimed the error only appears when autoGenerate is false, but it also appeared (according to Claude) when caCertificateLifetime < 5 × caCertificateRetirementDuration, the cap here also fixes that situation
  • A Pod Event Warning is published if the certificate lifetime was reduced, to let the user know (also a note to provide a new CA)
  • Small fix of legacy CA keys description in CRD and docs
  • Contrary to the issue description I didn't touch TlsGenerate::get_or_create_k8s_certificate. I tried it first but it wasn't necessary and the whole function seems to have grown over time and was tangled with different scenarios, tried refactoring but just confused myself with all the calculations. Can confirm this one though autoTls: calculation for secure maximum certificate lifetimes so that all pods that are deployed trust every other deployed pod is too loose #754 -> according to Claude the fix would be, but I didn't test or include it in the PR:
// today
let active_ca_certificate_lifetime = ca_certificate_lifetime - ca_certificate_retirement_duration;
let safe_max_cert_lifetime = active_ca_certificate_lifetime / CA_ROTATION_FRACTION / 2;

// correct bound
let safe_max_cert_lifetime =
    (active_ca_certificate_lifetime / CA_ROTATION_FRACTION - ca_certificate_retirement_duration) / 2;
  • Didn't include Warn that manually provisioned certificates are about to expire #94 because it's hard to decide the correct value for when the user needs a warning, e.g. halftime for a "shortlived" CA might be fine, for a 10 year CA the warning appears 5 years prior. A new CRD field would be nice so the users can decide for themselves when the warning makes sense, but that was out of scope

Release Note

Previously autoTls certificate mounts could fail when autoGenerate was set to false or in some rare caCertificateLifetime and caCertificateRetirementDuration configuration combinations. Now the certificate lifetimes are capped by the CA lifetime that signs them, consequently fixing these mount failures. If the certificate lifetime gets reduced by this cap, the affected Pod will receive a Pod Event Warning to notify the user.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Helm chart can be installed and deployed operator works
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible
  • Links to generated (nightly) docs added
  • Release note snippet added

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added
  • Links to generated (nightly) docs added
  • Release note snippet added
  • Add type/deprecation label & add to the deprecation schedule
  • Add type/experimental label & add to the experimental features tracker

@xeniape xeniape self-assigned this Nov 16, 2026
@lfrancke lfrancke moved this to Development: Waiting for Review in Stackable Engineering Nov 16, 2026
@xeniape
xeniape marked this pull request as ready for review November 16, 2026 09:31
@NickLarsenNZ NickLarsenNZ moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Nov 16, 2026
@NickLarsenNZ
NickLarsenNZ self-requested a review November 16, 2026 13:38
NickLarsenNZ
NickLarsenNZ previously approved these changes Nov 17, 2026

@NickLarsenNZ NickLarsenNZ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. I left some comments. Nothing major, just some suggestions.

I do think we should hold off on merging it until after the release, just so it has some time to soak in our regular tests.

Comment thread rust/operator-binary/src/backend/mod.rs Resolved
NickLarsenNZ
NickLarsenNZ previously approved these changes Nov 23, 2026

@NickLarsenNZ NickLarsenNZ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@xeniape
xeniape added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit a3567a9 Nov 23, 2026
13 checks passed
@xeniape
xeniape deleted the fix/certificate-lifetime branch November 23, 2026 14:31
@xeniape xeniape added release-note Denotes a PR that will be considered when it comes time to generate release notes. release/27.3.0 labels Nov 23, 2026
@xeniape xeniape moved this from Development: In Review to Development: Done in Stackable Engineering Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/27.3.0 release-note Denotes a PR that will be considered when it comes time to generate release notes.

Projects

Status: Development: Done

Development

Successfully merging this pull request may close these issues.

autoTls: bound certificate lifetime by the CA that will actually sign it, not the configured caCertificateLifetime

2 participants