Install or upgrade supports OCI insecure registry

Signed-off-by: pytimer <lixin20101023@gmail.com>
pull/10408/head
pytimer 4 years ago
parent 6cb14781c4
commit 2f861d4c17

@ -58,6 +58,7 @@ func addChartPathOptionsFlags(f *pflag.FlagSet, c *action.ChartPathOptions) {
f.BoolVar(&c.InsecureSkipTLSverify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the chart download")
f.StringVar(&c.CaFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle")
f.BoolVar(&c.PassCredentialsAll, "pass-credentials", false, "pass credentials to all domains")
f.BoolVar(&c.PlainHTTP, "plain-http", false, "use plain http to connect oci registry")
}
// bindOutputFlag will add the output flag to the given command and bind the

@ -81,7 +81,6 @@ func newPullCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
f.BoolVar(&client.VerifyLater, "prov", false, "fetch the provenance file, but don't perform verification")
f.StringVar(&client.UntarDir, "untardir", ".", "if untar is specified, this flag specifies the name of the directory into which the chart is expanded")
f.StringVarP(&client.DestDir, "destination", "d", ".", "location to write the chart. If this and tardir are specified, tardir is appended to this")
f.BoolVar(&client.PlainHTTP, "plain-http", false, "use plain http and not https to connect oci registry")
addChartPathOptionsFlags(f, &client.ChartPathOptions)
err := cmd.RegisterFlagCompletionFunc("version", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {

@ -117,6 +117,7 @@ type ChartPathOptions struct {
Username string // --username
Verify bool // --verify
Version string // --version
PlainHTTP bool // --plain-http
// registryClient provides a registry client but is not added with
// options from a flag
@ -694,6 +695,12 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) (
return name, errors.Errorf("path %q not found", name)
}
if c.InsecureSkipTLSverify {
if err := c.registryClient.WithResolver(c.InsecureSkipTLSverify, c.PlainHTTP); err != nil {
return "", err
}
}
dl := downloader.ChartDownloader{
Out: os.Stdout,
Keyring: c.Keyring,

Loading…
Cancel
Save