@@ -4,6 +4,9 @@ $(LOCALBIN):
44 mkdir -p $(LOCALBIN )
55
66
7+ HOSTOS := $(shell go env GOHOSTOS)
8+ HOSTARCH := $(shell go env GOHOSTARCH)
9+
710TEMPLATES_DIR := charts
811CHARTS_PACKAGE_DIR ?= $(LOCALBIN ) /charts
912EXTENSION_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
138152dev-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
251265KIND ?= $(LOCALBIN ) /kind-$(KIND_VERSION )
252266YQ ?= $(LOCALBIN ) /yq-$(YQ_VERSION )
253267ENVSUBST ?= $(LOCALBIN ) /envsubst-$(ENVSUBST_VERSION )
268+ SUPPORT_BUNDLE_CLI ?= $(LOCALBIN ) /support-bundle-$(SUPPORT_BUNDLE_CLI_VERSION )
269+
254270export YQ
255271
256272# # Tool Versions
257273HELM_VERSION ?= v3.15.1
258274YQ_VERSION ?= v4.44.2
259275KIND_VERSION ?= v0.27.0
260276ENVSUBST_VERSION ?= v1.4.2
277+ SUPPORT_BUNDLE_CLI_VERSION ?= v0.117.0
261278
262279.PHONY : yq
263280yq : $(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
285309helm-plugin :
286310 @if ! $(HELM ) plugin list | grep -q " cm-push" ; then \
@@ -290,6 +314,12 @@ helm-plugin:
290314.PHONY : cli-install
291315cli-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
0 commit comments