Skip to content

Commit

Permalink
[fix] : always cleanup child clusters (#440)
Browse files Browse the repository at this point in the history
* fix cleanup of child clusters if e2e run is cancelled

* add kubectl to localbin

---------

Co-authored-by: Rahul Sharma <[email protected]>
  • Loading branch information
rahulait and rahulait authored Aug 8, 2024
1 parent d0fcbd7 commit 5fd7371
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ jobs:
CLUSTERCTL_CONFIG: /home/runner/work/cluster-api-provider-linode/cluster-api-provider-linode/e2e/gha-clusterctl-config.yaml
run: make e2etest

- name: cleanup stale clusters
if: ${{ always() }}
run: make clean-child-clusters

- name: Copy logs
if: ${{ always() }}
run: docker cp tilt-control-plane:/var/log .logs
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ clean-release-git: ## Restores the git files usually modified during a release
clean-release: clean-release-git
rm -rf $(RELEASE_DIR)

.PHONY: clean-child-clusters
clean-child-clusters: kubectl
$(KUBECTL) delete clusters -A --all --timeout=180s
$(KUBECTL) delete linodevpc -A --all --timeout=60s

## --------------------------------------
## Build Dependencies
## --------------------------------------
Expand Down Expand Up @@ -316,6 +321,7 @@ GOWRAP ?= $(CACHE_BIN)/gowrap
KUSTOMIZE_VERSION ?= v5.4.1
CTLPTL_VERSION ?= v0.8.29
CLUSTERCTL_VERSION ?= v1.7.2
KUBECTL_VERSION ?= v1.28.0
KUBEBUILDER_VERSION ?= v3.15.1
CONTROLLER_TOOLS_VERSION ?= v0.14.0
TILT_VERSION ?= 0.33.10
Expand All @@ -328,7 +334,7 @@ MOCKGEN_VERSION ?= v0.4.0
GOWRAP_VERSION ?= latest

.PHONY: tools
tools: $(KUSTOMIZE) $(CTLPTL) $(CLUSTERCTL) $(CONTROLLER_GEN) $(CONVERSION_GEN) $(TILT) $(KIND) $(CHAINSAW) $(ENVTEST) $(HUSKY) $(NILAWAY) $(GOVULNC) $(MOCKGEN) $(GOWRAP)
tools: $(KUSTOMIZE) $(CTLPTL) $(CLUSTERCTL) $(KUBECTL) $(CONTROLLER_GEN) $(CONVERSION_GEN) $(TILT) $(KIND) $(CHAINSAW) $(ENVTEST) $(HUSKY) $(NILAWAY) $(GOVULNC) $(MOCKGEN) $(GOWRAP)


.PHONY: kustomize
Expand All @@ -347,6 +353,12 @@ $(CLUSTERCTL): $(LOCALBIN)
curl -fsSL https://github.com/kubernetes-sigs/cluster-api/releases/download/$(CLUSTERCTL_VERSION)/clusterctl-$(OS)-$(ARCH_SHORT) -o $(CLUSTERCTL)
chmod +x $(CLUSTERCTL)

.PHONY: kubectl
kubectl: $(KUBECTL) ## Download kubectl locally if necessary.
$(KUBECTL): $(LOCALBIN)
curl -fsSL https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/$(OS)/$(ARCH_SHORT)/kubectl -o $(KUBECTL)
chmod +x $(KUBECTL)

.PHONY: kubebuilder
kubebuilder: $(KUBEBUILDER) ## Download kubebuilder locally if necessary.
$(KUBEBUILDER): $(LOCALBIN)
Expand Down

0 comments on commit 5fd7371

Please sign in to comment.