Skip to content

Commit c0feb1c

Browse files
feat: adding e2e testcases
1 parent 841e67b commit c0feb1c

10 files changed

+214
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@ stringData:
2020
---
2121
apiVersion: v1
2222
kind: Secret
23+
metadata:
24+
labels:
25+
cluster.x-k8s.io/provider: nutanix
26+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
27+
stringData:
28+
credentials: |
29+
[
30+
{
31+
"type": "basic_auth",
32+
"data": {
33+
"prismCentral":{
34+
"username": "${NUTANIX_USER}",
35+
"password": "${NUTANIX_PASSWORD}"
36+
}
37+
}
38+
}
39+
]
40+
---
41+
apiVersion: v1
42+
kind: Secret
2343
metadata:
2444
labels:
2545
cluster.x-k8s.io/provider: nutanix

examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@ stringData:
2020
---
2121
apiVersion: v1
2222
kind: Secret
23+
metadata:
24+
labels:
25+
cluster.x-k8s.io/provider: nutanix
26+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
27+
stringData:
28+
credentials: |
29+
[
30+
{
31+
"type": "basic_auth",
32+
"data": {
33+
"prismCentral":{
34+
"username": "${NUTANIX_USER}",
35+
"password": "${NUTANIX_PASSWORD}"
36+
}
37+
}
38+
}
39+
]
40+
---
41+
apiVersion: v1
42+
kind: Secret
2343
metadata:
2444
labels:
2545
cluster.x-k8s.io/provider: nutanix

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@ stringData:
2020
---
2121
apiVersion: v1
2222
kind: Secret
23+
metadata:
24+
labels:
25+
cluster.x-k8s.io/provider: nutanix
26+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
27+
stringData:
28+
credentials: |
29+
[
30+
{
31+
"type": "basic_auth",
32+
"data": {
33+
"prismCentral":{
34+
"username": "${NUTANIX_USER}",
35+
"password": "${NUTANIX_PASSWORD}"
36+
}
37+
}
38+
}
39+
]
40+
---
41+
apiVersion: v1
42+
kind: Secret
2343
metadata:
2444
labels:
2545
cluster.x-k8s.io/provider: nutanix

examples/capi-quick-start/nutanix-cluster-cilium-helm-addon.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@ stringData:
2020
---
2121
apiVersion: v1
2222
kind: Secret
23+
metadata:
24+
labels:
25+
cluster.x-k8s.io/provider: nutanix
26+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
27+
stringData:
28+
credentials: |
29+
[
30+
{
31+
"type": "basic_auth",
32+
"data": {
33+
"prismCentral":{
34+
"username": "${NUTANIX_USER}",
35+
"password": "${NUTANIX_PASSWORD}"
36+
}
37+
}
38+
}
39+
]
40+
---
41+
apiVersion: v1
42+
kind: Secret
2343
metadata:
2444
labels:
2545
cluster.x-k8s.io/provider: nutanix

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ stringData:
5656
---
5757
apiVersion: v1
5858
kind: Secret
59+
metadata:
60+
labels:
61+
cluster.x-k8s.io/provider: nutanix
62+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
63+
stringData:
64+
credentials: |
65+
[
66+
{
67+
"type": "basic_auth",
68+
"data": {
69+
"prismCentral":{
70+
"username": "${NUTANIX_USER}",
71+
"password": "${NUTANIX_PASSWORD}"
72+
}
73+
}
74+
}
75+
]
76+
---
77+
apiVersion: v1
78+
kind: Secret
5979
metadata:
6080
labels:
6181
cluster.x-k8s.io/provider: nutanix

examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-helm-addon.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ stringData:
5656
---
5757
apiVersion: v1
5858
kind: Secret
59+
metadata:
60+
labels:
61+
cluster.x-k8s.io/provider: nutanix
62+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
63+
stringData:
64+
credentials: |
65+
[
66+
{
67+
"type": "basic_auth",
68+
"data": {
69+
"prismCentral":{
70+
"username": "${NUTANIX_USER}",
71+
"password": "${NUTANIX_PASSWORD}"
72+
}
73+
}
74+
}
75+
]
76+
---
77+
apiVersion: v1
78+
kind: Secret
5979
metadata:
6080
labels:
6181
cluster.x-k8s.io/provider: nutanix
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2025 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
apiVersion: v1
6+
kind: Secret
7+
metadata:
8+
name: ${CLUSTER_NAME}-pc-creds-for-konnector-agent
9+
stringData:
10+
credentials: |
11+
[
12+
{
13+
"type": "basic_auth",
14+
"data": {
15+
"prismCentral":{
16+
"username": "${NUTANIX_USER}",
17+
"password": "${NUTANIX_PASSWORD}"
18+
}
19+
}
20+
}
21+
]

hack/examples/bases/nutanix/cluster/kustomization.yaml.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ kind: Kustomization
77
resources:
88
- ../../../additional-resources/dockerhub-secret.yaml
99
- ../../../additional-resources/nutanix/csi-secret.yaml
10+
- ../../../additional-resources/nutanix/konnector-agent-secret.yaml
1011
- https://github.com/nutanix-cloud-native/cluster-api-provider-nutanix/releases/download/${CAPX_VERSION}/cluster-template-topology.yaml
1112

1213
sortOptions:

test/e2e/addon_helpers.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,15 @@ func WaitForAddonsToBeReadyInWorkloadCluster(
141141
HelmReleaseIntervals: input.HelmReleaseIntervals,
142142
},
143143
)
144+
145+
WaitForKonnectorAgentToBeReadyInWorkloadCluster(
146+
ctx,
147+
WaitForKonnectorAgentToBeReadyInWorkloadClusterInput{
148+
KonnectorAgent: input.AddonsConfig.NutanixKonnectorAgent,
149+
WorkloadCluster: input.WorkloadCluster,
150+
ClusterProxy: input.ClusterProxy,
151+
DeploymentIntervals: input.DeploymentIntervals,
152+
HelmReleaseIntervals: input.HelmReleaseIntervals,
153+
},
154+
)
144155
}

test/e2e/konnectoragent_helpers.go

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//go:build e2e
2+
3+
// Copyright 2024 Nutanix. All rights reserved.
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
package e2e
7+
8+
import (
9+
"context"
10+
11+
appsv1 "k8s.io/api/apps/v1"
12+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
13+
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
14+
"sigs.k8s.io/cluster-api/test/framework"
15+
16+
apivariables "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/variables"
17+
)
18+
19+
type WaitForKonnectorAgentToBeReadyInWorkloadClusterInput struct {
20+
KonnectorAgent *apivariables.NutanixKonnectorAgent
21+
WorkloadCluster *clusterv1.Cluster
22+
ClusterProxy framework.ClusterProxy
23+
DeploymentIntervals []interface{}
24+
HelmReleaseIntervals []interface{}
25+
}
26+
27+
func WaitForKonnectorAgentToBeReadyInWorkloadCluster(
28+
ctx context.Context,
29+
input WaitForKonnectorAgentToBeReadyInWorkloadClusterInput, //nolint:gocritic // This hugeParam is OK in tests.
30+
) {
31+
if input.KonnectorAgent == nil {
32+
return
33+
}
34+
35+
// Wait for HelmReleaseProxy to be ready
36+
WaitForHelmReleaseProxyReadyForCluster(
37+
ctx,
38+
WaitForHelmReleaseProxyReadyForClusterInput{
39+
GetLister: input.ClusterProxy.GetClient(),
40+
Cluster: input.WorkloadCluster,
41+
HelmReleaseName: "konnector-agent",
42+
},
43+
input.HelmReleaseIntervals...,
44+
)
45+
46+
// Get workload cluster client to check resources in the workload cluster
47+
workloadClusterClient := input.ClusterProxy.GetWorkloadCluster(
48+
ctx, input.WorkloadCluster.Namespace, input.WorkloadCluster.Name,
49+
).GetClient()
50+
51+
// Wait for konnector-agent deployment to be available
52+
WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
53+
Getter: workloadClusterClient,
54+
Deployment: &appsv1.Deployment{
55+
ObjectMeta: metav1.ObjectMeta{
56+
Name: "konnector-agent",
57+
Namespace: "ntnx-system",
58+
},
59+
},
60+
}, input.DeploymentIntervals...)
61+
}

0 commit comments

Comments
 (0)