Skip to content

Commit 99c9f5e

Browse files
authored
test: add support bundle to troubleshoot CI issues (k0rdent#363)
* test: add troubleshooting support-bundle * chore: update adopted cluster template version
1 parent 3b91052 commit 99c9f5e

File tree

5 files changed

+86
-24
lines changed

5 files changed

+86
-24
lines changed

.github/workflows/pr_test_upgrade.yml

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ jobs:
8989
run: |
9090
make dev-operators-deploy
9191
make dev-ms-deploy
92-
# make dev-storage-deploy
93-
# make dev-collectors-deploy
92+
make dev-storage-deploy
93+
make dev-collectors-deploy
9494
- name: Fetch PR Ref and Checkout Repo
9595
uses: ./.github/actions/fetch-pr-ref
9696
- name: Install KOF CLI
@@ -106,23 +106,34 @@ jobs:
106106
run: |
107107
make dev-operators-deploy
108108
make dev-ms-deploy
109-
# TODO: Swap with KIND adopted clusters after fix of https://github.com/k0rdent/kof/issues/352
110-
make dev-storage-deploy
111-
make dev-collectors-deploy
112-
# - name: Run KIND kof regional cluster
113-
# run: |
114-
# make dev-adopted-deploy KIND_CLUSTER_NAME=regional-adopted
115-
# - name: Run KIND cloud provider
116-
# run: docker run -d --rm --network kind -v /var/run/docker.sock:/var/run/docker.sock registry.k8s.io/cloud-provider-kind/cloud-controller-manager:v0.6.0
117-
# - name: Deploy KOF Components on Adopted regional cluster
118-
# run: |
119-
# make dev-regional-deploy-adopted
120-
# - name: Run KIND kof child cluster
121-
# run: |
122-
# make dev-adopted-deploy KIND_CLUSTER_NAME=child-adopted
123-
# - name: Configure CoreDNS hosts on child cluster
124-
# run: |
125-
# make dev-child-coredns
126-
# - name: Deploy KOF Components on Adopted child cluster
127-
# run: |
128-
# make dev-child-deploy-adopted
109+
- name: Cleanup kind clusters if any
110+
run: |
111+
make dev-adopted-rm KIND_CLUSTER_NAME=child-adopted
112+
make dev-adopted-rm KIND_CLUSTER_NAME=regional-adopted
113+
- name: Run KIND kof regional cluster
114+
run: |
115+
make dev-adopted-deploy KIND_CLUSTER_NAME=regional-adopted
116+
- name: Run KIND cloud provider
117+
run: docker run -d --rm --network kind -v /var/run/docker.sock:/var/run/docker.sock registry.k8s.io/cloud-provider-kind/cloud-controller-manager:v0.6.0
118+
- name: Deploy KOF Components on Adopted regional cluster
119+
run: |
120+
make dev-regional-deploy-adopted
121+
- name: Run KIND kof child cluster
122+
run: |
123+
make dev-adopted-deploy KIND_CLUSTER_NAME=child-adopted
124+
- name: Configure CoreDNS hosts on child cluster
125+
run: |
126+
make dev-child-coredns
127+
- name: Deploy KOF Components on Adopted child cluster
128+
run: |
129+
make dev-child-deploy-adopted
130+
- name: Make support-bundle
131+
if: ${{ failure() }}
132+
run: |
133+
make support-bundle
134+
- name: Archive support-bundle
135+
if: ${{ failure() }}
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: support-bundle.tar.gz
139+
path: ./support-bundle-*.tar.gz

Makefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ $(LOCALBIN):
44
mkdir -p $(LOCALBIN)
55

66

7+
HOSTOS := $(shell go env GOHOSTOS)
8+
HOSTARCH := $(shell go env GOHOSTARCH)
9+
710
TEMPLATES_DIR := charts
811
CHARTS_PACKAGE_DIR ?= $(LOCALBIN)/charts
912
EXTENSION_CHARTS_PACKAGE_DIR ?= $(LOCALBIN)/charts/extensions
@@ -134,6 +137,17 @@ dev-istio-deploy: dev ## Deploy kof-istio helm chart to the K8s cluster specifie
134137
@$(call set_local_registry, "dev/istio-values.yaml")
135138
$(HELM_UPGRADE) --create-namespace -n istio-system kof-istio ./charts/kof-istio -f dev/istio-values.yaml
136139

140+
.PHONY: dev-adopted-rm
141+
dev-adopted-rm: dev kind envsubst ## Create adopted cluster deployment
142+
@if $(KIND) get clusters | grep -q "^$(KIND_CLUSTER_NAME)$$"; then \
143+
if [ -n "$(KIND_CONFIG_PATH)" ]; then \
144+
$(KIND) delete cluster -n $(KIND_CLUSTER_NAME) --config "$(KIND_CONFIG_PATH)"; \
145+
else \
146+
$(KIND) delete cluster -n $(KIND_CLUSTER_NAME); \
147+
fi \
148+
fi; \
149+
$(KUBECTL) delete clusterdeployment --ignore-not-found=true $(KIND_CLUSTER_NAME) -n kcm-system || true
150+
137151
.PHONY: dev-adopted-deploy
138152
dev-adopted-deploy: dev kind envsubst ## Create adopted cluster deployment
139153
@if ! $(KIND) get clusters | grep -q "^$(KIND_CLUSTER_NAME)$$"; then \
@@ -251,13 +265,16 @@ export HELM HELM_UPGRADE
251265
KIND ?= $(LOCALBIN)/kind-$(KIND_VERSION)
252266
YQ ?= $(LOCALBIN)/yq-$(YQ_VERSION)
253267
ENVSUBST ?= $(LOCALBIN)/envsubst-$(ENVSUBST_VERSION)
268+
SUPPORT_BUNDLE_CLI ?= $(LOCALBIN)/support-bundle-$(SUPPORT_BUNDLE_CLI_VERSION)
269+
254270
export YQ
255271

256272
## Tool Versions
257273
HELM_VERSION ?= v3.15.1
258274
YQ_VERSION ?= v4.44.2
259275
KIND_VERSION ?= v0.27.0
260276
ENVSUBST_VERSION ?= v1.4.2
277+
SUPPORT_BUNDLE_CLI_VERSION ?= v0.117.0
261278

262279
.PHONY: yq
263280
yq: $(YQ) ## Download yq locally if necessary.
@@ -281,6 +298,13 @@ $(HELM): | $(LOCALBIN)
281298
rm -f $(LOCALBIN)/helm-*
282299
curl -s --fail $(HELM_INSTALL_SCRIPT) | USE_SUDO=false HELM_INSTALL_DIR=$(LOCALBIN) DESIRED_VERSION=$(HELM_VERSION) BINARY_NAME=helm-$(HELM_VERSION) PATH="$(LOCALBIN):$(PATH)" bash
283300

301+
.PHONY: support-bundle-cli
302+
support-bundle-cli: $(SUPPORT_BUNDLE_CLI) ## Download support-bundle locally if necessary.
303+
$(SUPPORT_BUNDLE_CLI): | $(LOCALBIN)
304+
curl -sL --fail https://github.com/replicatedhq/troubleshoot/releases/download/$(SUPPORT_BUNDLE_CLI_VERSION)/support-bundle_$(HOSTOS)_$(HOSTARCH).tar.gz | tar -xz -C $(LOCALBIN) && \
305+
mv $(LOCALBIN)/support-bundle $(SUPPORT_BUNDLE_CLI) && \
306+
chmod +x $(SUPPORT_BUNDLE_CLI)
307+
284308
.PHONY: helm-plugin
285309
helm-plugin:
286310
@if ! $(HELM) plugin list | grep -q "cm-push"; then \
@@ -290,6 +314,12 @@ helm-plugin:
290314
.PHONY: cli-install
291315
cli-install: yq helm kind helm-plugin ## Install the necessary CLI tools for deployment, development and testing.
292316

317+
.PHONY: support-bundle
318+
support-bundle: SUPPORT_BUNDLE_OUTPUT=$(CURDIR)/support-bundle-$(shell date +"%Y-%m-%dT%H_%M_%S")
319+
support-bundle: envsubst support-bundle-cli
320+
@NAMESPACE=$(NAMESPACE) $(ENVSUBST) -no-unset -i config/support-bundle.yaml | $(SUPPORT_BUNDLE_CLI) -o $(SUPPORT_BUNDLE_OUTPUT) --debug -
321+
322+
293323
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
294324
# $1 - target path with name of binary (ideally with version)
295325
# $2 - package url which can be installed

config/support-bundle.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: troubleshoot.sh/v1beta2
2+
kind: SupportBundle
3+
metadata:
4+
name: support-bundle
5+
spec:
6+
collectors:
7+
- logs:
8+
namespace: ${NAMESPACE}
9+
name: logs/${NAMESPACE}
10+
- logs:
11+
namespace: projectsveltos
12+
name: logs/projectsveltos
13+
- logs:
14+
namespace: kube-system
15+
name: logs/kube-system
16+
- logs:
17+
namespace: kubevirt
18+
name: logs/kubevirt
19+
- logs:
20+
namespace: cdi
21+
name: logs/cdi

demo/cluster/adopted-cluster-child.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
k0rdent.mirantis.com/kof-cluster-role: child
99
k0rdent.mirantis.com/kof-regional-cluster-name: regional-adopted
1010
spec:
11-
template: adopted-cluster-1-0-0
11+
template: adopted-cluster-1-0-1
1212
credential: child-adopted-cred
1313
config:
1414
clusterLabels:

demo/cluster/adopted-cluster-regional.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
k0rdent.mirantis.com/kof-storage-secrets: "true"
88
k0rdent.mirantis.com/kof-cluster-role: regional
99
spec:
10-
template: adopted-cluster-1-0-0
10+
template: adopted-cluster-1-0-1
1111
credential: regional-adopted-cred
1212
config:
1313
clusterLabels:

0 commit comments

Comments
 (0)