Skip to content

Allow replacing cluster certificate#82

Merged
masnax merged 7 commits into
canonical:mainfrom
masnax:add-cert-helper
Feb 1, 2024
Merged

Allow replacing cluster certificate#82
masnax merged 7 commits into
canonical:mainfrom
masnax:add-cert-helper

Conversation

@masnax
Copy link
Copy Markdown
Contributor

@masnax masnax commented Jan 23, 2024

Adds a new internal endpoint to update the cluster certificate used with the listeners across the cluster. It sends a request to all cluster members and instructs them to write the certs into the state directory, and load them onto the daemon.

To facilitate this by default before the endpoints start, a new PreBootstrap hook is introduced which runs just after the daemon registers its name & address. The default cluster cert can be overwritten in the state directory at this point and get picked up during the bootstrap process. OnBootstrap has been renamed to PostBootstrap to keep things consistent.

Additionally, there's a client function UpdateClusterCertificate which will update the cluster cert after the daemon has started.

cc @gboutry

Copy link
Copy Markdown
Contributor

@roosterfish roosterfish left a comment

Choose a reason for hiding this comment

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

Just some smaller comments :)

Comment thread example/cmd/microd/main.go Outdated
Comment thread example/cmd/microd/main.go
Comment thread internal/daemon/daemon.go Outdated
Comment thread config/hooks.go
Comment thread internal/daemon/daemon.go
Comment thread internal/endpoints/network.go Outdated
Comment thread internal/daemon/daemon.go Outdated
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
…ootstrap

PostBootstrap is the equivalent of OnBootstrap, and PreBootstrap runs
just before starting the API.

Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Copy link
Copy Markdown
Contributor

@roosterfish roosterfish left a comment

Choose a reason for hiding this comment

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

Sorry for the late reply, looking good, just two more comments I am not sure about.

Comment thread internal/endpoints/endpoints.go
Comment thread internal/db/dqlite.go Outdated
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Copy link
Copy Markdown
Contributor

@roosterfish roosterfish left a comment

Choose a reason for hiding this comment

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

LGTM!

@masnax masnax merged commit 490a98a into canonical:main Feb 1, 2024
masnax added a commit to masnax/microcluster that referenced this pull request Dec 10, 2024
Allow replacing cluster certificate

(cherry picked from commit 490a98a)
masnax added a commit to masnax/microcluster that referenced this pull request Dec 10, 2024
Allow replacing cluster certificate

(cherry picked from commit 490a98a)
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
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.

2 participants