flux2
flux2 copied to clipboard
Generated secrets contain newline
Describe the bug
Kubernetes secrets generated by secretGenerator contain newlines.
Steps to reproduce
sops secrets/test
Save it without any newline.
Add a kustomization with the following:
secretGenerator:
- files:
- secrets/test
name: test-secret
The Kubernetes secret contains a newline:
Expected behavior
The secret should not contain a newline.
Screenshots and recordings
No response
OS / Distro
Amazon EKS optimized Amazon Linux AMIs
Flux version
0.38.2
Flux check
N/A
Git provider
No response
Container Registry provider
No response
Additional context
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Also seeing this issue...does anyone have a workaround or fix?
My workaround was to use env files for single-line secrets.
Are you sure there's no newline in your input file? Most editors append a newline at the end of a line so even if in e.g. VIM you don't see a newline, it's actually there.
The tests of the kustomize-controller actually check for this newline, too.
I had trouble editing the file properly via every IDE, I then clone my git repo to VS and was finally able to remove the newline