-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
118 lines (89 loc) · 4.08 KB
/
Makefile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
##################
### USED BY CI ###
##################
install-rancher: ## Install Rancher via Helm
@./scripts/install_rancher.sh
install-helm: ## Install Helm
curl --silent --location https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz | tar xz -C .
sudo mv linux-amd64/helm /usr/local/bin
sudo chown root:root /usr/local/bin/helm
sudo rm -rf linux-amd64/ helm-*.tar.gz
install-k3s: ## Install K3s with default options
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=${K3S_VERSION} sh -s - --write-kubeconfig-mode 644
## Wait for K3s to start (could be improved?)
timeout 2m bash -c "until ! kubectl get pod -A 2>/dev/null | grep -Eq 'ContainerCreating|CrashLoopBackOff'; do sleep 1; done"
install-epinio: ## Install Epinio with Helm
@./scripts/install_epinio.sh
uninstall-epinio: ## Uninstall Epinio with Helm
/usr/local/bin/helm uninstall epinio -n epinio
get-ca: ## Configure Cypress to use the epinio-ca
@./scripts/get_ca.sh
create-docker-secret: ## Create docker pull secret to avoid the docker hub rate limit
@./scripts/create_docker_secret.sh
install-rancher-experimental: ## Install Rancher via Helm with experimental flags
@./scripts/install_rancher_experimental.sh
prepare-e2e-ci-rancher: create-docker-secret install-k3s install-helm install-rancher get-ca ## Tests
prepare-e2e-ci-rancher-experimental: create-docker-secret install-k3s install-helm install-rancher-experimental get-ca ## Tests
prepare-e2e-ci-standalone: create-docker-secret install-k3s install-helm install-cert-manager install-epinio get-ca ## Tests
patch-epinio-ui:
@./scripts/patch_epinio-ui.sh
start-cypress-tests:
@./scripts/start_cypress_tests.sh
clean-k3s:
/usr/local/bin/k3s-uninstall.sh
clean-all: clean-k3s
/usr/local/bin/helm repo remove rancher-latest jetstack
########################
### LOCAL DEPLOYMENT ###
########################
export CLUSTER_NAME ?= epinio
export TMP_DIR ?= /tmp
export DOMAIN ?= $(IP_ADDR).nip.io
build-image: ## Build the e2e_image with latest tests version
docker build -t e2e_image .
cypress-gui: ## Start Cypress in GUI mode, need graphical environment
npm install
./node_modules/cypress/bin/cypress open -C cypress.config.ts
check-dependencies:
command -v docker && echo "docker - ok"
command -v k3d && echo "k3d - ok"
command -v kubectl && echo "kubectl - ok"
command -v helm && echo "helm - ok"
command -v epinio && echo "epinio - ok"
command -v jq && echo "jq - ok"
command -v npm && echo "npm - ok"
get-ingress-ip:
@echo "\nExport IP_ADDR with this IP before deploying Epinio"
kubectl get svc -n kube-system traefik -o jsonpath="{.status.loadBalancer.ingress[0]}" | jq -r ".ip"
create-cluster:
k3d cluster create $(CLUSTER_NAME) -p '80:80@loadbalancer' -p '443:443@loadbalancer'
kubectl rollout status deployment metrics-server -n kube-system --timeout=480s
delete-cluster:
k3d cluster delete $(CLUSTER_NAME)
install-cert-manager:
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm upgrade --install cert-manager --namespace cert-manager jetstack/cert-manager \
--create-namespace \
--set installCRDs=true \
--set extraArgs[0]=--enable-certificate-owner-ref=true \
--wait
deploy-epinio:
helm repo add epinio https://epinio.github.io/helm-charts
kubectl rollout status deployment traefik -n kube-system --timeout=480s
helm install epinio -n epinio --create-namespace epinio/epinio --set global.domain=${DOMAIN}
kubectl rollout status deployment epinio-server -n epinio --timeout=480s
undeploy-epinio: undeploy-epinio
helm uninstall -n epinio epinio
prepare-cluster:
@echo "\n\n****** STEP (0): Checking dependencies..."
$(MAKE) check-dependencies
@echo "\n\n****** STEP (1): Create k3d cluster..."
$(MAKE) create-cluster
@echo "\n\n****** STEP (2): Deploy cert-manager into cluster..."
$(MAKE) install-cert-manager
$(MAKE) get-ingress-ip
help: ## Show this Makefile's help
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
generate-cypress-readme: ## Generate tests description file
@./scripts/generate-readme cypress > cypress/README.md