Skip to content

Commit e56427e

Browse files
authored
test(e2e): Various e2e tests fixes (#754)
Fixed up Nutanix CSI namespace in e2e tests. Updated Kubernetes version for e2e to use to v1.29.5, which is the latest available version of Nutanix and AWS images. Tested locally by running AWS and Nutanix e2e tests - all passed! Docker is tested in CI. Depends on #751.
1 parent fde18b8 commit e56427e

10 files changed

+64
-21
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ For example, the following command will create a Docker cluster with Cilium CNI
4444
```shell
4545
export CLUSTER_NAME=docker-cluster-cilium-helm-addon
4646
export CLUSTER_FILE=examples/capi-quick-start/docker-cluster-cilium-helm-addon.yaml
47-
export KUBERNETES_VERSION=v1.29.4
47+
export KUBERNETES_VERSION=v1.29.5
4848
```
4949

5050
```shell

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ require (
2323
github.com/onsi/ginkgo/v2 v2.19.0
2424
github.com/onsi/gomega v1.33.1
2525
github.com/pkg/errors v0.9.1
26+
github.com/samber/lo v1.39.0
2627
github.com/spf13/pflag v1.0.5
2728
github.com/stretchr/testify v1.9.0
2829
gopkg.in/yaml.v2 v2.4.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke
218218
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
219219
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
220220
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
221+
github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA=
222+
github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
221223
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
222224
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
223225
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=

make/go.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ E2E_PARALLEL_NODES ?= $(if $(filter $(E2E_DRYRUN),true),1,$(shell nproc --ignore
8080
E2E_FLAKE_ATTEMPTS ?= 1
8181
E2E_CONF_FILE ?= $(REPO_ROOT)/test/e2e/config/caren.yaml
8282
E2E_CONF_FILE_ENVSUBST ?= $(basename $(E2E_CONF_FILE))-envsubst.yaml
83-
export E2E_DEFAULT_KUBERNETES_VERSION ?= v1.29.4
83+
export E2E_DEFAULT_KUBERNETES_VERSION ?= v1.29.5
8484
ARTIFACTS ?= ${REPO_ROOT}/_artifacts
8585

8686
.PHONY: e2e-test

make/kind.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ KIND_CLUSTER_NAME ?= $(GITHUB_REPOSITORY)-dev
77
KIND_KUBECONFIG ?= $(KIND_DIR)/$(KIND_CLUSTER_NAME)/kubeconfig
88

99
KINDEST_NODE_IMAGE ?= ghcr.io/mesosphere/kind-node
10-
KINDEST_NODE_VERSION_v1.27 ?= v1.27.13
11-
KINDEST_NODE_VERSION_v1.28 ?= v1.28.9
12-
KINDEST_NODE_VERSION_v1.29 ?= v1.29.4
13-
KINDEST_NODE_VERSION_v1.30 ?= v1.30.0
10+
KINDEST_NODE_VERSION_v1.27 ?= v1.27.15
11+
KINDEST_NODE_VERSION_v1.28 ?= v1.28.11
12+
KINDEST_NODE_VERSION_v1.29 ?= v1.29.6
13+
KINDEST_NODE_VERSION_v1.30 ?= v1.30.2
1414
# Allow easy override of Kubernetes version to use via `make KIND_KUBERNETES_VERSION=v1.23` to use in CI
1515
KIND_KUBERNETES_VERSION ?= v1.29
1616
ifndef KINDEST_NODE_VERSION_$(KIND_KUBERNETES_VERSION)

test/e2e/config/caren.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ variables:
167167
KUBERNETES_VERSION: "${E2E_DEFAULT_KUBERNETES_VERSION}"
168168
# Override Kubernetes version for test workload clusters for specific providers by setting the env variables
169169
# `KUBERNETES_VERSION_<PROVIDER>`, where `<PROVIDER>` is the uppercase provider name, e.g.
170-
# `KUBERNETES_VERSION_DOCKER: v1.29.4`.
170+
# `KUBERNETES_VERSION_DOCKER: v1.29.5`.
171171
# KUBERNETES_VERSION_DOCKER: "${KINDEST_IMAGE_TAG}"
172172
SERVICE_CIDR: "10.128.0.0/12"
173173
POD_CIDR: "192.168.0.0/16"

test/e2e/csi_helpers.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ func waitForNutanixCSIToBeReadyInWorkloadCluster(
318318
Deployment: &appsv1.Deployment{
319319
ObjectMeta: metav1.ObjectMeta{
320320
Name: "nutanix-csi-controller",
321-
Namespace: metav1.NamespaceSystem,
321+
Namespace: "ntnx-system",
322322
},
323323
},
324324
}, input.deploymentIntervals...)
@@ -328,7 +328,7 @@ func waitForNutanixCSIToBeReadyInWorkloadCluster(
328328
DaemonSet: &appsv1.DaemonSet{
329329
ObjectMeta: metav1.ObjectMeta{
330330
Name: "nutanix-csi-node",
331-
Namespace: metav1.NamespaceSystem,
331+
Namespace: "ntnx-system",
332332
},
333333
},
334334
}, input.daemonSetIntervals...)
@@ -357,6 +357,8 @@ func waitForStorageClassesToExistInWorkloadCluster(
357357
provisioner = string(v1alpha1.LocalPathProvisioner)
358358
case v1alpha1.CSIProviderAWSEBS:
359359
provisioner = string(v1alpha1.AWSEBSProvisioner)
360+
case v1alpha1.CSIProviderNutanix:
361+
provisioner = string(v1alpha1.NutanixProvisioner)
360362
default:
361363
Fail(
362364
fmt.Sprintf(

test/e2e/e2e_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func init() {
7070
flag.StringVar(
7171
&bootstrapKubernetesVersion,
7272
"e2e.bootstrap-kind-version",
73-
"v1.29.4",
73+
"v1.29.5",
7474
"the version of the image used in bootstrap cluster",
7575
)
7676
}

test/e2e/ownerreference_helpers.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1beta1"
1717
"sigs.k8s.io/cluster-api/test/framework"
1818

19+
capxv1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/external/github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1"
1920
caaphv1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/external/sigs.k8s.io/cluster-api-addon-provider-helm/api/v1alpha1"
2021
)
2122

@@ -91,6 +92,12 @@ var (
9192
Controller: ptr.To(true),
9293
}
9394

95+
capxGroupVersion = capxv1.GroupVersion.String()
96+
nutanixClusterOwner = metav1.OwnerReference{
97+
Kind: nutanixClusterKind,
98+
APIVersion: capxGroupVersion,
99+
}
100+
94101
// AddonReferenceAssertions maps addontypes to functions which return an error if the passed OwnerReferences
95102
// aren't as expected.
96103
AddonReferenceAssertions = map[string]func([]metav1.OwnerReference) error{
@@ -191,6 +198,7 @@ var (
191198
[]metav1.OwnerReference{kubeadmControlPlaneController},
192199
[]metav1.OwnerReference{kubeadmConfigController},
193200
[]metav1.OwnerReference{clusterOwner},
201+
[]metav1.OwnerReference{clusterOwner, nutanixClusterOwner},
194202
)
195203
},
196204
configMapKind: func(owners []metav1.OwnerReference) error {

test/e2e/quick_start_test.go

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ package e2e
88
import (
99
"fmt"
1010
"slices"
11+
"strconv"
1112
"strings"
1213

1314
. "github.com/onsi/ginkgo/v2"
1415
. "github.com/onsi/gomega"
16+
"github.com/samber/lo"
1517
"k8s.io/utils/ptr"
18+
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
1619
clusterctlcluster "sigs.k8s.io/cluster-api/cmd/clusterctl/client/cluster"
1720
capie2e "sigs.k8s.io/cluster-api/test/e2e"
1821
"sigs.k8s.io/cluster-api/test/framework"
@@ -63,7 +66,7 @@ var _ = Describe("Quick start", Serial, func() {
6366
// available that are not available in other providers.
6467
// This version can be specified in `test/e2e/config/caren.yaml` with a variable named
6568
// `KUBERNETES_VERSION_<PROVIDER>`, where `<PROVIDER>` is the uppercase provider name, e.g.
66-
// `KUBERNETES_VERSION_DOCKER: v1.29.4`.
69+
// `KUBERNETES_VERSION_DOCKER: v1.29.5`.
6770
testE2EConfig := e2eConfig.DeepCopy()
6871
varName := capie2e.KubernetesVersion + "_" + strings.ToUpper(
6972
lowercaseProvider,
@@ -99,21 +102,57 @@ var _ = Describe("Quick start", Serial, func() {
99102
KubernetesReferenceAssertions,
100103
)
101104

105+
workloadCluster := framework.GetClusterByName(
106+
ctx,
107+
framework.GetClusterByNameInput{
108+
Namespace: namespace,
109+
Name: clusterName,
110+
Getter: proxy.GetClient(),
111+
},
112+
)
113+
Expect(workloadCluster.Spec.Topology).ToNot(BeNil())
114+
102115
By("Waiting until nodes are ready")
103116
workloadProxy := proxy.GetWorkloadCluster(
104117
ctx,
105118
namespace,
106119
clusterName,
107120
)
108121
workloadClient := workloadProxy.GetClient()
122+
123+
nodeCount := int(
124+
ptr.Deref(
125+
workloadCluster.Spec.Topology.ControlPlane.Replicas,
126+
0,
127+
),
128+
) +
129+
lo.Reduce(
130+
workloadCluster.Spec.Topology.Workers.MachineDeployments,
131+
func(agg int, md clusterv1.MachineDeploymentTopology, _ int) int {
132+
switch {
133+
case md.Replicas != nil:
134+
return agg + int(ptr.Deref(md.Replicas, 0))
135+
case md.Metadata.Annotations["cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size"] != "":
136+
minSize, err := strconv.Atoi(
137+
md.Metadata.Annotations["cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size"],
138+
)
139+
Expect(err).ToNot(HaveOccurred())
140+
return agg + minSize
141+
default:
142+
return agg
143+
}
144+
},
145+
0,
146+
)
147+
109148
framework.WaitForNodesReady(
110149
ctx,
111150
framework.WaitForNodesReadyInput{
112151
Lister: workloadClient,
113152
KubernetesVersion: testE2EConfig.GetVariable(
114153
capie2e.KubernetesVersion,
115154
),
116-
Count: 2,
155+
Count: nodeCount,
117156
WaitForNodesReady: testE2EConfig.GetIntervals(
118157
flavour,
119158
"wait-nodes-ready",
@@ -124,15 +163,6 @@ var _ = Describe("Quick start", Serial, func() {
124163
By(
125164
"Waiting for all requested addons to be ready in workload cluster",
126165
)
127-
workloadCluster := framework.GetClusterByName(
128-
ctx,
129-
framework.GetClusterByNameInput{
130-
Namespace: namespace,
131-
Name: clusterName,
132-
Getter: proxy.GetClient(),
133-
},
134-
)
135-
Expect(workloadCluster.Spec.Topology).ToNot(BeNil())
136166
clusterVars := variables.ClusterVariablesToVariablesMap(
137167
workloadCluster.Spec.Topology.Variables,
138168
)

0 commit comments

Comments
 (0)