@@ -14,11 +14,11 @@ import (
1414 "github.com/replicatedhq/embedded-cluster/api/types"
1515 ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
1616 "github.com/replicatedhq/embedded-cluster/pkg-new/kubernetesinstallation"
17+ "github.com/replicatedhq/embedded-cluster/pkg/helm"
1718 "github.com/replicatedhq/embedded-cluster/pkg/metrics"
1819 "github.com/replicatedhq/embedded-cluster/pkg/release"
1920 "github.com/sirupsen/logrus"
2021 helmcli "helm.sh/helm/v3/pkg/cli"
21- "k8s.io/cli-runtime/pkg/genericclioptions"
2222)
2323
2424type Controller interface {
@@ -34,21 +34,22 @@ type Controller interface {
3434var _ Controller = (* InstallController )(nil )
3535
3636type InstallController struct {
37- installationManager installation.InstallationManager
38- infraManager infra.InfraManager
39- metricsReporter metrics.ReporterInterface
40- restClientGetter genericclioptions.RESTClientGetter
41- releaseData * release.ReleaseData
42- password string
43- tlsConfig types.TLSConfig
44- license []byte
45- airgapBundle string
46- configValues types.AppConfigValues
47- endUserConfig * ecv1beta1.Config
48- store store.Store
49- ki kubernetesinstallation.Installation
50- stateMachine statemachine.Interface
51- logger logrus.FieldLogger
37+ installationManager installation.InstallationManager
38+ infraManager infra.InfraManager
39+ metricsReporter metrics.ReporterInterface
40+ kubernetesEnvSettings * helmcli.EnvSettings
41+ hcli helm.Client
42+ releaseData * release.ReleaseData
43+ password string
44+ tlsConfig types.TLSConfig
45+ license []byte
46+ airgapBundle string
47+ configValues types.AppConfigValues
48+ endUserConfig * ecv1beta1.Config
49+ store store.Store
50+ ki kubernetesinstallation.Installation
51+ stateMachine statemachine.Interface
52+ logger logrus.FieldLogger
5253 // App controller composition
5354 * appcontroller.AppController
5455}
@@ -73,9 +74,15 @@ func WithMetricsReporter(metricsReporter metrics.ReporterInterface) InstallContr
7374 }
7475}
7576
76- func WithRESTClientGetter ( restClientGetter genericclioptions. RESTClientGetter ) InstallControllerOption {
77+ func WithHelmClient ( hcli helm. Client ) InstallControllerOption {
7778 return func (c * InstallController ) {
78- c .restClientGetter = restClientGetter
79+ c .hcli = hcli
80+ }
81+ }
82+
83+ func WithKubernetesEnvSettings (envSettings * helmcli.EnvSettings ) InstallControllerOption {
84+ return func (c * InstallController ) {
85+ c .kubernetesEnvSettings = envSettings
7986 }
8087}
8188
@@ -169,9 +176,9 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
169176 controller .stateMachine = NewStateMachine (WithStateMachineLogger (controller .logger ))
170177 }
171178
172- // If none is provided, use the default env settings from helm to create a RESTClientGetter
173- if controller .restClientGetter == nil {
174- controller .restClientGetter = helmcli .New (). RESTClientGetter ()
179+ // If none is provided, use the default env settings from helm
180+ if controller .kubernetesEnvSettings == nil {
181+ controller .kubernetesEnvSettings = helmcli .New ()
175182 }
176183
177184 if controller .installationManager == nil {
@@ -192,6 +199,7 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
192199 appcontroller .WithConfigValues (controller .configValues ),
193200 appcontroller .WithAirgapBundle (controller .airgapBundle ),
194201 appcontroller .WithPrivateCACertConfigMapName ("" ), // Private CA ConfigMap functionality not yet implemented for Kubernetes installations
202+ appcontroller .WithHelmClient (controller .hcli ),
195203 )
196204 if err != nil {
197205 return nil , fmt .Errorf ("create app install controller: %w" , err )
@@ -203,13 +211,14 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
203211 infraManager , err := infra .NewInfraManager (
204212 infra .WithLogger (controller .logger ),
205213 infra .WithInfraStore (controller .store .KubernetesInfraStore ()),
206- infra .WithRESTClientGetter (controller .restClientGetter ),
214+ infra .WithKubernetesEnvSettings (controller .kubernetesEnvSettings ),
207215 infra .WithPassword (controller .password ),
208216 infra .WithTLSConfig (controller .tlsConfig ),
209217 infra .WithLicense (controller .license ),
210218 infra .WithAirgapBundle (controller .airgapBundle ),
211219 infra .WithReleaseData (controller .releaseData ),
212220 infra .WithEndUserConfig (controller .endUserConfig ),
221+ infra .WithHelmClient (controller .hcli ),
213222 )
214223 if err != nil {
215224 return nil , fmt .Errorf ("create infra manager: %w" , err )
0 commit comments