flux2 icon indicating copy to clipboard operation
flux2 copied to clipboard

Generated secrets contain newline

Open mjroeleveld opened this issue 1 year ago • 5 comments

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: image

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

mjroeleveld avatar Jan 04 '23 18:01 mjroeleveld

Also seeing this issue...does anyone have a workaround or fix?

kr-jmd avatar Jan 18 '23 18:01 kr-jmd

My workaround was to use env files for single-line secrets.

mjroeleveld avatar Jan 18 '23 18:01 mjroeleveld

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.

makkes avatar Jan 20 '23 06:01 makkes

The tests of the kustomize-controller actually check for this newline, too.

mjroeleveld avatar Jan 20 '23 12:01 mjroeleveld

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

kkerennnn avatar Feb 22 '24 12:02 kkerennnn