Skip to content

Commit c1ab4d2

Browse files
Update ccm_helpers and fix overlay templates for nutanix
1 parent df2afac commit c1ab4d2

File tree

10 files changed

+88
-3
lines changed

10 files changed

+88
-3
lines changed

examples/capi-quick-start/nutanix-cluster-calico-crs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ spec:
6767
credentials:
6868
secretRef:
6969
name: ${CLUSTER_NAME}-pc-creds
70-
strategy: HelmAddon
70+
strategy: ClusterResourceSet
7171
clusterAutoscaler:
7272
strategy: ClusterResourceSet
7373
cni:

examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ spec:
6767
credentials:
6868
secretRef:
6969
name: ${CLUSTER_NAME}-pc-creds
70-
strategy: HelmAddon
70+
strategy: ClusterResourceSet
7171
clusterAutoscaler:
7272
strategy: ClusterResourceSet
7373
cni:

hack/examples/overlays/clusters/nutanix/calico/crs/kustomization.yaml.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ patches:
1717
- target:
1818
kind: Cluster
1919
path: ../../../../../patches/crs-strategy.yaml
20+
- target:
21+
kind: Cluster
22+
path: ../../../../../patches/nutanix/ccm-crs-strategy.yaml

hack/examples/overlays/clusters/nutanix/calico/helm-addon/kustomization.yaml.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ patches:
1717
- target:
1818
kind: Cluster
1919
path: ../../../../../patches/helm-addon-strategy.yaml
20+
- target:
21+
kind: Cluster
22+
path: ../../../../../patches/nutanix/ccm-helm-addon-strategy.yaml

hack/examples/overlays/clusters/nutanix/cilium/crs/kustomization.yaml.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ patches:
1717
- target:
1818
kind: Cluster
1919
path: ../../../../../patches/crs-strategy.yaml
20+
- target:
21+
kind: Cluster
22+
path: ../../../../../patches/nutanix/ccm-crs-strategy.yaml

hack/examples/overlays/clusters/nutanix/cilium/helm-addon/kustomization.yaml.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ patches:
1717
- target:
1818
kind: Cluster
1919
path: ../../../../../patches/helm-addon-strategy.yaml
20+
- target:
21+
kind: Cluster
22+
path: ../../../../../patches/nutanix/ccm-helm-addon-strategy.yaml
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright 2024 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
- op: "add"
5+
path: "/spec/topology/variables/0/value/addons/ccm/strategy"
6+
value: ClusterResourceSet
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright 2024 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
- op: "add"
5+
path: "/spec/topology/variables/0/value/addons/ccm/strategy"
6+
value: HelmAddon

hack/examples/patches/nutanix/ccm.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
- op: "add"
55
path: "/spec/topology/variables/0/value/addons/ccm"
66
value:
7-
strategy: HelmAddon
87
credentials:
98
secretRef:
109
name: ${CLUSTER_NAME}-pc-creds

test/e2e/ccm_helpers.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ func WaitForCCMToBeReadyInWorkloadCluster(
5252
workloadClusterClient,
5353
input,
5454
)
55+
case "nutanix":
56+
WaitForNutanixCCMToBeReadyInWorkloadCluster(
57+
ctx,
58+
workloadClusterClient,
59+
input,
60+
)
5561
default:
5662
Fail(
5763
fmt.Sprintf(
@@ -117,3 +123,59 @@ func WaitForAWSCCMToBeReadyInWorkloadCluster(
117123
},
118124
}, input.DaemonSetIntervals...)
119125
}
126+
127+
func WaitForNutanixCCMToBeReadyInWorkloadCluster(
128+
ctx context.Context,
129+
workloadClusterClient client.Client,
130+
input WaitForCCMToBeReadyInWorkloadClusterInput, //nolint:gocritic // This hugeParam is OK in tests.
131+
) {
132+
switch input.CCM.Strategy {
133+
case v1alpha1.AddonStrategyClusterResourceSet:
134+
crs := &addonsv1.ClusterResourceSet{}
135+
Expect(input.ClusterProxy.GetClient().Get(
136+
ctx,
137+
types.NamespacedName{
138+
Name: "nutanix-ccm-" + input.WorkloadCluster.Name,
139+
Namespace: input.WorkloadCluster.Namespace,
140+
},
141+
crs,
142+
)).To(Succeed())
143+
144+
framework.WaitForClusterResourceSetToApplyResources(
145+
ctx,
146+
framework.WaitForClusterResourceSetToApplyResourcesInput{
147+
ClusterResourceSet: crs,
148+
ClusterProxy: input.ClusterProxy,
149+
Cluster: input.WorkloadCluster,
150+
},
151+
input.ClusterResourceSetIntervals...,
152+
)
153+
case v1alpha1.AddonStrategyHelmAddon:
154+
WaitForHelmReleaseProxyReadyForCluster(
155+
ctx,
156+
WaitForHelmReleaseProxyReadyForClusterInput{
157+
GetLister: input.ClusterProxy.GetClient(),
158+
Cluster: input.WorkloadCluster,
159+
HelmChartProxyName: "nutanix-ccm-" + input.WorkloadCluster.Name,
160+
},
161+
input.HelmReleaseIntervals...,
162+
)
163+
default:
164+
Fail(
165+
fmt.Sprintf(
166+
"Do not know how to wait for AWS CCM using strategy %s to be ready",
167+
input.CCM.Strategy,
168+
),
169+
)
170+
}
171+
172+
WaitForDaemonSetsAvailable(ctx, WaitForDaemonSetsAvailableInput{
173+
Getter: workloadClusterClient,
174+
DaemonSet: &appsv1.DaemonSet{
175+
ObjectMeta: metav1.ObjectMeta{
176+
Name: "nutanix-cloud-controller-manager",
177+
Namespace: metav1.NamespaceSystem,
178+
},
179+
},
180+
}, input.DaemonSetIntervals...)
181+
}

0 commit comments

Comments
 (0)