Skip to content

[Backport/v1.28] identity: reload CA root cert channel on file change#1801

Draft
jlojosnegros wants to merge 2 commits intoistio:release-1.28from
jlojosnegros:backport/v1.28/root-ca-reload
Draft

[Backport/v1.28] identity: reload CA root cert channel on file change#1801
jlojosnegros wants to merge 2 commits intoistio:release-1.28from
jlojosnegros:backport/v1.28/root-ca-reload

Conversation

@jlojosnegros
Copy link
Contributor

Backport of #1775 to release-1.28

Everything is almost directly backported.
Note: some dependencies added.

Introduce RootCertManager (analogous to CrlManager) to watch
the CA root cert file for changes using a notify debouncer.

When the file changes, a dirty flag (AtomicBool) is set. On the next call
to CaClient::fetch_certificate(), the flag is checked and, if set, the
TLS gRPC channel is rebuilt using the updated cert before sending the CSR
request. If the rebuild fails, the flag is rearmed and the existing channel
is reused, so cert renewal continues working despite a transient error.

The gRPC channel is now wrapped in a RwLock inside CaClient to allow
lazy replacement without blocking concurrent reads. CaClient::new()
now accepts a RootCert directly instead of a pre-built cert provider,
so it can start the file watcher and retain the data needed to rebuild
the channel later.

Signed-off-by: Jose Luis Ojosnegros Manchón <jojosneg@redhat.com>
Add notify and notify-debouncer-full needed to watch the CA root file
parent folder and hot reload the cert.

Add tempfile dependency needed for testing purposes

NOTE: Used the versions in main for the three dependencies even if there
are newer ones

Signed-off-by: Jose Luis Ojosnegros Manchón <jojosneg@redhat.com>
@istio-testing
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@istio-testing istio-testing added do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 20, 2026
@fjglira
Copy link

fjglira commented Mar 20, 2026

Hey @jlojosnegros, the backports are automatically created from PR on the master branch by using the label cherry-pick/release-1.xx

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

Labels

do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants