Skip to content

Fix traefik tls certs during refresh#879

Open
Thanhphan1147 wants to merge 3 commits into
canonical:mainfrom
Thanhphan1147:fix-traefik-tls-certs
Open

Fix traefik tls certs during refresh#879
Thanhphan1147 wants to merge 3 commits into
canonical:mainfrom
Thanhphan1147:fix-traefik-tls-certs

Conversation

@Thanhphan1147

@Thanhphan1147 Thanhphan1147 commented Jul 9, 2026

Copy link
Copy Markdown

The release of traefik revision 281 introduces managing certificates in "APP" mode. However, due to an issue with the tls-certiicates library, the corresponding private_key did not had the correct scope, which introduce a risk of service disruption . This PR proposes a fix so that deployments that are in a "degraded" state can self-heal after running the sunbeam refresh command.

The PR adds a custom logic towards the end of the refresh command to find outstanding CSRs, check that the subject matches the certificates stored in _CONFIG, then rerun provide-certifcate action on manual-tls-certificates

We considered a few options:

  1. Make this into a dedicated command ( like sunbeam fix-certs for example )
  2. Make the logic only trigger via a new flag added to the refresh command ( like sunbeam refresh --fix-certs )
  3. Make the logic runs automatically on each refresh under specific conditions

This PR implements option 3 to simplify user UX.

Assisted-By: copilot

Related-PR: https://github.com/canonical/traefik-k8s-operator/pull/729/changes
Related-bug: canonical/traefik-k8s-operator#709

QA steps

@Thanhphan1147
Thanhphan1147 marked this pull request as ready for review July 10, 2026 05:29
@Thanhphan1147
Thanhphan1147 force-pushed the fix-traefik-tls-certs branch from 53ec740 to f8b7da7 Compare July 10, 2026 05:44
@Thanhphan1147 Thanhphan1147 changed the title Fix traefik tls certs Fix traefik tls certs during refresh Jul 10, 2026

@hmlanigan hmlanigan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Question: how do we test this charnge?

Comment thread sunbeam-python/sunbeam/commands/refresh.py Outdated
Comment thread sunbeam-python/tests/unit/sunbeam/features/test_tls.py

@Raven-182 Raven-182 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the patch. Some comments:

Comment thread sunbeam-python/sunbeam/features/tls/ca.py Outdated
@Thanhphan1147
Thanhphan1147 force-pushed the fix-traefik-tls-certs branch from a3aa757 to da500d4 Compare July 16, 2026 01:07
Comment thread sunbeam-python/sunbeam/features/tls/ca.py Outdated
Comment thread sunbeam-python/sunbeam/features/tls/ca.py Outdated
@Thanhphan1147
Thanhphan1147 force-pushed the fix-traefik-tls-certs branch from 186ebae to c08b31d Compare July 16, 2026 13:20
@Thanhphan1147

Copy link
Copy Markdown
Author

@Raven-182 I squashed all commits into 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants