Skip to content

Commit 698b9ef

Browse files
authored
Use calico flavor for tests (#112)
1 parent 540f598 commit 698b9ef

File tree

10 files changed

+40
-303
lines changed

10 files changed

+40
-303
lines changed

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,13 @@ E2E_FIREWALL_IMAGE ?= "firewall-ubuntu-3.0"
137137
E2E_FIREWALL_SIZE ?= "v1-small-x86"
138138
E2E_FIREWALL_NETWORKS ?= "internet-mini-lab"
139139
ARTIFACTS ?= "$(PWD)/_artifacts"
140+
E2E_DEFAULT_FLAVOR ?= "calico"
140141
# Can be something like: basic && !move
141142
E2E_LABEL_FILTER ?= ""
142143

143144
.PHONY: test-e2e
144145
test-e2e: manifests generate fmt vet ginkgo
145-
rm -rf $(ARTIFACTS)/config/target
146-
147-
mkdir -p $(ARTIFACTS)/config/target
148-
kubectl kustomize test/e2e/frmwrk/config/target/base -o $(ARTIFACTS)/config/target/base.yaml
146+
rm -rf $(ARTIFACTS)
149147

150148
@METAL_API_URL=$(E2E_METAL_API_URL) \
151149
METAL_API_HMAC=$(E2E_METAL_API_HMAC) \
@@ -163,6 +161,7 @@ test-e2e: manifests generate fmt vet ginkgo
163161
FIREWALL_SIZE=$(E2E_FIREWALL_SIZE) \
164162
FIREWALL_NETWORKS=$(E2E_FIREWALL_NETWORKS) \
165163
ARTIFACTS=$(ARTIFACTS) \
164+
E2E_DEFAULT_FLAVOR=$(E2E_DEFAULT_FLAVOR) \
166165
$(GINKGO) -vv -r --junit-report="junit.e2e_suite.xml" --output-dir="$(ARTIFACTS)" --label-filter="$(E2E_LABEL_FILTER)" -timeout 60m ./test/e2e/frmwrk
167166

168167
.PHONY: lint

test/e2e/frmwrk/config/capi-e2e-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@ providers:
9999
# - old: --metrics-addr=127.0.0.1:8080
100100
# new: --metrics-addr=:8080
101101

102+
- name: helm
103+
type: AddonProvider
104+
versions:
105+
- name: "{go://github.com/kubernetes-sigs/[email protected]}"
106+
value: "https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm/releases/download/{go://github.com/kubernetes-sigs/[email protected]}/addon-components.yaml"
107+
type: "url"
108+
contract: v1beta1
109+
files:
110+
- sourcePath: "../data/addon-helm/metadata.yaml"
111+
replacements:
112+
- old: --metrics-addr=127.0.0.1:8080
113+
new: --metrics-addr=:8080
114+
102115
- name: capms
103116
type: InfrastructureProvider
104117
versions:

test/e2e/frmwrk/config/target/base/cni-calico-installation.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

test/e2e/frmwrk/config/target/base/kustomization.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

test/e2e/frmwrk/config/target/base/metal-ccm.yaml

Lines changed: 0 additions & 231 deletions
This file was deleted.

test/e2e/frmwrk/config/target/base/metallb-speaker.yaml

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# maps release series of major.minor to cluster-api contract version
2+
# the contract version may change between minor or major versions, but *not*
3+
# between patch versions.
4+
#
5+
# update this file only when a new major or minor version is released
6+
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
7+
kind: Metadata
8+
releaseSeries:
9+
- major: 0
10+
minor: 1
11+
contract: v1beta1
12+
- major: 0
13+
minor: 2
14+
contract: v1beta1
15+
- major: 0
16+
minor: 3
17+
contract: v1beta1
18+
- major: 0
19+
minor: 4
20+
contract: v1beta1

test/e2e/frmwrk/shared_cases.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ package frmwrk
22

33
import (
44
"context"
5-
"os"
6-
"path"
75

86
. "github.com/onsi/ginkgo/v2" //nolint:staticcheck
97
. "github.com/onsi/gomega" //nolint:staticcheck
108

11-
"github.com/drone/envsubst/v2"
129
"sigs.k8s.io/cluster-api/test/framework"
1310
)
1411

@@ -37,20 +34,6 @@ func createE2ECluster(ctx context.Context, e2eCtx *E2EContext, cfg ClusterConfig
3734
})
3835
Expect(controlPlane).To(Not(BeNil()))
3936

40-
By("Wait for CNI and CCM")
41-
targetTemplate, err := os.ReadFile(path.Join(e2eCtx.Environment.artifactsPath, "config", "target", "base.yaml"))
42-
Expect(err).ToNot(HaveOccurred())
43-
44-
vars := ec.Variables()
45-
targetResources, err := envsubst.Eval(string(targetTemplate), func(varName string) string {
46-
return vars[varName]
47-
})
48-
Expect(err).ToNot(HaveOccurred())
49-
50-
Eventually(func() error {
51-
return ec.Refs.Workload.CreateOrUpdate(ctx, []byte(targetResources))
52-
}, "10m", "15s").Should(Succeed()) // currently this long delay is required as machines might not be ready yet
53-
5437
By("Wait for kubeadm control plane")
5538
framework.DiscoveryAndWaitForControlPlaneInitialized(ctx, framework.DiscoveryAndWaitForControlPlaneInitializedInput{
5639
Lister: e2eCtx.Environment.Bootstrap.GetClient(),

test/e2e/frmwrk/shared_cluster.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ func (e2e *E2ECluster) GenerateAndApplyClusterTemplate(ctx context.Context) {
309309
ControlPlaneMachineCount: &e2e.ControlPlaneMachineCount,
310310
WorkerMachineCount: &e2e.WorkerMachineCount,
311311
ClusterctlConfigPath: e2e.E2EContext.Environment.ClusterctlConfigPath,
312+
Flavor: e2e.E2EContext.Environment.Flavor,
312313
// TODO: why does this not work with clusterctl.DefaultInfrastructureProvider?
313314
InfrastructureProvider: "capms:v0.6.2",
314315
LogFolder: path.Join(e2e.E2EContext.Environment.artifactsPath, "clusters", e2e.ClusterName),

0 commit comments

Comments
 (0)