MCPcopy
hub / github.com/helm/helm / newRegistryClientWithTLS

Function newRegistryClientWithTLS

pkg/cmd/root.go:442–473  ·  view source on GitHub ↗
(
	out io.Writer, certFile, keyFile, caFile string, insecureSkipTLSVerify bool, username, password string,
)

Source from the content-addressed store, hash-verified

440}
441
442func newRegistryClientWithTLS(
443 out io.Writer, certFile, keyFile, caFile string, insecureSkipTLSVerify bool, username, password string,
444) (*registry.Client, error) {
445 tlsConf, err := tlsutil.NewTLSConfig(
446 tlsutil.WithInsecureSkipVerify(insecureSkipTLSVerify),
447 tlsutil.WithCertKeyPairFiles(certFile, keyFile),
448 tlsutil.WithCAFile(caFile),
449 )
450
451 if err != nil {
452 return nil, fmt.Errorf("can't create TLS config for client: %w", err)
453 }
454
455 // Create a new registry client
456 registryClient, err := registry.NewClient(
457 registry.ClientOptDebug(settings.Debug),
458 registry.ClientOptEnableCache(true),
459 registry.ClientOptWriter(out),
460 registry.ClientOptCredentialsFile(settings.RegistryConfig),
461 registry.ClientOptHTTPClient(&http.Client{
462 Transport: &http.Transport{
463 TLSClientConfig: tlsConf,
464 Proxy: http.ProxyFromEnvironment,
465 },
466 }),
467 registry.ClientOptBasicAuth(username, password),
468 )
469 if err != nil {
470 return nil, err
471 }
472 return registryClient, nil
473}
474
475type CommandError struct {
476 error

Callers 1

newRegistryClientFunction · 0.85

Calls 11

NewTLSConfigFunction · 0.92
WithInsecureSkipVerifyFunction · 0.92
WithCertKeyPairFilesFunction · 0.92
WithCAFileFunction · 0.92
NewClientFunction · 0.92
ClientOptDebugFunction · 0.92
ClientOptEnableCacheFunction · 0.92
ClientOptWriterFunction · 0.92
ClientOptCredentialsFileFunction · 0.92
ClientOptHTTPClientFunction · 0.92
ClientOptBasicAuthFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…