Skip to content

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

Open
xeniape wants to merge 3 commits into
mainfrom
fix/certificate-lifetime
Open

xeniape wants to merge 3 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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: In Review

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

1 participant