Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update charm to update the root kubeconfig with a current CA #354

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

addyess
Copy link
Member

@addyess addyess commented Jun 20, 2024

Overview

Each config hook should do it's best to update the root kubeconfig to have a valid ca cert.

Details

According to the bug LP#2064305, the charm code couldn't connect to the control-plane because

2024-04-27 06:14:19 WARNING unit.kubernetes-control-plane/1.certificates-relation-changed logger.go:60 Unable to connect to the server: tls: failed to verify certificate: x509: certificate signed by unknown authority

This can be caused by the CA being invalid on the next charm hook. This PR addresses the issue by ensuring the CA cert is correct on each possible reconcile loop

Draft until the following is merged

requirements.txt Outdated Show resolved Hide resolved
src/charm.py Show resolved Hide resolved
Comment on lines +72 to +75
f"Command failed: {command}\n"
f"returncode: {e.returncode}\n"
f"stdout: {e.stdout.decode()}\n"
f"stderr: {e.stderr.decode()}\n"
Copy link
Member Author

Choose a reason for hiding this comment

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

Extra debug on kubectl calls to print the stderr to the error log

@addyess addyess marked this pull request as ready for review June 20, 2024 16:01
@addyess addyess requested review from mateoflorido and kwmonroe June 21, 2024 01:42
Copy link
Contributor

@kwmonroe kwmonroe left a comment

Choose a reason for hiding this comment

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

i added a comment to the crux of this fix just to make sure i understand why we need this. assuming i got that scenario right, this LGTM.

and thanks for the extra kubectl debug!

src/charm.py Show resolved Hide resolved
@addyess addyess merged commit 8d7bc33 into main Jun 21, 2024
7 checks passed
@addyess addyess deleted the bug/lp2064305/support-updating-kubeconfig branch June 21, 2024 14:46
addyess added a commit that referenced this pull request Jun 21, 2024
* Update charm to update the root kubeconfig with a current CA

* Use updated main branch of kubernetes-snaps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants