Skip to content

Commit 895cf83

Browse files
authored
Refactor E2E templates generation for MHC (#810)
1 parent 1492989 commit 895cf83

File tree

5 files changed

+26
-264
lines changed

5 files changed

+26
-264
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ TOOLS_DIR := hack/tools
3030
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
3131
GO_INSTALL = ./scripts/go_install.sh
3232
E2E_CONF_FILE_ENVSUBST := $(REPO_ROOT)/test/e2e/config/ibmcloud-e2e-envsubst.yaml
33+
E2E_TEMPLATES := $(REPO_ROOT)/test/e2e/data/templates
3334

3435
GO_APIDIFF := $(TOOLS_BIN_DIR)/go-apidiff
3536
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
@@ -156,6 +157,10 @@ generate-go-conversions-core: $(CONVERSION_GEN)
156157
--output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE) \
157158
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
158159

160+
.PHONY: generate-e2e-templates
161+
generate-e2e-templates: $(KUSTOMIZE)
162+
$(KUSTOMIZE) build $(E2E_TEMPLATES)/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(E2E_TEMPLATES)/cluster-template-md-remediation.yaml
163+
159164
.PHONY: modules
160165
modules: ## Runs go mod to ensure modules are up to date
161166
go mod tidy
@@ -203,7 +208,7 @@ SKIP_CREATE_MGMT_CLUSTER ?= false
203208

204209
# Run the end-to-end tests
205210
.PHONY: test-e2e
206-
test-e2e: $(GINKGO) $(KUSTOMIZE) $(ENVSUBST) set-flavor e2e-image ## Run e2e tests
211+
test-e2e: $(GINKGO) $(KUSTOMIZE) $(ENVSUBST) set-flavor e2e-image generate-e2e-templates ## Run e2e tests
207212
$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST)
208213
$(GINKGO) $(GINKGO_ARGS) ./test/e2e -- \
209214
-e2e.artifacts-folder="$(ARTIFACTS)" \

test/e2e/config/ibmcloud-e2e-powervs.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ providers:
3838
files:
3939
- sourcePath: "${PWD}/metadata.yaml"
4040
targetName: "metadata.yaml"
41-
- sourcePath: "${PWD}/templates/cluster-template-powervs.yaml"
42-
targetName: "cluster-template-powervs.yaml"
4341
- sourcePath: "${PWD}/test/e2e/data/templates/cluster-template-md-remediation.yaml"
4442
targetName: "cluster-template-md-remediation.yaml"
4543

test/e2e/data/templates/cluster-template-md-remediation.yaml

Lines changed: 0 additions & 261 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ../../../../../templates/cluster-template-powervs.yaml
5+
- mhc-powervs.yaml
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: cluster.x-k8s.io/v1beta1
2+
kind: MachineHealthCheck
3+
metadata:
4+
name: "${CLUSTER_NAME}-mhc-0"
5+
spec:
6+
clusterName: "${CLUSTER_NAME}"
7+
maxUnhealthy: 100%
8+
nodeStartupTimeout: 20m
9+
selector:
10+
matchLabels:
11+
e2e.remediation.label: ""
12+
unhealthyConditions:
13+
- type: Ready
14+
status: "False"
15+
timeout: 30s

0 commit comments

Comments
 (0)