-
Notifications
You must be signed in to change notification settings - Fork 192
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
Use Secret generator keys for SOPS format hint #636
Use Secret generator keys for SOPS format hint #636
Conversation
@@ -68,7 +67,6 @@ var ( | |||
k8sClient client.Client | |||
testEnv *testenv.Environment | |||
testServer *testserver.ArtifactServer | |||
testEventsH kuberecorder.EventRecorder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
staticcheck suggested that I remove this.
g.Expect(bytes.Compare(f.data, b) == 0).To(Equal(f.expectData)) | ||
g.Expect(bytes.Equal(f.data, b)).To(Equal(f.expectData)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
staticcheck suggested this change.
@@ -877,13 +882,13 @@ func TestKustomizeDecryptor_decryptKustomizationEnvSources(t *testing.T) { | |||
GeneratorArgs: kustypes.GeneratorArgs{ | |||
Name: "envSecret", | |||
KvPairSources: kustypes.KvPairSources{ | |||
FileSources: []string{"file.txt"}, | |||
EnvSources: []string{"app.env", "key=../secret.env"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that kustomize doesn't split the "EnvSources" field's values on an equals sign; it assumes that the whole value is always a file path.
27d6f00
to
b78b26e
Compare
Rather than inspecting the source file name supplied to kustomize's Secret generator to determine the format of the SOPS-encrypted file content, instead inspect the Secret key (when supplied separately from the source file name) as a more reliable heuristic. Doing so allows kustomization authors to name their SOPS-encrypted output files with a ".json" extension accurately reflecting the format in which SOPS writes its encrypted output, even if the encrypted content itself is not in JSON format. Signed-off-by: Steven E. Harris <seh@panix.com>
Signed-off-by: Steven E. Harris <seh@panix.com>
Signed-off-by: Steven E. Harris <seh@panix.com>
b78b26e
to
e6beca1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flawless execution of my instructions, and a big 💯 for the additional nit fixes. Thanks a lot @seh 🙇 🥇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @seh
Rather than inspecting the source file name supplied to kustomize's Secret generator to determine the format of the SOPS-encrypted file content, instead inspect the Secret key—when supplied separately from the source file name—as a more reliable heuristic.
Doing so allows kustomization authors to name their SOPS-encrypted output files with a ".json" extension accurately reflecting the format in which SOPS writes its encrypted output, even if the encrypted content itself is not in JSON format.
See preceding discussion in the "flux" channel of the CNCF Slack workspace for the circuitous path I took to diagnose this change in behavior, with @hiddeco's help in pointing me to his recent #619 and suggesting the idea for the fix.