Skip to content

Commit 96e49a3

Browse files
authored
fix: set ownerReference on imageRegistry and globalMirror Secrets (#720)
**What problem does this PR solve?**: Add `ownerReference` to user provided credentials Secrets for `imageRegistry` and `globalMirror` variables. These Secrets will now be moved with `clusterctl move` and deleted once the Cluster is deleted. I needed `EnsureOwnerRefForSecret ` from the lifecycleutils package but that function needed alot of other functions from that package, so moved it all up the handlers package. (first commit) **Which issue(s) this PR fixes**: Fixes https://jira.nutanix.com/browse/NCN-100641 **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> Added unit tests and tested manually for both `imageRegistry` and `globalMirror`: ``` $ kubectl get secret dkoshkin-registry-creds-owner-ref-1-dockerhub-credentials -o yaml apiVersion: v1 data: password: <> username: <> kind: Secret metadata: creationTimestamp: "2024-06-13T23:47:59Z" labels: cluster.x-k8s.io/provider: nutanix name: dkoshkin-registry-creds-owner-ref-1-dockerhub-credentials namespace: default ownerReferences: - apiVersion: cluster.x-k8s.io/v1beta1 kind: Cluster name: dkoshkin-registry-creds-owner-ref-1 uid: be432689-315c-4511-a294-f397b3cdb9b7 resourceVersion: "3886" uid: 84366a22-63db-4820-bf31-b5bf36e2c6cb type: Opaque ``` **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. -->
1 parent b72b113 commit 96e49a3

File tree

24 files changed

+382
-262
lines changed

24 files changed

+382
-262
lines changed

pkg/handlers/generic/lifecycle/ccm/aws/handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717

1818
apivariables "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/variables"
1919
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
20-
lifecycleutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
2120
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options"
21+
handlersutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2222
)
2323

2424
type AWSCCMConfig struct {
@@ -96,7 +96,7 @@ func (a *AWSCCM) Apply(
9696
)
9797
}
9898

99-
err = lifecycleutils.EnsureCRSForClusterFromObjects(
99+
err = handlersutils.EnsureCRSForClusterFromObjects(
100100
ctx,
101101
ccmConfigMap.Name,
102102
a.client,

pkg/handlers/generic/lifecycle/ccm/nutanix/handler.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121
apivariables "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/variables"
2222
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
2323
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/config"
24-
lifecycleutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
2524
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options"
25+
handlersutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2626
)
2727

2828
const (
@@ -81,7 +81,7 @@ func (p *provider) Apply(
8181
}
8282

8383
log.Info("Retrieving Nutanix CCM installation values template for cluster")
84-
values, err := lifecycleutils.RetrieveValuesTemplate(
84+
values, err := handlersutils.RetrieveValuesTemplate(
8585
ctx,
8686
p.client,
8787
p.config.defaultValuesTemplateConfigMapName,
@@ -98,7 +98,7 @@ func (p *provider) Apply(
9898
// However, that would leave the credentials visible in the HelmChartProxy.
9999
// Instead, we'll create the Secret on the remote cluster and reference it in the Helm values.
100100
if clusterConfig.Addons.CCM.Credentials != nil {
101-
err = lifecycleutils.EnsureOwnerRefForSecret(
101+
err = handlersutils.EnsureOwnerReferenceForSecret(
102102
ctx,
103103
p.client,
104104
clusterConfig.Addons.CCM.Credentials.SecretRef.Name,
@@ -114,7 +114,7 @@ func (p *provider) Apply(
114114
Name: defaultCredentialsSecretName,
115115
Namespace: defaultHelmReleaseNamespace,
116116
}
117-
err = lifecycleutils.CopySecretToRemoteCluster(
117+
err = handlersutils.CopySecretToRemoteCluster(
118118
ctx,
119119
p.client,
120120
clusterConfig.Addons.CCM.Credentials.SecretRef.Name,
@@ -161,7 +161,7 @@ func (p *provider) Apply(
161161
ValuesTemplate: values,
162162
},
163163
}
164-
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
164+
handlersutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
165165
if err = controllerutil.SetOwnerReference(cluster, hcp, p.client.Scheme()); err != nil {
166166
return fmt.Errorf(
167167
"failed to set owner reference on nutanix-ccm installation HelmChartProxy: %w",

pkg/handlers/generic/lifecycle/clusterautoscaler/strategy_crs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
1717

1818
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
19-
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
19+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2020
)
2121

2222
type crsConfig struct {

pkg/handlers/generic/lifecycle/clusterautoscaler/strategy_helmaddon.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
caaphv1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/external/sigs.k8s.io/cluster-api-addon-provider-helm/api/v1alpha1"
1919
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
2020
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/config"
21-
lifecycleutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
21+
handlersutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2222
)
2323

2424
const (
@@ -52,7 +52,7 @@ func (s helmAddonStrategy) apply(
5252
log logr.Logger,
5353
) error {
5454
log.Info("Retrieving cluster-autoscaler installation values template for cluster")
55-
values, err := lifecycleutils.RetrieveValuesTemplate(
55+
values, err := handlersutils.RetrieveValuesTemplate(
5656
ctx,
5757
s.client,
5858
s.config.defaultValuesTemplateConfigMapName,
@@ -103,7 +103,7 @@ func (s helmAddonStrategy) apply(
103103
},
104104
}
105105

106-
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
106+
handlersutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
107107
if err = controllerutil.SetOwnerReference(&req.Cluster, hcp, s.client.Scheme()); err != nil {
108108
return fmt.Errorf(
109109
"failed to set owner reference on cluster-autoscaler installation HelmChartProxy: %w",

pkg/handlers/generic/lifecycle/cni/calico/strategy_crs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
2424
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/parser"
2525
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/cni"
26-
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
26+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2727
)
2828

2929
type crsConfig struct {

pkg/handlers/generic/lifecycle/cni/calico/strategy_helmaddon.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
caaphv1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/external/sigs.k8s.io/cluster-api-addon-provider-helm/api/v1alpha1"
1919
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
2020
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/config"
21-
lifecycleutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
21+
handlersutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2222
)
2323

2424
const (
@@ -68,7 +68,7 @@ func (s helmAddonStrategy) apply(
6868
}
6969

7070
log.Info("Retrieving Calico installation values template for cluster")
71-
values, err := lifecycleutils.RetrieveValuesTemplate(
71+
values, err := handlersutils.RetrieveValuesTemplate(
7272
ctx,
7373
s.client,
7474
defaultInstallationConfigMapName,
@@ -102,7 +102,7 @@ func (s helmAddonStrategy) apply(
102102
ValuesTemplate: values,
103103
},
104104
}
105-
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
105+
handlersutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
106106
if err := controllerutil.SetOwnerReference(&req.Cluster, hcp, s.client.Scheme()); err != nil {
107107
return fmt.Errorf(
108108
"failed to set owner reference on Calico CNI installation HelmChartProxy: %w",

pkg/handlers/generic/lifecycle/cni/cilium/strategy_crs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
1616

1717
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
18-
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
18+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
1919
)
2020

2121
type crsConfig struct {

pkg/handlers/generic/lifecycle/cni/cilium/strategy_helmaddon.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
caaphv1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/external/sigs.k8s.io/cluster-api-addon-provider-helm/api/v1alpha1"
1919
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
2020
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/config"
21-
lifecycleutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
21+
handlersutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2222
)
2323

2424
const (
@@ -52,7 +52,7 @@ func (s helmAddonStrategy) apply(
5252
log logr.Logger,
5353
) error {
5454
log.Info("Retrieving Cilium installation values template for cluster")
55-
values, err := lifecycleutils.RetrieveValuesTemplate(
55+
values, err := handlersutils.RetrieveValuesTemplate(
5656
ctx,
5757
s.client,
5858
s.config.defaultValuesTemplateConfigMapName,
@@ -87,7 +87,7 @@ func (s helmAddonStrategy) apply(
8787
},
8888
}
8989

90-
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
90+
handlersutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
9191
if err := controllerutil.SetOwnerReference(&req.Cluster, hcp, s.client.Scheme()); err != nil {
9292
return fmt.Errorf(
9393
"failed to set owner reference on Cilium CNI installation HelmChartProxy: %w",

pkg/handlers/generic/lifecycle/csi/aws-ebs/handler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717

1818
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
1919
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
20-
lifecycleutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
2120
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options"
21+
handlersutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2222
)
2323

2424
var defaultStorageClassParameters = map[string]string{
@@ -73,7 +73,7 @@ func (a *AWSEBS) Apply(
7373
default:
7474
return fmt.Errorf("stategy %s not implemented", strategy)
7575
}
76-
err := lifecycleutils.CreateStorageClassOnRemote(
76+
err := handlersutils.CreateStorageClassOnRemote(
7777
ctx,
7878
a.client,
7979
provider.StorageClassConfig,
@@ -117,7 +117,7 @@ func (a *AWSEBS) handleCRSApply(ctx context.Context,
117117
err,
118118
)
119119
}
120-
err = lifecycleutils.EnsureCRSForClusterFromObjects(
120+
err = handlersutils.EnsureCRSForClusterFromObjects(
121121
ctx,
122122
cm.Name,
123123
a.client,

pkg/handlers/generic/lifecycle/csi/localpath/handler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
1919
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
2020
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/config"
21-
lifecycleutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
21+
handlersutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2222
)
2323

2424
const (
@@ -60,7 +60,7 @@ func (l *LocalPathProvisionerCSI) Apply(
6060
return fmt.Errorf("strategy %s not implemented", strategy)
6161
}
6262

63-
err := lifecycleutils.CreateStorageClassOnRemote(
63+
err := handlersutils.CreateStorageClassOnRemote(
6464
ctx,
6565
l.client,
6666
provider.StorageClassConfig,
@@ -118,7 +118,7 @@ helperImage:
118118
ValuesTemplate: valuesTemplate,
119119
},
120120
}
121-
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(chartProxy)
121+
handlersutils.SetTLSConfigForHelmChartProxyIfNeeded(chartProxy)
122122
if err = controllerutil.SetOwnerReference(&req.Cluster, chartProxy, l.client.Scheme()); err != nil {
123123
return fmt.Errorf(
124124
"failed to set owner reference on HelmChartProxy %q: %w",

pkg/handlers/generic/lifecycle/csi/nutanix-csi/handler.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
2020
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
2121
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/config"
22-
lifecycleutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
2322
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options"
23+
handlersutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2424
)
2525

2626
const (
@@ -97,7 +97,7 @@ func (n *NutanixCSI) Apply(
9797
}
9898

9999
if provider.Credentials != nil {
100-
err := lifecycleutils.EnsureOwnerRefForSecret(
100+
err := handlersutils.EnsureOwnerReferenceForSecret(
101101
ctx,
102102
n.client,
103103
provider.Credentials.SecretRef.Name,
@@ -113,7 +113,7 @@ func (n *NutanixCSI) Apply(
113113
Name: defaultCredentialsSecretName,
114114
Namespace: defaultStorageHelmReleaseNamespace,
115115
}
116-
err = lifecycleutils.CopySecretToRemoteCluster(
116+
err = handlersutils.CopySecretToRemoteCluster(
117117
ctx,
118118
n.client,
119119
provider.Credentials.SecretRef.Name,
@@ -128,7 +128,7 @@ func (n *NutanixCSI) Apply(
128128
}
129129
}
130130

131-
err := lifecycleutils.CreateStorageClassOnRemote(
131+
err := handlersutils.CreateStorageClassOnRemote(
132132
ctx,
133133
n.client,
134134
provider.StorageClassConfig,
@@ -150,7 +150,7 @@ func (n *NutanixCSI) handleHelmAddonApply(
150150
log logr.Logger,
151151
) error {
152152
log.Info("Retrieving Nutanix CSI installation values template for cluster")
153-
values, err := lifecycleutils.RetrieveValuesTemplate(
153+
values, err := handlersutils.RetrieveValuesTemplate(
154154
ctx,
155155
n.client,
156156
n.config.defaultValuesTemplateConfigMapName,
@@ -194,7 +194,7 @@ func (n *NutanixCSI) handleHelmAddonApply(
194194
ValuesTemplate: values,
195195
},
196196
}
197-
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(storageChartProxy)
197+
handlersutils.SetTLSConfigForHelmChartProxyIfNeeded(storageChartProxy)
198198
snapshotChartProxy := &caaphv1.HelmChartProxy{
199199
TypeMeta: metav1.TypeMeta{
200200
APIVersion: caaphv1.GroupVersion.String(),
@@ -215,7 +215,7 @@ func (n *NutanixCSI) handleHelmAddonApply(
215215
Version: snapshotChart.Version,
216216
},
217217
}
218-
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(snapshotChartProxy)
218+
handlersutils.SetTLSConfigForHelmChartProxyIfNeeded(snapshotChartProxy)
219219
// We use a slice of pointers to satisfy the gocritic linter rangeValCopy check.
220220
for _, cp := range []*caaphv1.HelmChartProxy{storageChartProxy, snapshotChartProxy} {
221221
if err = controllerutil.SetOwnerReference(&req.Cluster, cp, n.client.Scheme()); err != nil {

pkg/handlers/generic/lifecycle/nfd/strategy_crs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
1616

1717
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
18-
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
18+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
1919
)
2020

2121
type crsConfig struct {

pkg/handlers/generic/lifecycle/nfd/strategy_helmaddon.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
caaphv1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/external/sigs.k8s.io/cluster-api-addon-provider-helm/api/v1alpha1"
1919
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
2020
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/config"
21-
lifecycleutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
21+
handlersutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2222
)
2323

2424
const (
@@ -53,7 +53,7 @@ func (s helmAddonStrategy) apply(
5353
log logr.Logger,
5454
) error {
5555
log.Info("Retrieving NFD installation values template for cluster")
56-
values, err := lifecycleutils.RetrieveValuesTemplate(
56+
values, err := handlersutils.RetrieveValuesTemplate(
5757
ctx,
5858
s.client,
5959
s.config.defaultValuesTemplateConfigMapName,
@@ -93,7 +93,7 @@ image:
9393
},
9494
}
9595

96-
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
96+
handlersutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
9797
if err := controllerutil.SetOwnerReference(&req.Cluster, hcp, s.client.Scheme()); err != nil {
9898
return fmt.Errorf(
9999
"failed to set owner reference on NFD installation HelmChartProxy: %w",

pkg/handlers/generic/lifecycle/serviceloadbalancer/metallb/handler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818
caaphv1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/external/sigs.k8s.io/cluster-api-addon-provider-helm/api/v1alpha1"
1919
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
2020
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/config"
21-
lifecycleutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/utils"
2221
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options"
22+
handlersutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
2323
)
2424

2525
const (
@@ -75,7 +75,7 @@ func (n *MetalLB) Apply(
7575
) error {
7676
log.Info("Applying MetalLB installation")
7777

78-
values, err := lifecycleutils.RetrieveValuesTemplate(
78+
values, err := handlersutils.RetrieveValuesTemplate(
7979
ctx,
8080
n.client,
8181
n.config.defaultValuesTemplateConfigMapName,
@@ -98,7 +98,7 @@ func (n *MetalLB) Apply(
9898
return fmt.Errorf("error creating remote cluster client: %w", err)
9999
}
100100

101-
err = lifecycleutils.EnsureNamespaceWithMetadata(
101+
err = handlersutils.EnsureNamespaceWithMetadata(
102102
ctx,
103103
remoteClient,
104104
defaultHelmReleaseNamespace,
@@ -140,7 +140,7 @@ func (n *MetalLB) Apply(
140140
},
141141
}
142142

143-
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
143+
handlersutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
144144
if err = controllerutil.SetOwnerReference(cluster, hcp, n.client.Scheme()); err != nil {
145145
return fmt.Errorf(
146146
"failed to set owner reference on MetalLB installation HelmChartProxy: %w",

0 commit comments

Comments
 (0)