-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (48 loc) · 1.79 KB
/
Makefile
File metadata and controls
60 lines (48 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.DEFAULT_GOAL := help
.ONESHELL:
SHELL:=/usr/bin/env bash
KIND_CLUSTER_NAME := ${KIND_CLUSTER_NAME}
KINDCFG := ${PWD}/kind/kind-configuration.yaml
KUBECONFIG := $(cat ${PWD}/kubeconfig-path)
export KUBECONFIG
.PHONY: help
help:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
.PHONY: kind_create
kind_create: ## Install Control plane K8S
kind get clusters | grep ${KIND_CLUSTER_NAME} || \
kind create cluster --name ${KIND_CLUSTER_NAME} --config $(KINDCFG) && \
kubectl cluster-info --context kind-${KIND_CLUSTER_NAME}
.PHONY: kind_delete
kind_delete: ## Delete Control plane K8S
kind delete cluster --name ${KIND_CLUSTER_NAME} && \
kind get clusters
define taskawsbootstrapdelete
aws --profile=vmw cloudformation delete-stack --stack-name ${AWS_CLOUDFORMATION_STACK}
endef
.PHONY: aws_bootstrap_delete
aws_bootstrap_delete: ## Delete bootstraped AWS environment
$(value taskawsbootstrapdelete)
.PHONY: clusterctl_init_dry
clusterctl_init_dry:
clusterctl init --infrastructure aws --list-images
.PHONY: clusterctl_init
clusterctl_init:
clusterctl init --infrastructure=aws:${CAPA_VERSION} --core=cluster-api:${CAPI_VERSION} --v 10
.PHONY: clean_all
clean_all: ## Clean all the local environment
kind get clusters | xargs -I NAME kind delete cluster --name=NAME || exit 0
rm -rf ${PWD}/*kubeconfig*
touch ${PWD}/kubeconfig-path
define taskkubeconfig
rm -f ${PWD}/kubeconfig-path && touch ${PWD}/kubeconfig-path; \
mkdir -p ${PWD}/kubeconfig/; \
for k in $(kind get clusters); \
do \
kind get kubeconfig --name=${k} > ${PWD}/kubeconfig/${k}-kubeconfig; \
echo "$(cat kubeconfig-path)${PWD}/kubeconfig/${k}-kubeconfig" > ${PWD}/kubeconfig-path; \
done
endef
.PHONY: kubeconfig_export
kubeconfig_export: ## Export KUBECONFIG parameters
$(value taskkubeconfig)