Skip to content

Commit

Permalink
Refactor infrastructure-azure templates required by CAPI tests to mat…
Browse files Browse the repository at this point in the history
…ch CAPD
  • Loading branch information
Cecile Robert-Michon committed Jun 9, 2021
1 parent d1ada8a commit 5d9dc2b
Show file tree
Hide file tree
Showing 28 changed files with 511 additions and 908 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ test/e2e/config/azure-dev-envsubst.yaml
test/e2e/logs/*
_artifacts

# E2E test templates
test/e2e/data/infrastructure-azure/v1alpha4/cluster-template*.yaml

# boilerplate_test output
hack/boilerplate/__pycache__
hack/boilerplate/*.pyc
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ E2E_DATA_DIR ?= $(ROOT_DIR)/test/e2e/data
KUBETEST_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/conformance.yaml)
KUBETEST_WINDOWS_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/upstream-windows.yaml)
KUBETEST_REPO_LIST_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/repo-list.yaml)
AZURE_TEMPLATES := $(E2E_DATA_DIR)/infrastructure-azure

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

.PHONY: test-e2e-run
test-e2e-run: $(ENVSUBST) $(KUBECTL) $(GINKGO) ## Run e2e tests
test-e2e-run: generate-e2e-templates $(ENVSUBST) $(KUBECTL) $(GINKGO) ## Run e2e tests
$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) && \
$(GINKGO) -v -trace -tags=e2e -focus="$(GINKGO_FOCUS)" -skip="$(GINKGO_SKIP)" -nodes=$(GINKGO_NODES) --noColor=$(GINKGO_NOCOLOR) $(GINKGO_ARGS) ./test/e2e -- \
-e2e.artifacts-folder="$(ARTIFACTS)" \
Expand Down Expand Up @@ -289,6 +290,7 @@ generate: ## Generate code
$(MAKE) generate-go
$(MAKE) generate-manifests
$(MAKE) generate-flavors
$(MAKE) generate-e2e-templates

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

.PHONY: generate-e2e-templates ## Generate Azure infrastructure templates for the v1alpha4 CAPI test suite.
generate-e2e-templates: $(KUSTOMIZE)
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template.yaml
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-md-remediation.yaml
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-remediation.yaml
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption/step1 --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption.yaml
echo "---" >> $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption.yaml
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption/step2 --load-restrictor LoadRestrictionsNone >> $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption.yaml
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-machine-pool --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-machine-pool.yaml
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-node-drain --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-node-drain.yaml
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-upgrades --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-upgrades.yaml
$(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-scale-in.yaml

## --------------------------------------
## Docker
## --------------------------------------
Expand Down
Empty file.
24 changes: 24 additions & 0 deletions test/e2e/capi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,28 @@ var _ = Describe("Running the Cluster API E2E tests", func() {
}
})
})

Context("Should successfully scale out and scale in a MachineDeployment", func() {
capi_e2e.MachineDeploymentScaleSpec(context.TODO(), func() capi_e2e.MachineDeploymentScaleSpecInput {
return capi_e2e.MachineDeploymentScaleSpecInput{
E2EConfig: e2eConfig,
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy.(framework.ClusterProxy),
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
}
})
})

Context("Should successfully set and use node drain timeout", func() {
capi_e2e.NodeDrainTimeoutSpec(context.TODO(), func() capi_e2e.NodeDrainTimeoutSpecInput {
return capi_e2e.NodeDrainTimeoutSpecInput{
E2EConfig: e2eConfig,
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy.(framework.ClusterProxy),
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
}
})
})
})
8 changes: 4 additions & 4 deletions test/e2e/config/azure-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ providers:
- sourcePath: "../data/shared/v1alpha4/metadata.yaml"
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow.yaml"
targetName: "cluster-template.yaml"
- sourcePath: "../data/infrastructure-azure/cluster-template-kcp-adoption.yaml"
- sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption.yaml"
targetName: "cluster-template-kcp-adoption.yaml"
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-ipv6.yaml"
targetName: "cluster-template-ipv6.yaml"
- sourcePath: "../data/infrastructure-azure/cluster-template-md-remediation.yaml"
- sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-md-remediation.yaml"
targetName: "cluster-template-md-remediation.yaml"
- sourcePath: "../data/infrastructure-azure/cluster-template-kcp-remediation.yaml"
- sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-kcp-remediation.yaml"
targetName: "cluster-template-kcp-remediation.yaml"
- sourcePath: "../data/infrastructure-azure/cluster-template-kcp-scale-in.yaml"
- sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-kcp-scale-in.yaml"
targetName: "cluster-template-kcp-scale-in.yaml"
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-machine-pool.yaml"
targetName: "cluster-template-machine-pool.yaml"
Expand Down
Loading

0 comments on commit 5d9dc2b

Please sign in to comment.