Skip to content

Commit

Permalink
added insecure flag for helm factory
Browse files Browse the repository at this point in the history
  • Loading branch information
cxbrowne1207 committed Dec 7, 2023
1 parent 508fae6 commit 5494db2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/dependencies/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,8 @@ func (f *Factory) WithHelmFactory(opts ...executables.HelmOpt) *Factory {

f.dependencies.HelmFactory = NewHelmFactory(f.executablesConfig.builder).
WithRegistryMirror(f.registryMirror).
WithProxyConfigurations(f.proxyConfiguration)
WithProxyConfigurations(f.proxyConfiguration).
WithInsecure()
return nil
})

Expand Down Expand Up @@ -863,7 +864,7 @@ func (f *Factory) WithCNIInstaller(spec *cluster.Spec, provider providers.Provid
}

func (f *Factory) WithCiliumTemplater() *Factory {
f.WithHelmFactory(executables.WithInsecure())
f.WithHelmFactory()

f.buildSteps = append(f.buildSteps, func(ctx context.Context) error {
if f.dependencies.CiliumTemplater != nil {
Expand Down
12 changes: 12 additions & 0 deletions pkg/dependencies/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type HelmFactory struct {
helm *executables.Helm
registryMirror *registrymirror.RegistryMirror
proxyConfiguration map[string]string
insecure bool
}

// WithRegistryMirror configures the factory to use registry mirror wherever applicable.
Expand All @@ -33,6 +34,13 @@ func (f *HelmFactory) WithProxyConfigurations(proxyConfiguration map[string]stri
return f
}

// WithInsecure configures the factory to configure helm to use to allow connections to TLS registry without certs or with self-signed certs

Check failure on line 37 in pkg/dependencies/helm.go

View workflow job for this annotation

GitHub Actions / lint

Comment should end in a period (godot)
func (f *HelmFactory) WithInsecure() *HelmFactory {
f.insecure = true

return f
}

func NewHelmFactory(builder ExecutableBuilder) *HelmFactory {

Check warning on line 44 in pkg/dependencies/helm.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported function NewHelmFactory should have comment or be unexported (revive)
return &HelmFactory{
builder: builder,
Expand All @@ -51,6 +59,10 @@ func (f *HelmFactory) GetInstance(opts ...executables.HelmOpt) *executables.Helm
opts = append(opts, executables.WithEnv(f.proxyConfiguration))
}

if f.insecure {
opts = append(opts, executables.WithInsecure())
}

f.helm = f.builder.BuildHelmExecutable(opts...)
return f.helm
}

0 comments on commit 5494db2

Please sign in to comment.