Repository navigation
feat(2196): secrets management - #2721
Conversation
9ed84d6 to
f46ea67
Compare
|
@RemingtonReackhof Thank you for submitting this! This is a pretty big feature add, so several of us are going to have to review this before merge. |
475c5f1 to
884ae9e
Compare
|
@RemingtonReackhof Just to update you on this. We will be reviewing this and merging in once we have released 2.6. Most of our efforts are focused on 2.6 right now |
|
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
@thomastaylor312 I appreciate the update, best of luck with the 2.6 release! |
884ae9e to
52f8378
Compare
52f8378 to
3f895e4
Compare
|
@RemingtonReackhof I plan on getting to this no later than Monday, but hopefully tomorrow. I want to make sure I put adequate time into reviewing this well |
|
Ok, I've started on this. It is going to take a bit to go all through |
thomastaylor312
left a comment
There was a problem hiding this comment.
I have not tested this yet (will do soon), but wanted to get you my feedback on the code. Mostly small comments or nits.
I am going to label this as breaking because of one of the changes could be considered such.
| bool reuse_values = 10; | ||
| // Force resource update through delete/recreate if needed. | ||
| bool force = 11; | ||
| // Secrets |
There was a problem hiding this comment.
Nit: Can this comment be a bit more descriptive?
| { | ||
| name: "install with multiple secrets", | ||
| args: []string{"testdata/testcharts/alpine"}, | ||
| flags: strings.Split("--set-secrets foo=bar", "--set-secrets bar=foo"), |
There was a problem hiding this comment.
I assume you meant this to be strings.Split("--set-secrets foo=bar --set-secrets bar=foo", " ")?
| if err != nil { | ||
| return err | ||
| } | ||
| rawSecrets, err := vals(u.secretFiles, u.secrets) |
There was a problem hiding this comment.
Make sure to pass secretFiles and secrets to the installCmd above. Otherwise if a user does helm upgrade --install, they won't end up using the secrets
| @@ -135,6 +135,9 @@ func LoadFiles(files []*BufferedFile) (*chart.Chart, error) { | |||
| return c, errors.New("values.toml is illegal as of 2.0.0-alpha.2") | |||
| } else if f.Name == "values.yaml" { | |||
| c.Values = &chart.Config{Raw: string(f.Data)} | |||
There was a problem hiding this comment.
Do you also need to set c.Values.Type here?
There was a problem hiding this comment.
The type will default to chart.ConfType_VALUES since it is default initialized to 0 but I can make it explicit if that would be clearer?
| // Save secrets.yaml | ||
| if c.Secrets != nil && len(c.Secrets.Raw) > 0 { | ||
| vf := filepath.Join(outdir, SecretsfileName) | ||
| if err := ioutil.WriteFile(vf, []byte(c.Secrets.Raw), 0755); err != nil { |
There was a problem hiding this comment.
Because these are secrets, it may be better to do 500 for the permissions
| return object, nil | ||
| } | ||
|
|
||
| // List returns the a of Secret. |
There was a problem hiding this comment.
Nit: Comment looks like it has a copy/paste error
There was a problem hiding this comment.
Looks like line 108 of the same file has the same typo. Not entirely sure what the word should be, probably list ?
There was a problem hiding this comment.
Yeah I think so. Some thing like "returns a list of secrets." Not going to hold up the review on this though
|
|
||
| secret, err := newSecretsObject(objkey, rls, nil) | ||
| if err != nil { | ||
| t.Fatalf("Failed to create configmap: %s", err) |
There was a problem hiding this comment.
Should be "Failed to create secret"
| } | ||
|
|
||
| // apply labels | ||
| lbs.set("NAME", rls.Name) |
There was a problem hiding this comment.
Because these are used in Secrets and ConfigMaps, it may be useful to define them as constants
| @@ -0,0 +1,262 @@ | |||
| /* | |||
| Copyright 2016 The Kubernetes Authors All rights reserved. | |||
There was a problem hiding this comment.
Should be 2017 in this and a couple other of the new files 🙂
| // SecretsDriverName is the string name of the driver. | ||
| const SecretsDriverName = "Secret" | ||
|
|
||
| // var b64 = base64.StdEncoding |
There was a problem hiding this comment.
This and the next var look like copy/paste remnants.
|
@thomastaylor312 Thank you for the comments! I apologize for the late response I've been without a computer for the last week. I'll get on these changes asap |
|
once conflicts/comments have been addressed, I'd be happy to take a look at this as well. |
There was a problem hiding this comment.
I'm concerned about the design RE: the CLI flags. Why can't we just continue to use --set and --values when the storage type is set to secrets?
I'm also concerned that this will make other storage layers like inmemory (the testing driver) and configmap (the stable storage backend) degenerate use cases since they can no longer fulfill all of the feature flags the secret storage layer provides. Perhaps we should consider tabling this until 3.0.
| f.StringVar(&inst.keyFile, "key-file", "", "identify HTTPS client using this SSL key file") | ||
| f.StringVar(&inst.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") | ||
| f.BoolVar(&inst.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-a'. If --version is set, this is ignored.") | ||
| f.Var(&inst.secretFiles, "secrets", "specify secrets in a yaml file (can specify multiple)") |
There was a problem hiding this comment.
is there any way we can make it explicit that these flags only work with tiller set to --storage=secret?
|
Now that @bacongobbler mentions it, I think that using |
thomastaylor312
left a comment
There was a problem hiding this comment.
One tiny little change I discovered during testing. Otherwise testing all checks out
|
|
||
| storageMemory = "memory" | ||
| storageConfigMap = "configmap" | ||
| storageSecret = "secret" |
There was a problem hiding this comment.
The store flag needs to be updated to show that secret is now an option
|
@thomastaylor312 @bacongobbler I agree with those points, the added CLI flags aren't necessary. I think the most important part of this PR is adding the secrets storage for releases. I can go ahead and remove those changes if that's what we decide is best. |
e39a977 to
9af1018
Compare
|
@RemingtonReackhof It isn't too much to ask someone to edit a line in the tiller deployment, but you are right in saying that it isn't ideal. We'll be adding some other flags to helm init that allow you to customize it a bit, but for now, I would just have people edit the deployment manually. @bacongobbler thoughts? |
|
@RemingtonReackhof if you added an option to I think you could just have it set the command that is used with the image explicitly in the deployment.yaml if the flag is present. Separate images shouldn't be necessary. |
|
@RemingtonReackhof So we will be merging #2557 soon. That has support for better manipulation of the Tiller manifest. You can see the docs here and can use that as a basis. Probably something using |
|
@RemingtonReackhof #2557 was merged and the docs are now available: https://github.com/kubernetes/helm/blob/master/docs/install.md#advanced-usage |
|
@thomastaylor312 with that PR it seems like we should be able to document the option and just do:
or if using curly braces works like it does for
|
|
Forgive me if I miss anything, but it looks like it doesn't implement original proposal where secrets are stored as hashes and are not retrievable by subseqent calls. If it is the case, then only difference between this storage driver and ConfigMap stroage driver is There is also no conversion from old storage to new, so I can see how it will cause major pain for anybody willing to enable this feature in existing setups. |
|
@jakehow That is correct, should be pretty simple. @redbaron This is just the first step of that proposal. Now that encrypted secrets are an option, some people will want to use it and we can implement the rest of the proposal later on. As for the conversion, that is a good point, but I am not sure if that is something that needs to go in to the release itself, but it may be useful to create a script to use out of band. Thoughts? |
I think it's completely fine (and I would prefer) to ship this as a new "experimental" storage backend with no migration story. This is already a massive addition to the codebase (thank you @RemingtonReackhof, btw) and will likely need some battle testing before we go ahead and start writing data migration scripts from configmaps to secrets. If anything that should be a follow-up PR or an out-of-band script like @thomastaylor312 mentions IMO. If we're writing data migration scripts, it's probably best to hold that off until Helm 3. |
|
@RemingtonReackhof We discussed this in the dev call and decided we are going to go ahead and merge. You have already spent a good deal of time on this PR, so one of us can add the documentation in a separate PR. |
Adds documentation for running `tiller` with the new secrets backend added in #2721
|
@bacongobbler , @thomastaylor312 this "massive addition" is a copypaste of a configmap driver, there is simply nothing to battle test, it is as robust as old driver. It adds very little value without a migration path :( |
|
@redbaron I have to disagree on that point (although it is very similar code to the config map backend). It definitely is a value add mainly because you can now encrypt |
|
|
|
@marty-stranger According to code, the PR only implements I couldn't find (as advertised in PR description) implementation for ^^ That's a confusing part about this PR to know about. |
|
How do we reference the |
Is there any guidance on this, I am also looking to use |
Implemented #2196 to add support for tiller to use secrets to store releases. This includes support for
secrets.yamluse alongside ofvalues.yaml.Reference these secrets in templates the same as values, such as
{{ .Secrets.type }}Also adds support for arguments to
installandupgradeidentical to those used by values, e.g.:--set-secrets type=ClusterIPand--secrets=mysecrets.yamlFor use of secrets storage backend in Tiller, a new option was added to the
--storageargument when starting Tiller:tiller --storage=secret