diff --git a/internal/tlsutil/tls.go b/internal/tlsutil/tls.go index 645834c29..88f26d47b 100644 --- a/internal/tlsutil/tls.go +++ b/internal/tlsutil/tls.go @@ -26,16 +26,16 @@ import ( ) type TLSConfigOptions struct { - insecureSkipTLSverify bool + insecureSkipTLSVerify bool certPEMBlock, keyPEMBlock []byte caPEMBlock []byte } type TLSConfigOption func(options *TLSConfigOptions) error -func WithInsecureSkipVerify(insecureSkipTLSverify bool) TLSConfigOption { +func WithInsecureSkipVerify(insecureSkipTLSVerify bool) TLSConfigOption { return func(options *TLSConfigOptions) error { - options.insecureSkipTLSverify = insecureSkipTLSverify + options.insecureSkipTLSVerify = insecureSkipTLSVerify return nil } @@ -97,7 +97,7 @@ func NewTLSConfig(options ...TLSConfigOption) (*tls.Config, error) { } config := tls.Config{ - InsecureSkipVerify: to.insecureSkipTLSverify, + InsecureSkipVerify: to.insecureSkipTLSVerify, } if len(to.certPEMBlock) > 0 && len(to.keyPEMBlock) > 0 { diff --git a/internal/tlsutil/tls_test.go b/internal/tlsutil/tls_test.go index 3d7e75c86..f16eb218f 100644 --- a/internal/tlsutil/tls_test.go +++ b/internal/tlsutil/tls_test.go @@ -42,11 +42,11 @@ func TestNewTLSConfig(t *testing.T) { certFile := testfile(t, testCertFile) keyFile := testfile(t, testKeyFile) caCertFile := testfile(t, testCaCertFile) - insecureSkipTLSverify := false + insecureSkipTLSVerify := false { cfg, err := NewTLSConfig( - WithInsecureSkipVerify(insecureSkipTLSverify), + WithInsecureSkipVerify(insecureSkipTLSVerify), WithCertKeyPairFiles(certFile, keyFile), WithCAFile(caCertFile), ) @@ -66,7 +66,7 @@ func TestNewTLSConfig(t *testing.T) { } { cfg, err := NewTLSConfig( - WithInsecureSkipVerify(insecureSkipTLSverify), + WithInsecureSkipVerify(insecureSkipTLSVerify), WithCAFile(caCertFile), ) if err != nil { @@ -86,7 +86,7 @@ func TestNewTLSConfig(t *testing.T) { { cfg, err := NewTLSConfig( - WithInsecureSkipVerify(insecureSkipTLSverify), + WithInsecureSkipVerify(insecureSkipTLSVerify), WithCertKeyPairFiles(certFile, keyFile), ) if err != nil { diff --git a/pkg/action/dependency.go b/pkg/action/dependency.go index 03c370c8e..b12887bde 100644 --- a/pkg/action/dependency.go +++ b/pkg/action/dependency.go @@ -43,7 +43,7 @@ type Dependency struct { CertFile string KeyFile string CaFile string - InsecureSkipTLSverify bool + InsecureSkipTLSVerify bool PlainHTTP bool } diff --git a/pkg/action/install.go b/pkg/action/install.go index d4ab63ac9..9008c06ec 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -139,7 +139,7 @@ type ChartPathOptions struct { CaFile string // --ca-file CertFile string // --cert-file KeyFile string // --key-file - InsecureSkipTLSverify bool // --insecure-skip-verify + InsecureSkipTLSVerify bool // --insecure-skip-verify PlainHTTP bool // --plain-http Keyring string // --keyring Password string // --password @@ -886,7 +886,7 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) ( Options: []getter.Option{ getter.WithPassCredentialsAll(c.PassCredentialsAll), getter.WithTLSClientConfig(c.CertFile, c.KeyFile, c.CaFile), - getter.WithInsecureSkipVerifyTLS(c.InsecureSkipTLSverify), + getter.WithInsecureSkipVerifyTLS(c.InsecureSkipTLSVerify), getter.WithPlainHTTP(c.PlainHTTP), getter.WithBasicAuth(c.Username, c.Password), }, @@ -911,7 +911,7 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) ( repo.WithChartVersion(version), repo.WithClientTLS(c.CertFile, c.KeyFile, c.CaFile), repo.WithUsernamePassword(c.Username, c.Password), - repo.WithInsecureSkipTLSverify(c.InsecureSkipTLSverify), + repo.WithInsecureSkipTLSVerify(c.InsecureSkipTLSVerify), repo.WithPassCredentialsAll(c.PassCredentialsAll), ) if err != nil { diff --git a/pkg/action/package.go b/pkg/action/package.go index 92a9a8cb6..963883707 100644 --- a/pkg/action/package.go +++ b/pkg/action/package.go @@ -57,7 +57,7 @@ type Package struct { CertFile string KeyFile string CaFile string - InsecureSkipTLSverify bool + InsecureSkipTLSVerify bool } const ( diff --git a/pkg/action/pull.go b/pkg/action/pull.go index be71d0ed0..dd051167b 100644 --- a/pkg/action/pull.go +++ b/pkg/action/pull.go @@ -82,7 +82,7 @@ func (p *Pull) Run(chartRef string) (string, error) { getter.WithBasicAuth(p.Username, p.Password), getter.WithPassCredentialsAll(p.PassCredentialsAll), getter.WithTLSClientConfig(p.CertFile, p.KeyFile, p.CaFile), - getter.WithInsecureSkipVerifyTLS(p.InsecureSkipTLSverify), + getter.WithInsecureSkipVerifyTLS(p.InsecureSkipTLSVerify), getter.WithPlainHTTP(p.PlainHTTP), }, RegistryClient: p.cfg.RegistryClient, @@ -124,7 +124,7 @@ func (p *Pull) Run(chartRef string) (string, error) { repo.WithChartVersion(p.Version), repo.WithClientTLS(p.CertFile, p.KeyFile, p.CaFile), repo.WithUsernamePassword(p.Username, p.Password), - repo.WithInsecureSkipTLSverify(p.InsecureSkipTLSverify), + repo.WithInsecureSkipTLSVerify(p.InsecureSkipTLSVerify), repo.WithPassCredentialsAll(p.PassCredentialsAll), ) if err != nil { diff --git a/pkg/action/push.go b/pkg/action/push.go index 35472415c..0c7148f65 100644 --- a/pkg/action/push.go +++ b/pkg/action/push.go @@ -35,7 +35,7 @@ type Push struct { certFile string keyFile string caFile string - insecureSkipTLSverify bool + insecureSkipTLSVerify bool plainHTTP bool out io.Writer } @@ -62,7 +62,7 @@ func WithTLSClientConfig(certFile, keyFile, caFile string) PushOpt { // WithInsecureSkipTLSVerify determines if a TLS Certificate will be checked func WithInsecureSkipTLSVerify(insecureSkipTLSVerify bool) PushOpt { return func(p *Push) { - p.insecureSkipTLSverify = insecureSkipTLSVerify + p.insecureSkipTLSVerify = insecureSkipTLSVerify } } @@ -98,7 +98,7 @@ func (p *Push) Run(chartRef string, remote string) (string, error) { Pushers: pusher.All(p.Settings), Options: []pusher.Option{ pusher.WithTLSClientConfig(p.certFile, p.keyFile, p.caFile), - pusher.WithInsecureSkipTLSVerify(p.insecureSkipTLSverify), + pusher.WithInsecureSkipTLSVerify(p.insecureSkipTLSVerify), pusher.WithPlainHTTP(p.plainHTTP), }, } diff --git a/pkg/cmd/dependency.go b/pkg/cmd/dependency.go index 34bbff6be..5978c902a 100644 --- a/pkg/cmd/dependency.go +++ b/pkg/cmd/dependency.go @@ -130,7 +130,7 @@ func addDependencySubcommandFlags(f *pflag.FlagSet, client *action.Dependency) { f.StringVar(&client.Password, "password", "", "chart repository password where to locate the requested chart") f.StringVar(&client.CertFile, "cert-file", "", "identify HTTPS client using this SSL certificate file") f.StringVar(&client.KeyFile, "key-file", "", "identify HTTPS client using this SSL key file") - f.BoolVar(&client.InsecureSkipTLSverify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the chart download") + f.BoolVar(&client.InsecureSkipTLSVerify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the chart download") f.BoolVar(&client.PlainHTTP, "plain-http", false, "use insecure HTTP connections for the chart download") f.StringVar(&client.CaFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") } diff --git a/pkg/cmd/dependency_build.go b/pkg/cmd/dependency_build.go index 320fe12ae..7e5c731b7 100644 --- a/pkg/cmd/dependency_build.go +++ b/pkg/cmd/dependency_build.go @@ -55,7 +55,7 @@ func newDependencyBuildCmd(out io.Writer) *cobra.Command { chartpath = filepath.Clean(args[0]) } registryClient, err := newRegistryClient(client.CertFile, client.KeyFile, client.CaFile, - client.InsecureSkipTLSverify, client.PlainHTTP, client.Username, client.Password) + client.InsecureSkipTLSVerify, client.PlainHTTP, client.Username, client.Password) if err != nil { return fmt.Errorf("missing registry client: %w", err) } diff --git a/pkg/cmd/dependency_update.go b/pkg/cmd/dependency_update.go index b534fb48a..7f805c37b 100644 --- a/pkg/cmd/dependency_update.go +++ b/pkg/cmd/dependency_update.go @@ -59,7 +59,7 @@ func newDependencyUpdateCmd(_ *action.Configuration, out io.Writer) *cobra.Comma chartpath = filepath.Clean(args[0]) } registryClient, err := newRegistryClient(client.CertFile, client.KeyFile, client.CaFile, - client.InsecureSkipTLSverify, client.PlainHTTP, client.Username, client.Password) + client.InsecureSkipTLSVerify, client.PlainHTTP, client.Username, client.Password) if err != nil { return fmt.Errorf("missing registry client: %w", err) } diff --git a/pkg/cmd/flags.go b/pkg/cmd/flags.go index b20772ef9..5836a6af9 100644 --- a/pkg/cmd/flags.go +++ b/pkg/cmd/flags.go @@ -110,7 +110,7 @@ func addChartPathOptionsFlags(f *pflag.FlagSet, c *action.ChartPathOptions) { f.StringVar(&c.Password, "password", "", "chart repository password where to locate the requested chart") f.StringVar(&c.CertFile, "cert-file", "", "identify HTTPS client using this SSL certificate file") f.StringVar(&c.KeyFile, "key-file", "", "identify HTTPS client using this SSL key file") - f.BoolVar(&c.InsecureSkipTLSverify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the chart download") + f.BoolVar(&c.InsecureSkipTLSVerify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the chart download") f.BoolVar(&c.PlainHTTP, "plain-http", false, "use insecure HTTP connections 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") diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go index 295f1ae37..e5d311394 100644 --- a/pkg/cmd/install.go +++ b/pkg/cmd/install.go @@ -144,7 +144,7 @@ func newInstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { }, RunE: func(cmd *cobra.Command, args []string) error { registryClient, err := newRegistryClient(client.CertFile, client.KeyFile, client.CaFile, - client.InsecureSkipTLSverify, client.PlainHTTP, client.Username, client.Password) + client.InsecureSkipTLSVerify, client.PlainHTTP, client.Username, client.Password) if err != nil { return fmt.Errorf("missing registry client: %w", err) } diff --git a/pkg/cmd/package.go b/pkg/cmd/package.go index fc56e936a..36a7dff73 100644 --- a/pkg/cmd/package.go +++ b/pkg/cmd/package.go @@ -76,7 +76,7 @@ func newPackageCmd(out io.Writer) *cobra.Command { } registryClient, err := newRegistryClient(client.CertFile, client.KeyFile, client.CaFile, - client.InsecureSkipTLSverify, client.PlainHTTP, client.Username, client.Password) + client.InsecureSkipTLSVerify, client.PlainHTTP, client.Username, client.Password) if err != nil { return fmt.Errorf("missing registry client: %w", err) } @@ -130,7 +130,7 @@ func newPackageCmd(out io.Writer) *cobra.Command { f.StringVar(&client.Password, "password", "", "chart repository password where to locate the requested chart") f.StringVar(&client.CertFile, "cert-file", "", "identify HTTPS client using this SSL certificate file") f.StringVar(&client.KeyFile, "key-file", "", "identify HTTPS client using this SSL key file") - f.BoolVar(&client.InsecureSkipTLSverify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the chart download") + f.BoolVar(&client.InsecureSkipTLSVerify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the chart download") f.BoolVar(&client.PlainHTTP, "plain-http", false, "use insecure HTTP connections for the chart download") f.StringVar(&client.CaFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") diff --git a/pkg/cmd/plugin_install.go b/pkg/cmd/plugin_install.go index 0abefa76b..a45c4a3de 100644 --- a/pkg/cmd/plugin_install.go +++ b/pkg/cmd/plugin_install.go @@ -40,7 +40,7 @@ type pluginInstallOptions struct { certFile string keyFile string caFile string - insecureSkipTLSverify bool + insecureSkipTLSVerify bool plainHTTP bool password string username string @@ -88,7 +88,7 @@ func newPluginInstallCmd(out io.Writer) *cobra.Command { cmd.Flags().StringVar(&o.certFile, "cert-file", "", "identify registry client using this SSL certificate file") cmd.Flags().StringVar(&o.keyFile, "key-file", "", "identify registry client using this SSL key file") cmd.Flags().StringVar(&o.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") - cmd.Flags().BoolVar(&o.insecureSkipTLSverify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the plugin download") + cmd.Flags().BoolVar(&o.insecureSkipTLSVerify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the plugin download") cmd.Flags().BoolVar(&o.plainHTTP, "plain-http", false, "use insecure HTTP connections for the plugin download") cmd.Flags().StringVar(&o.username, "username", "", "registry username") cmd.Flags().StringVar(&o.password, "password", "", "registry password") @@ -106,7 +106,7 @@ func (o *pluginInstallOptions) newInstallerForSource() (installer.Installer, err // Build getter options for OCI options := []getter.Option{ getter.WithTLSClientConfig(o.certFile, o.keyFile, o.caFile), - getter.WithInsecureSkipVerifyTLS(o.insecureSkipTLSverify), + getter.WithInsecureSkipVerifyTLS(o.insecureSkipTLSVerify), getter.WithPlainHTTP(o.plainHTTP), getter.WithBasicAuth(o.username, o.password), } diff --git a/pkg/cmd/pull.go b/pkg/cmd/pull.go index e3d93c049..922698c6c 100644 --- a/pkg/cmd/pull.go +++ b/pkg/cmd/pull.go @@ -66,7 +66,7 @@ func newPullCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { } registryClient, err := newRegistryClient(client.CertFile, client.KeyFile, client.CaFile, - client.InsecureSkipTLSverify, client.PlainHTTP, client.Username, client.Password) + client.InsecureSkipTLSVerify, client.PlainHTTP, client.Username, client.Password) if err != nil { return fmt.Errorf("missing registry client: %w", err) } diff --git a/pkg/cmd/push.go b/pkg/cmd/push.go index 94d322b9d..f57a7c52f 100644 --- a/pkg/cmd/push.go +++ b/pkg/cmd/push.go @@ -38,7 +38,7 @@ type registryPushOptions struct { certFile string keyFile string caFile string - insecureSkipTLSverify bool + insecureSkipTLSVerify bool plainHTTP bool password string username string @@ -71,7 +71,7 @@ func newPushCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { }, RunE: func(_ *cobra.Command, args []string) error { registryClient, err := newRegistryClient( - o.certFile, o.keyFile, o.caFile, o.insecureSkipTLSverify, o.plainHTTP, o.username, o.password, + o.certFile, o.keyFile, o.caFile, o.insecureSkipTLSVerify, o.plainHTTP, o.username, o.password, ) if err != nil { @@ -82,7 +82,7 @@ func newPushCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { remote := args[1] client := action.NewPushWithOpts(action.WithPushConfig(cfg), action.WithTLSClientConfig(o.certFile, o.keyFile, o.caFile), - action.WithInsecureSkipTLSVerify(o.insecureSkipTLSverify), + action.WithInsecureSkipTLSVerify(o.insecureSkipTLSVerify), action.WithPlainHTTP(o.plainHTTP), action.WithPushOptWriter(out)) client.Settings = settings @@ -99,7 +99,7 @@ func newPushCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f.StringVar(&o.certFile, "cert-file", "", "identify registry client using this SSL certificate file") f.StringVar(&o.keyFile, "key-file", "", "identify registry client using this SSL key file") f.StringVar(&o.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") - f.BoolVar(&o.insecureSkipTLSverify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the chart upload") + f.BoolVar(&o.insecureSkipTLSVerify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the chart upload") f.BoolVar(&o.plainHTTP, "plain-http", false, "use insecure HTTP connections for the chart upload") f.StringVar(&o.username, "username", "", "chart repository username where to locate the requested chart") f.StringVar(&o.password, "password", "", "chart repository password where to locate the requested chart") diff --git a/pkg/cmd/repo_add.go b/pkg/cmd/repo_add.go index 00e698daf..3fc1a7249 100644 --- a/pkg/cmd/repo_add.go +++ b/pkg/cmd/repo_add.go @@ -57,7 +57,7 @@ type repoAddOptions struct { certFile string keyFile string caFile string - insecureSkipTLSverify bool + insecureSkipTLSVerify bool repoFile string repoCache string @@ -94,7 +94,7 @@ func newRepoAddCmd(out io.Writer) *cobra.Command { f.StringVar(&o.certFile, "cert-file", "", "identify HTTPS client using this SSL certificate file") f.StringVar(&o.keyFile, "key-file", "", "identify HTTPS client using this SSL key file") f.StringVar(&o.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") - f.BoolVar(&o.insecureSkipTLSverify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the repository") + f.BoolVar(&o.insecureSkipTLSVerify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the repository") f.BoolVar(&o.allowDeprecatedRepos, "allow-deprecated-repos", false, "by default, this command will not allow adding official repos that have been permanently deleted. This disables that behavior") f.BoolVar(&o.passCredentialsAll, "pass-credentials", false, "pass credentials to all domains") f.DurationVar(&o.timeout, "timeout", getter.DefaultHTTPTimeout*time.Second, "time to wait for the index file download to complete") @@ -177,7 +177,7 @@ func (o *repoAddOptions) run(out io.Writer) error { CertFile: o.certFile, KeyFile: o.keyFile, CAFile: o.caFile, - InsecureSkipTLSverify: o.insecureSkipTLSverify, + InsecureSkipTLSVerify: o.insecureSkipTLSVerify, } // Check if the repo name is legal diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go index c23362628..b64118a50 100644 --- a/pkg/cmd/root.go +++ b/pkg/cmd/root.go @@ -393,10 +393,10 @@ func checkForExpiredRepos(repofile string) { } func newRegistryClient( - certFile, keyFile, caFile string, insecureSkipTLSverify, plainHTTP bool, username, password string, + certFile, keyFile, caFile string, insecureSkipTLSVerify, plainHTTP bool, username, password string, ) (*registry.Client, error) { - if certFile != "" && keyFile != "" || caFile != "" || insecureSkipTLSverify { - registryClient, err := newRegistryClientWithTLS(certFile, keyFile, caFile, insecureSkipTLSverify, username, password) + if certFile != "" && keyFile != "" || caFile != "" || insecureSkipTLSVerify { + registryClient, err := newRegistryClientWithTLS(certFile, keyFile, caFile, insecureSkipTLSVerify, username, password) if err != nil { return nil, err } @@ -430,10 +430,10 @@ func newDefaultRegistryClient(plainHTTP bool, username, password string) (*regis } func newRegistryClientWithTLS( - certFile, keyFile, caFile string, insecureSkipTLSverify bool, username, password string, + certFile, keyFile, caFile string, insecureSkipTLSVerify bool, username, password string, ) (*registry.Client, error) { tlsConf, err := tlsutil.NewTLSConfig( - tlsutil.WithInsecureSkipVerify(insecureSkipTLSverify), + tlsutil.WithInsecureSkipVerify(insecureSkipTLSVerify), tlsutil.WithCertKeyPairFiles(certFile, keyFile), tlsutil.WithCAFile(caFile), ) diff --git a/pkg/cmd/show.go b/pkg/cmd/show.go index 1c7e7be44..d7249c3fe 100644 --- a/pkg/cmd/show.go +++ b/pkg/cmd/show.go @@ -227,7 +227,7 @@ func runShow(args []string, client *action.Show) (string, error) { func addRegistryClient(client *action.Show) error { registryClient, err := newRegistryClient(client.CertFile, client.KeyFile, client.CaFile, - client.InsecureSkipTLSverify, client.PlainHTTP, client.Username, client.Password) + client.InsecureSkipTLSVerify, client.PlainHTTP, client.Username, client.Password) if err != nil { return fmt.Errorf("missing registry client: %w", err) } diff --git a/pkg/cmd/template.go b/pkg/cmd/template.go index 3ede31077..cf68c6c46 100644 --- a/pkg/cmd/template.go +++ b/pkg/cmd/template.go @@ -76,7 +76,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { } registryClient, err := newRegistryClient(client.CertFile, client.KeyFile, client.CaFile, - client.InsecureSkipTLSverify, client.PlainHTTP, client.Username, client.Password) + client.InsecureSkipTLSVerify, client.PlainHTTP, client.Username, client.Password) if err != nil { return fmt.Errorf("missing registry client: %w", err) } diff --git a/pkg/cmd/upgrade.go b/pkg/cmd/upgrade.go index f32493e87..92f130f60 100644 --- a/pkg/cmd/upgrade.go +++ b/pkg/cmd/upgrade.go @@ -105,7 +105,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { client.Namespace = settings.Namespace() registryClient, err := newRegistryClient(client.CertFile, client.KeyFile, client.CaFile, - client.InsecureSkipTLSverify, client.PlainHTTP, client.Username, client.Password) + client.InsecureSkipTLSVerify, client.PlainHTTP, client.Username, client.Password) if err != nil { return fmt.Errorf("missing registry client: %w", err) } diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index d41b8fdb4..6043fbaaa 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -315,7 +315,7 @@ func (m *Manager) downloadAll(deps []*chart.Dependency) error { // Any failure to resolve/download a chart should fail: // https://github.com/helm/helm/issues/1439 - churl, username, password, insecureskiptlsverify, passcredentialsall, caFile, certFile, keyFile, err := m.findChartURL(dep.Name, dep.Version, dep.Repository, repos) + churl, username, password, insecureSkipTLSVerify, passCredentialsAll, caFile, certFile, keyFile, err := m.findChartURL(dep.Name, dep.Version, dep.Repository, repos) if err != nil { saveError = fmt.Errorf("could not find %s: %w", churl, err) break @@ -339,8 +339,8 @@ func (m *Manager) downloadAll(deps []*chart.Dependency) error { Getters: m.Getters, Options: []getter.Option{ getter.WithBasicAuth(username, password), - getter.WithPassCredentialsAll(passcredentialsall), - getter.WithInsecureSkipVerifyTLS(insecureskiptlsverify), + getter.WithPassCredentialsAll(passCredentialsAll), + getter.WithInsecureSkipVerifyTLS(insecureSkipTLSVerify), getter.WithTLSClientConfig(certFile, keyFile, caFile), }, } @@ -725,7 +725,7 @@ func (m *Manager) parallelRepoUpdate(repos []*repo.Entry) error { // repoURL is the repository to search // // If it finds a URL that is "relative", it will prepend the repoURL. -func (m *Manager) findChartURL(name, version, repoURL string, repos map[string]*repo.ChartRepository) (url, username, password string, insecureskiptlsverify, passcredentialsall bool, caFile, certFile, keyFile string, err error) { +func (m *Manager) findChartURL(name, version, repoURL string, repos map[string]*repo.ChartRepository) (url, username, password string, insecureSkipTLSVerify, passCredentialsAll bool, caFile, certFile, keyFile string, err error) { if registry.IsOCI(repoURL) { return fmt.Sprintf("%s/%s:%s", repoURL, name, version), "", "", false, false, "", "", "", nil } @@ -754,8 +754,8 @@ func (m *Manager) findChartURL(name, version, repoURL string, repos map[string]* } username = cr.Config.Username password = cr.Config.Password - passcredentialsall = cr.Config.PassCredentialsAll - insecureskiptlsverify = cr.Config.InsecureSkipTLSverify + passCredentialsAll = cr.Config.PassCredentialsAll + insecureSkipTLSVerify = cr.Config.InsecureSkipTLSVerify caFile = cr.Config.CAFile certFile = cr.Config.CertFile keyFile = cr.Config.KeyFile diff --git a/pkg/getter/httpgetter_test.go b/pkg/getter/httpgetter_test.go index 96bfa1ece..b27b9f5d2 100644 --- a/pkg/getter/httpgetter_test.go +++ b/pkg/getter/httpgetter_test.go @@ -306,11 +306,11 @@ func TestDownload(t *testing.T) { func TestDownloadTLS(t *testing.T) { cd := "../../testdata" ca, pub, priv := filepath.Join(cd, "rootca.crt"), filepath.Join(cd, "crt.pem"), filepath.Join(cd, "key.pem") - insecureSkipTLSverify := false + insecureSkipTLSVerify := false tlsSrv := httptest.NewUnstartedServer(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {})) tlsConf, err := tlsutil.NewTLSConfig( - tlsutil.WithInsecureSkipVerify(insecureSkipTLSverify), + tlsutil.WithInsecureSkipVerify(insecureSkipTLSVerify), tlsutil.WithCertKeyPairFiles(pub, priv), tlsutil.WithCAFile(ca), ) @@ -359,14 +359,14 @@ func TestDownloadTLS(t *testing.T) { func TestDownloadTLSWithRedirect(t *testing.T) { cd := "../../testdata" srv2Resp := "hello" - insecureSkipTLSverify := false + insecureSkipTLSVerify := false // Server 2 that will actually fulfil the request. ca, pub, priv := filepath.Join(cd, "rootca.crt"), filepath.Join(cd, "localhost-crt.pem"), filepath.Join(cd, "key.pem") tlsConf, err := tlsutil.NewTLSConfig( tlsutil.WithCAFile(ca), tlsutil.WithCertKeyPairFiles(pub, priv), - tlsutil.WithInsecureSkipVerify(insecureSkipTLSverify), + tlsutil.WithInsecureSkipVerify(insecureSkipTLSVerify), ) if err != nil { @@ -387,7 +387,7 @@ func TestDownloadTLSWithRedirect(t *testing.T) { tlsConf, err = tlsutil.NewTLSConfig( tlsutil.WithCAFile(ca), tlsutil.WithCertKeyPairFiles(pub, priv), - tlsutil.WithInsecureSkipVerify(insecureSkipTLSverify), + tlsutil.WithInsecureSkipVerify(insecureSkipTLSVerify), ) if err != nil { diff --git a/pkg/pusher/ocipusher.go b/pkg/pusher/ocipusher.go index 25682969b..f03188391 100644 --- a/pkg/pusher/ocipusher.go +++ b/pkg/pusher/ocipusher.go @@ -109,9 +109,9 @@ func NewOCIPusher(ops ...Option) (Pusher, error) { } func (pusher *OCIPusher) newRegistryClient() (*registry.Client, error) { - if (pusher.opts.certFile != "" && pusher.opts.keyFile != "") || pusher.opts.caFile != "" || pusher.opts.insecureSkipTLSverify { + if (pusher.opts.certFile != "" && pusher.opts.keyFile != "") || pusher.opts.caFile != "" || pusher.opts.insecureSkipTLSVerify { tlsConf, err := tlsutil.NewTLSConfig( - tlsutil.WithInsecureSkipVerify(pusher.opts.insecureSkipTLSverify), + tlsutil.WithInsecureSkipVerify(pusher.opts.insecureSkipTLSVerify), tlsutil.WithCertKeyPairFiles(pusher.opts.certFile, pusher.opts.keyFile), tlsutil.WithCAFile(pusher.opts.caFile), ) diff --git a/pkg/pusher/ocipusher_test.go b/pkg/pusher/ocipusher_test.go index 24f52a7ad..b7d362681 100644 --- a/pkg/pusher/ocipusher_test.go +++ b/pkg/pusher/ocipusher_test.go @@ -40,13 +40,13 @@ func TestNewOCIPusher(t *testing.T) { cd := "../../testdata" join := filepath.Join ca, pub, priv := join(cd, "rootca.crt"), join(cd, "crt.pem"), join(cd, "key.pem") - insecureSkipTLSverify := false + insecureSkipTLSVerify := false plainHTTP := false // Test with options p, err = NewOCIPusher( WithTLSClientConfig(pub, priv, ca), - WithInsecureSkipTLSVerify(insecureSkipTLSverify), + WithInsecureSkipTLSVerify(insecureSkipTLSVerify), WithPlainHTTP(plainHTTP), ) if err != nil { @@ -74,8 +74,8 @@ func TestNewOCIPusher(t *testing.T) { t.Errorf("Expected NewOCIPusher to have plainHTTP as %t, got %t", plainHTTP, op.opts.plainHTTP) } - if op.opts.insecureSkipTLSverify != insecureSkipTLSverify { - t.Errorf("Expected NewOCIPusher to have insecureSkipVerifyTLS as %t, got %t", insecureSkipTLSverify, op.opts.insecureSkipTLSverify) + if op.opts.insecureSkipTLSVerify != insecureSkipTLSVerify { + t.Errorf("Expected NewOCIPusher to have insecureSkipVerifyTLS as %t, got %t", insecureSkipTLSVerify, op.opts.insecureSkipTLSVerify) } // Test if setting registryClient is being passed to the ops @@ -422,7 +422,7 @@ func TestOCIPusher_Push_MultipleOptions(t *testing.T) { if !op.opts.plainHTTP { t.Error("Expected plainHTTP option to be applied") } - if !op.opts.insecureSkipTLSverify { - t.Error("Expected insecureSkipTLSverify option to be applied") + if !op.opts.insecureSkipTLSVerify { + t.Error("Expected insecureSkipTLSVerify option to be applied") } } diff --git a/pkg/pusher/pusher.go b/pkg/pusher/pusher.go index e3c767be9..8ce78b011 100644 --- a/pkg/pusher/pusher.go +++ b/pkg/pusher/pusher.go @@ -32,7 +32,7 @@ type options struct { certFile string keyFile string caFile string - insecureSkipTLSverify bool + insecureSkipTLSVerify bool plainHTTP bool } @@ -59,7 +59,7 @@ func WithTLSClientConfig(certFile, keyFile, caFile string) Option { // WithInsecureSkipTLSVerify determines if a TLS Certificate will be checked func WithInsecureSkipTLSVerify(insecureSkipTLSVerify bool) Option { return func(opts *options) { - opts.insecureSkipTLSverify = insecureSkipTLSVerify + opts.insecureSkipTLSVerify = insecureSkipTLSVerify } } diff --git a/pkg/repo/v1/chartrepo.go b/pkg/repo/v1/chartrepo.go index 95c04ccef..1db913322 100644 --- a/pkg/repo/v1/chartrepo.go +++ b/pkg/repo/v1/chartrepo.go @@ -41,7 +41,7 @@ type Entry struct { CertFile string `json:"certFile"` KeyFile string `json:"keyFile"` CAFile string `json:"caFile"` - InsecureSkipTLSverify bool `json:"insecure_skip_tls_verify"` + InsecureSkipTLSVerify bool `json:"insecure_skip_tls_verify"` PassCredentialsAll bool `json:"pass_credentials_all"` } @@ -82,7 +82,7 @@ func (r *ChartRepository) DownloadIndexFile() (string, error) { resp, err := r.Client.Get(indexURL, getter.WithURL(r.Config.URL), - getter.WithInsecureSkipVerifyTLS(r.Config.InsecureSkipTLSverify), + getter.WithInsecureSkipVerifyTLS(r.Config.InsecureSkipTLSVerify), getter.WithTLSClientConfig(r.Config.CertFile, r.Config.KeyFile, r.Config.CAFile), getter.WithBasicAuth(r.Config.Username, r.Config.Password), getter.WithPassCredentialsAll(r.Config.PassCredentialsAll), @@ -120,7 +120,7 @@ type findChartInRepoURLOptions struct { Username string Password string PassCredentialsAll bool - InsecureSkipTLSverify bool + InsecureSkipTLSVerify bool CertFile string KeyFile string CAFile string @@ -160,10 +160,10 @@ func WithClientTLS(certFile, keyFile, caFile string) FindChartInRepoURLOption { } } -// WithInsecureSkipTLSverify skips TLS verification for repository communication -func WithInsecureSkipTLSverify(insecureSkipTLSverify bool) FindChartInRepoURLOption { +// WithInsecureSkipTLSVerify skips TLS verification for repository communication +func WithInsecureSkipTLSVerify(insecureSkipTLSVerify bool) FindChartInRepoURLOption { return func(options *findChartInRepoURLOptions) { - options.InsecureSkipTLSverify = insecureSkipTLSverify + options.InsecureSkipTLSVerify = insecureSkipTLSVerify } } @@ -190,7 +190,7 @@ func FindChartInRepoURL(repoURL string, chartName string, getters getter.Provide KeyFile: opts.KeyFile, CAFile: opts.CAFile, Name: name, - InsecureSkipTLSverify: opts.InsecureSkipTLSverify, + InsecureSkipTLSVerify: opts.InsecureSkipTLSVerify, } r, err := NewChartRepository(&c, getters) if err != nil { diff --git a/pkg/repo/v1/chartrepo_test.go b/pkg/repo/v1/chartrepo_test.go index 05e034dd8..e4e76646a 100644 --- a/pkg/repo/v1/chartrepo_test.go +++ b/pkg/repo/v1/chartrepo_test.go @@ -132,7 +132,7 @@ func TestFindChartInAuthAndTLSAndPassRepoURL(t *testing.T) { srv.URL, "nginx", getter.All(&cli.EnvSettings{}), - WithInsecureSkipTLSverify(true), + WithInsecureSkipTLSVerify(true), ) if err != nil { t.Fatalf("%v", err)