Skip to content

fix(install): use ca file for install (#7140) - #7164

Merged
mattfarina merged 2 commits into
helm:masterfrom
tychedelia:master
Mar 10, 2020
Merged

mattfarina merged 2 commits into
helm:masterfrom
tychedelia:master

Conversation

@tychedelia

Copy link
Copy Markdown
Contributor

Fixes a few bugs related to tls config when installing charts:

  1. When installing via relative path, tls config for the selected
    repository was not being set.

  2. The --ca-file flag was not being passed when constructing the
    downloader.

  3. Setting tls config was not checking for zero value in repo
    config, causing flag to get overwritten with empty string.

There's still a few oddities here. I would expect that the flag
passed in on the command line would override the repo config, but
that's not currently the case. Also, we always set the cert, key
and ca files as a trio, when they should be set individually
depending on combination of flags / repo config.

Signed-off-by: James McElwain [email protected]

@helm-bot helm-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 5, 2019
Comment thread pkg/repo/repotest/server.go Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewriting the repository file here is a little gross, but follows the pattern in other tests in chart_downloader_test.go where the server is stopped then restarted explicitly.

Comment thread pkg/downloader/chart_downloader.go Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r is not reassigned, so this line is redundant and can be removed.

@mattfarina

Copy link
Copy Markdown
Collaborator

Thanks for the PR to fix this. There is some duplication with #7071. Can you rebase and cleanup. You should be able to build off that.

@tychedelia

Copy link
Copy Markdown
Contributor Author

Huh, rebase from SvenskaSpel/helm brought in a bunch of garbage, will work to clean up...

Fixes a few bugs related to tls config when installing charts:

1. When installing via relative path, tls config for the selected
repository was not being set.

2. The `--ca-file` flag was not being passed when constructing the
downloader.

3. Setting tls config was not checking for zero value in repo
config, causing flag to get overwritten with empty string.

There's still a few oddities here. I would expect that the flag
passed in on the command line would override the repo config, but
that's not currently the case. Also, we always set the cert, key
and ca files as a trio, when they should be set individually
depending on combination of flags / repo config.

Signed-off-by: James McElwain <[email protected]>
c.Options = append(c.Options, getter.WithBasicAuth(r.Config.Username, r.Config.Password))
}

if r.Config.CertFile != "" || r.Config.KeyFile != "" || r.Config.CAFile != "" {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was missing null check from previous pr.

@kaos kaos Dec 9, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find that null check meaningful, as r could only be null if &{ ... } fails (out of memory or some such), and r.Config is the rc from the argument passed in to repo.NewChartRepository(), which can not be null at that point.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, sounds like this could be cleaned up by removing the check entirely. Just wanted to be consistent with guarding in the case it's necessary.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, there were quite a few points that could be cleaned up throughout, but didn't want to introduce to many unrelated changes..

@tychedelia

Copy link
Copy Markdown
Contributor Author

@mattfarina oops, didn't see the other PR had been merged. Just rebased and should be all clean now. Thanks!

@hickeyma

Copy link
Copy Markdown
Contributor

Closes #7140

@tychedelia

Copy link
Copy Markdown
Contributor Author

Sorry to be annoying, but is there anyway this can get reviewed and merged sometime soon? This is currently blocking our orgs internal adoption of Helm due to pervasive use of self-signed certs.

@hickeyma hickeyma added awaiting review bug Categorizes issue or PR as related to a bug. v3.x Issues and Pull Requests related to the major version v3 labels Mar 3, 2020
@hickeyma hickeyma added this to the 3.1.2 milestone Mar 3, 2020

@jdolitsky jdolitsky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems straightforward. Lgtm

Comment thread pkg/downloader/chart_downloader.go Resolved
@mattfarina

Copy link
Copy Markdown
Collaborator

@jmcelwain Thanks for the fix

@mattfarina
mattfarina merged commit 66292e5 into helm:master Mar 10, 2020
@mattfarina mattfarina added needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. picked Indicates that a PR has been cherry-picked into the next release candidate. and removed awaiting review labels Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Categorizes issue or PR as related to a bug. needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. picked Indicates that a PR has been cherry-picked into the next release candidate. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. v3.x Issues and Pull Requests related to the major version v3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants