Skip to content

fix: Report certificate expiry for the certManager backend - #752

Merged
lfrancke merged 3 commits into
mainfrom
push-vuqyxmvptznv
Sep 10, 2026
Merged

fix: Report certificate expiry for the certManager backend#752
lfrancke merged 3 commits into
mainfrom
push-vuqyxmvptznv

Conversation

@lfrancke

@lfrancke lfrancke commented Sep 9, 2026

Copy link
Copy Markdown
Member

Description

The certManager backend ignored any expiry information from the certiifcates it deployed. This meant that a Pod with a cert we injected would never be restarted.

This commit changes it so it now reports the expiry of certManager created certs to the restart-controller, so it evicts/restarts the Pod in time.

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

The certManager backend ignored any expiry information from the
certiifcates it deployed. This meant that a Pod with a cert we injected
would never be restarted.

This commit changes it so it now reports the expiry of certManager created certs 
to the restart-controller, so it evicts/restarts the Pod in time.
@lfrancke
lfrancke marked this pull request as ready for review September 9, 2026 09:24
@lfrancke lfrancke moved this to Development: Waiting for Review in Stackable Engineering Sep 9, 2026
@Maleware
Maleware self-requested a review September 9, 2026 12:36
Comment thread rust/operator-binary/src/backend/auto_tls/mod.rs
Comment thread rust/operator-binary/src/backend/cert_manager.rs
Comment thread rust/operator-binary/src/backend/cert_manager.rs
Comment thread rust/operator-binary/src/utils.rs

@Maleware Maleware 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.

Overall it looks good to me. One thing IMO we have to correct.

Comment thread rust/operator-binary/src/backend/cert_manager.rs
@Maleware Maleware moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Sep 10, 2026

@Maleware Maleware 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.

Sorry, I needed to say that.

Comment thread rust/operator-binary/src/backend/cert_manager.rs
The overdue-renewal branch fell back to notAfter without checking that
notAfter is still in the future. When cert-manager has stopped renewing, the
certificate is already expired and that writes a past timestamp into the
restarter annotation. commons-operator evicts unconditionally on a past
timestamp with no backoff, the replacement Pod is handed the same expired
certificate, computes the same past timestamp, and is evicted again.

Treat an expired certificate as unusable material instead, which is how this
backend already treats a Secret with no tls.crt at all: fail with Unavailable
so the kubelet retries, leaving the Pod in ContainerCreating with the reason
in an event, and recovering on its own if cert-manager catches up.

That means a Pod will not start rather than starting with an expired
certificate, which is a behaviour change during a cert-manager outage.

With this in place the remaining fallback to notAfter is provably in the
future, so it cannot loop.
The renewal point falls back to two thirds through the certificate's validity
when the Certificate carries no status.renewalTime. That is expected between
our own apply and cert-manager's next reconcile, but it would also happen
silently and permanently if our CertificateStatus mirror stopped matching
cert-manager's actual status shape, in which case every Pod would be scheduled
off a guess with no signal that anything was wrong.

Logged at info rather than warn: on a first publish this is normal and not
actionable, and the operator already has a history of expected conditions
logging as warnings.
@lfrancke
lfrancke requested a review from Maleware September 10, 2026 13:08

@Maleware Maleware 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.

@lfrancke
lfrancke added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit 5a311e0 Sep 10, 2026
13 checks passed
@lfrancke
lfrancke deleted the push-vuqyxmvptznv branch September 10, 2026 14:40
@lfrancke lfrancke moved this from Development: In Review to Development: Done in Stackable Engineering Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: Done

Development

Successfully merging this pull request may close these issues.

2 participants