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

Bugfix: Reuse existing secrets #137

Merged
merged 39 commits into from
Sep 13, 2023

Conversation

madestreel
Copy link

With the current implementation we would have to chose between creating the secret manually or have it auto created but then it will be recreated at each deploy.

With this change. If the secret is already present the values of the secret will be reused, otherwise the secret will be created with either the values configured or some random generated values.

This way the secret will only be created if it does not exist.

@valeraBr
Copy link
Contributor

Thanks for this contribution @madestreel , we will take it to internal labs to validate it and update you soon.

Copy link
Contributor

@valeraBr valeraBr left a comment

Choose a reason for hiding this comment

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

@madestreel The installation fails with preconfigured secret

@@ -1,17 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: memphis-creds
name: {{ .Values.memphis.creds.secretConfig.name }}
Copy link
Contributor

Choose a reason for hiding this comment

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

@madestreel In case the secret already exist in the namespace and its not helm generated the installation fails.

Copy link
Author

Choose a reason for hiding this comment

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

Could you provide the error? When I tested it worked fine... But it is true that I didn't test with other keys than the defaults one inside the secret

Copy link
Contributor

Choose a reason for hiding this comment

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

I've tried to use pre-created secret and this is the output:
Error: INSTALLATION FAILED: rendered manifests contain a resource that already exists. Unable to continue with install: Secret "external-creds" in namespace "memphis" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "my-memphis"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "memphis"

Copy link
Author

Choose a reason for hiding this comment

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

I might be mistaken but it seems that the error is more about the fact that the secret cannot be imported to the release more than the chart trying to create a secret that already exist.

Copy link
Contributor

Choose a reason for hiding this comment

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

It can't be imported and we don't want so, we want to use an existing pre-configured secret with all the values.
Can you explain a little bit more about the use case you checked?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry I was not working yesterday so I had not really the chance to test. I will do that today

@madestreel
Copy link
Author

@valeraBr Any news for this?

@valeraBr
Copy link
Contributor

valeraBr commented Aug 9, 2023

@madestreel Sorry for the late response, current release is near the corner so this PR will be merged right after it.
You did excellent work, this PR needs to go through our internal QA process, that's why it was not released till now.

@madestreel
Copy link
Author

@valeraBr Let me know if there is something I need to do here

@valeraBr
Copy link
Contributor

@madestreel I will, the PR takes time but will be merged soon.

valeraBr and others added 12 commits September 11, 2023 14:17
With the current implementation we would have to choice between creating
the secret manually or have it auto created but then it will be
recreated at each deploy.

With this change. If the secret is already present the values of the
secret will be reused, otherwise the secret will be created with either
the values configured or some random generated values.

This way the secret will only be created if it does not exist.
@valeraBr valeraBr merged commit 0b444fe into superstreamlabs:master Sep 13, 2023
@madestreel madestreel deleted the feature/custom-secrets branch September 13, 2023 08:47
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.

None yet

2 participants