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

feat: migrate CA secret to new namespace #476

Merged
merged 12 commits into from
Jul 22, 2024

Conversation

dervoeti
Copy link
Member

Description

Fixes #453 by creating a one-time job that copies the secret over to the new namespace if it does not exist there yet.

Definition of Done Checklist

Author

Preview Give feedback

Reviewer

Preview Give feedback

Acceptance

Preview Give feedback

@dervoeti dervoeti force-pushed the feat/migrate-secret-to-new-namespace branch from 56ed99b to 08b6614 Compare July 22, 2024 12:07
@dervoeti dervoeti force-pushed the feat/migrate-secret-to-new-namespace branch from 08b6614 to bf66f2c Compare July 22, 2024 12:26
NickLarsenNZ
NickLarsenNZ previously approved these changes Jul 22, 2024
Copy link
Member

@NickLarsenNZ NickLarsenNZ left a comment

Choose a reason for hiding this comment

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

Approved based on the shellcheck pass, and the described testing (in the team call).

@dervoeti
Copy link
Member Author

dervoeti commented Jul 22, 2024

I now created separate RBAC rules for the Job now instead of using the ones from secret-operator.

Reasoning (besides better security):
The Job should run before secret-op starts and the SecretClass is created, because otherwise a race condition might occur where secret-op is already started but the Job did not finish yet, hence the Secret is not yet copied over to the new namespace and secret-op might create a new CA (if a Pod requests a cert). Since the Job needs a ServiceAccount to view/edit Secrets and that ServiceAccount needs to be created before the installation of secret-op as well, the ServiceAccount and other RBAC resources have been created and also annotated with the Hook annotations for Helm.
I set the hook-delete-policy to hook-succeeded so all the resources from this one time job will automatically be deleted if it succeeds. The hook-weight annotations make sure the RBAC resources are created before the Job.

Just retested it a couple of times, works as expected.

Copy link
Member

@labrenbe labrenbe left a comment

Choose a reason for hiding this comment

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

lgtm

@dervoeti dervoeti added this pull request to the merge queue Jul 22, 2024
Merged via the queue into main with commit b034d99 Jul 22, 2024
31 checks passed
@dervoeti dervoeti deleted the feat/migrate-secret-to-new-namespace branch July 22, 2024 15:33
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.

Reuse an existing TLS CA from a previous installation
6 participants