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

gotmpl secrets are not supported #1878

Closed
chillum opened this issue Jun 10, 2021 · 3 comments
Closed

gotmpl secrets are not supported #1878

chillum opened this issue Jun 10, 2021 · 3 comments

Comments

@chillum
Copy link

chillum commented Jun 10, 2021

unfortunately, decrypting the .yaml.gotmpl files doesn't work. they're not parsed as templates.

there're two independent problems here:

  1. helm-secrets doesn't like JSON (not YAML) sops container (and sops defaults to JSON if the extension is not .yaml, but .yaml.gotmpl. I have a patch for this.

  2. helmfile seems to assume that the decrypted file should be a template. not really sure what's going on, but I think it just assumes the secrets decrypted file is a YAML file, not a .yaml.gotmpl.

@mumoshu
Copy link
Collaborator

mumoshu commented Jun 11, 2021

@chillum This should be already implemented in #1701. I don't personally use that feature so would you mind reviewing #1701 and see either you're misunderstanding the feature or the feature had some bug?

@jkroepke
Copy link

Hi there

in the upcoming version of helm-secrets (mention that helm plugin install will use master) the logic has been changed here.

helm-secrets will always append suffix, not only on .yaml files. Additionally, the parameter HELM_SECRETS_DEC_SUFFIX has been changed to .dec.

In context of .yaml files, it will not break helmfile since replace .yaml by .yaml.dec is the same like just append dec. But the change in helm-secret will break with files other than .yaml.

Additionally, to increase the compatibility, there is a new option for helm secret dec to just print the path of the decrypted file location.

jkroepke/helm-secrets#122

That should avoid some custom logic like that

// HELM_SECRETS_DEC_SUFFIX is used by the helm-secrets plugin to define the output file
decSuffix := os.Getenv("HELM_SECRETS_DEC_SUFFIX")
if len(decSuffix) == 0 {
decSuffix = ".yaml.dec"
}
// helm secrets replaces the extension with its suffix ONLY when the extension is ".yaml"
var decFilename string
if strings.HasSuffix(absPath, ".yaml") {
decFilename = strings.Replace(absPath, ".yaml", decSuffix, 1)
} else {
decFilename = absPath + decSuffix
}

@chillum
Copy link
Author

chillum commented Jun 14, 2021

hm, seems to decrypt fine and it seems like I'm running into another issue.
thanks

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

No branches or pull requests

3 participants