-
Notifications
You must be signed in to change notification settings - Fork 1.1k
How to use Flux to release Helm charts with secret sops-encrypted values? #2804
Comments
I am missing quite a few details on what you are trying to do. Please confirm if this is correct:
You could do this with a |
An alternative (and probably simpler) to achieve the same thing without sops is to use https://git-secret.io/ ( Note, however, that regardless of using Another solution to solve this problem would be to extend the I am not thrilled about tying Flux to specific technologies (which we are already doing by specifically supporting sops and git secrets), but maybe we can do thisin a vendor-neutral way by generically specifying how to decrypt them in the There may be other options, but I don't know the Helm ecosystem that well ( @hiddeco @stefanprodan , I invoke you). |
Yes, spot on. Apologies for the vagueness on the intent, will work on that. I appreciate the response and suggestions. Adding them directly to the I definitely understand not wanting to tie this project to other technologies, and the suggestion to extend the HelmRelease definition is really interesting. I'll take a look at that and see what I can do there. |
I'm fining that the generated decrypted file from the second method described here ends up in git after the first generation: #2580 (comment) .flux.yaml:
If I don't output to a different file, and instead just For now adding a |
Yes, after release/update operations whatever is put in the git repository will be committed. Maybe we should only do that for |
Is the solution good enough for you? |
Yes, it is. Thanks again for your guidance on this. |
I cannot figure out a way how to provide values from a SOPS decrypted secrets.yaml to a helmrelease manifest. There are some kustomize plugins but I wonder whether there's a simpler or better way to achieve this. Any help or advice on this would be great. |
I'd also like some guidance on how to use values from a sops-encrypted secrets.yaml in a HelmRelease. |
I ended up going with the method suggested above, which is to add them to the helmrelease as values after decrypting. Create a patch that contains secrets under spec.values, and then you can encrypt just the data with sops --encrypted-regex (not necessary, but convenient to preserve the file readability. Then when you run something like below to decrypt and output the generated helmrelease.
|
Also note that I'm having to create a decrypted file so that it can be used for kustomize, which I then have to remove so it doesn't get committed back to the repo on image update. There may be a better way to do this, but this is what ended up working for me. |
I also ended up using |
Hey, I'm trying to achieve the same thing here but Flux complains that there is two releases with the same name (which is normal because I want to merge them). Did I miss anything ? I'm happy to open a new issue but I think this is quite related to this and I must be missing something dumb... Thanks |
@wmiller112, what directory structure did you use here ? |
Hi. What's inside helm-release-patch.yaml? |
Describe the bug
I cannot seem to figure out a way to consume the decrypted values of a sops file via --sops=true or with a .flux.yaml patch update command: sops -d <encryptedFile.yaml> as values in a helm chart. For other files containing values that the helm chart consumes, we need to provide a valuesFrom. I am able to decrypt to another file (via .flux.yaml patch updated method), and then with a valuesFrom pointing to that file get them into a helm, but this results in the unencrypted file in the git repo.
One method I have considered is using kustomize with the encrypted file structured as a secret, which would get decrypted and applied outside the helm chart, and be referenced by the helmrelease, but this loses the flexibility of the helm chart for things like naming, checksum, etc.
To Reproduce
Steps to reproduce the behavior:
sops -d test.enc.yaml
As I understand, both of the above decrypt the file, but since the output is not associated with the helmrelease(as a file, configmap, secret, etc) it cannot be consumed by the chart.
Expected behavior
Im not exactly sure what the expected behavior here should be. I may be approaching this wrong, or it might be that Im not using the right tools to accomplish this, but have tried countless different approaches and hoping someone has a suggestion.
The text was updated successfully, but these errors were encountered: