Skip to content

Commit 6e02ece

Browse files
author
Cecile Robert-Michon
committed
Refactor infrastructure-azure templates required by CAPI tests to match CAPD
1 parent 12f99f0 commit 6e02ece

File tree

28 files changed

+511
-908
lines changed

28 files changed

+511
-908
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ test/e2e/config/azure-dev-envsubst.yaml
6262
test/e2e/logs/*
6363
_artifacts
6464

65+
# E2E test templates
66+
test/e2e/data/infrastructure-azure/v1alpha4/cluster-template*.yaml
67+
6568
# boilerplate_test output
6669
hack/boilerplate/__pycache__
6770
hack/boilerplate/*.pyc

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ E2E_DATA_DIR ?= $(ROOT_DIR)/test/e2e/data
5050
KUBETEST_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/conformance.yaml)
5151
KUBETEST_WINDOWS_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/upstream-windows.yaml)
5252
KUBETEST_REPO_LIST_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/repo-list.yaml)
53+
AZURE_TEMPLATES := $(E2E_DATA_DIR)/infrastructure-azure
5354

5455
# set --output-base used for conversion-gen which needs to be different for in GOPATH and outside GOPATH dev
5556
ifneq ($(abspath $(ROOT_DIR)),$(GOPATH)/src/sigs.k8s.io/cluster-api-provider-azure)
@@ -168,7 +169,7 @@ test-cover: envs-test $(KUBECTL) $(KUBE_APISERVER) $(ETCD) ## Run tests with cod
168169
go tool cover -html=coverage.out -o coverage.html
169170

170171
.PHONY: test-e2e-run
171-
test-e2e-run: $(ENVSUBST) $(KUBECTL) $(GINKGO) ## Run e2e tests
172+
test-e2e-run: generate-e2e-templates $(ENVSUBST) $(KUBECTL) $(GINKGO) ## Run e2e tests
172173
$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) && \
173174
$(GINKGO) -v -trace -tags=e2e -focus="$(GINKGO_FOCUS)" -skip="$(GINKGO_SKIP)" -nodes=$(GINKGO_NODES) --noColor=$(GINKGO_NOCOLOR) $(GINKGO_ARGS) ./test/e2e -- \
174175
-e2e.artifacts-folder="$(ARTIFACTS)" \
@@ -289,6 +290,7 @@ generate: ## Generate code
289290
$(MAKE) generate-go
290291
$(MAKE) generate-manifests
291292
$(MAKE) generate-flavors
293+
$(MAKE) generate-e2e-templates
292294

293295
.PHONY: generate-go
294296
generate-go: $(CONTROLLER_GEN) $(MOCKGEN) $(CONVERSION_GEN) ## Runs Go related generate targets
@@ -328,6 +330,19 @@ generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
328330
generate-flavors: $(KUSTOMIZE)
329331
./hack/gen-flavors.sh
330332

333+
.PHONY: generate-e2e-templates ## Generate Azure infrastructure templates for the v1alpha4 CAPI test suite.
334+
generate-e2e-templates: $(KUSTOMIZE)
335+
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template.yaml
336+
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-md-remediation.yaml
337+
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-remediation.yaml
338+
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption/step1 --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption.yaml
339+
echo "---" >> $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption.yaml
340+
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption/step2 --load-restrictor LoadRestrictionsNone >> $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption.yaml
341+
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-machine-pool --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-machine-pool.yaml
342+
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-node-drain --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-node-drain.yaml
343+
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-upgrades --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-upgrades.yaml
344+
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-scale-in.yaml
345+
331346
## --------------------------------------
332347
## Docker
333348
## --------------------------------------

templates/test/dev/cluster-template-v1alpha4.yaml

Whitespace-only changes.

test/e2e/capi_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,28 @@ var _ = Describe("Running the Cluster API E2E tests", func() {
144144
}
145145
})
146146
})
147+
148+
Context("Should successfully scale out and scale in a MachineDeployment", func() {
149+
capi_e2e.MachineDeploymentScaleSpec(context.TODO(), func() capi_e2e.MachineDeploymentScaleSpecInput {
150+
return capi_e2e.MachineDeploymentScaleSpecInput{
151+
E2EConfig: e2eConfig,
152+
ClusterctlConfigPath: clusterctlConfigPath,
153+
BootstrapClusterProxy: bootstrapClusterProxy.(framework.ClusterProxy),
154+
ArtifactFolder: artifactFolder,
155+
SkipCleanup: skipCleanup,
156+
}
157+
})
158+
})
159+
160+
Context("Should successfully set and use node drain timeout", func() {
161+
capi_e2e.NodeDrainTimeoutSpec(context.TODO(), func() capi_e2e.NodeDrainTimeoutSpecInput {
162+
return capi_e2e.NodeDrainTimeoutSpecInput{
163+
E2EConfig: e2eConfig,
164+
ClusterctlConfigPath: clusterctlConfigPath,
165+
BootstrapClusterProxy: bootstrapClusterProxy.(framework.ClusterProxy),
166+
ArtifactFolder: artifactFolder,
167+
SkipCleanup: skipCleanup,
168+
}
169+
})
170+
})
147171
})

test/e2e/config/azure-dev.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ providers:
5858
- sourcePath: "../data/shared/v1alpha4/metadata.yaml"
5959
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow.yaml"
6060
targetName: "cluster-template.yaml"
61-
- sourcePath: "../data/infrastructure-azure/cluster-template-kcp-adoption.yaml"
61+
- sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption.yaml"
6262
targetName: "cluster-template-kcp-adoption.yaml"
6363
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-ipv6.yaml"
6464
targetName: "cluster-template-ipv6.yaml"
65-
- sourcePath: "../data/infrastructure-azure/cluster-template-md-remediation.yaml"
65+
- sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-md-remediation.yaml"
6666
targetName: "cluster-template-md-remediation.yaml"
67-
- sourcePath: "../data/infrastructure-azure/cluster-template-kcp-remediation.yaml"
67+
- sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-kcp-remediation.yaml"
6868
targetName: "cluster-template-kcp-remediation.yaml"
69-
- sourcePath: "../data/infrastructure-azure/cluster-template-kcp-scale-in.yaml"
69+
- sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-kcp-scale-in.yaml"
7070
targetName: "cluster-template-kcp-scale-in.yaml"
7171
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-machine-pool.yaml"
7272
targetName: "cluster-template-machine-pool.yaml"

0 commit comments

Comments
 (0)