-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
207 lines (165 loc) · 9.1 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
NAME = faas-lebowski
VERSION = 1.0.0
GCP = gcloud
ZONE = europe-west1-b
K8S = kubectl
DOCKER_USERNAME ?= lreimer
DOCKER_PASSWORD ?=
.PHONY: info
info:
@echo "The Big Cloud Native FaaS Lebowski"
prepare:
@$(GCP) config set compute/zone $(ZONE)
@$(GCP) config set container/use_client_certificate False
cluster:
@echo "Create GKE Cluster"
# --[no-]enable-basic-auth --[no-]issue-client-certificate
@$(GCP) container clusters create $(NAME) --num-nodes=5 --enable-autoscaling --min-nodes=5 --max-nodes=10 --machine-type=n1-standard-4 --enable-stackdriver-kubernetes --enable-ip-alias --enable-autorepair --scopes cloud-platform --addons HorizontalPodAutoscaling,HttpLoadBalancing --cluster-version "1.14"
@$(K8S) create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=$$(gcloud config get-value core/account)
@$(K8S) apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
@$(K8S) apply -f traefik/traefik-rbac.yaml
@$(K8S) apply -f traefik/traefik-ds.yaml
@$(K8S) apply -f traefik/traefik-ui.yaml
@$(K8S) cluster-info
helm-install:
@echo "Install Helm"
@curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
helm-init:
@echo "Initialize Helm"
# add a service account within a namespace to segregate tiller
@$(K8S) --namespace kube-system create sa tiller
# create a cluster role binding for tiller
@$(K8S) create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
@helm init --service-account tiller
@helm repo update
# verify that helm is installed in the cluster
@$(K8S) get deploy,svc tiller-deploy -n kube-system
fission-sources:
@mkdir -p fission && rm -rf fission/fission/ && rm -rf fission/fission-workflow/ && rm -rf fission/fission-ui/
@git clone --depth 1 https://github.com/fission/fission.git fission/fission
@git clone --depth 1 https://github.com/fission/fission-workflow.git fission/fission-workflow
@git clone --depth 1 https://github.com/fission/fission-ui.git fission/fission-ui
fission-manual:
@$(K8S) create namespace fission
@$(K8S) -n fission apply -f https://github.com/fission/fission/releases/download/1.8.0/fission-core-1.8.0.yaml
fission-install-helm2:
# we could also use the fission-all Helm chart
@$(K8S) create namespace fission
@helm install --name fission --namespace fission https://github.com/fission/fission/releases/download/1.8.0/fission-core-1.8.0.tgz
@$(K8S) apply -f fission/fission-ui/docker/fission-ui.yaml
@$(K8S) apply -f fission/fission-ui.yaml
fission-install-helm3:
# we could also use the fission-all Helm chart
@$(K8S) create namespace fission
@helm install --namespace fission --name-template fission https://github.com/fission/fission/releases/download/1.8.0/fission-core-1.8.0.tgz
@$(K8S) apply -f fission/fission-ui/docker/fission-ui.yaml
@$(K8S) apply -f fission/fission-ui.yaml
fission-delete-helm3:
@$(K8S) delete -f fission/fission-ui.yaml
@$(K8S) delete -f fission/fission-ui/docker/fission-ui.yaml
@helm uninstall --namespace fission fission
@$(K8S) delete namespace fission
fission-delete:
@helm delete --purge fission
@$(K8S) delete crd canaryconfigs.fission.io --ignore-not-found=true
@$(K8S) delete crd environments.fission.io --ignore-not-found=true
@$(K8S) delete crd functions.fission.io --ignore-not-found=true
@$(K8S) delete crd httptriggers.fission.io --ignore-not-found=true
@$(K8S) delete crd kuberneteswatchtriggers.fission.io --ignore-not-found=true
@$(K8S) delete crd messagequeuetriggers.fission.io --ignore-not-found=true
@$(K8S) delete crd packages.fission.io --ignore-not-found=true
@$(K8S) delete crd recorders.fission.io --ignore-not-found=true
@$(K8S) delete crd timetriggers.fission.io --ignore-not-found=true
@$(K8S) delete ns fission --ignore-not-found=true
@$(K8S) delete ns fission-builder --ignore-not-found=true
kubeless-sources:
@mkdir -p kubeless && rm -rf kubeless/kubeless/ && rm -rf kubeless/kubeless-ui
@git clone --depth 1 https://github.com/kubeless/kubeless.git kubeless/kubeless
@git clone --depth 1 https://github.com/kubeless/kubeless-ui.git kubeless/kubeless-ui
kubeless-install:
@$(K8S) create ns kubeless
@$(K8S) apply -f https://github.com/kubeless/kubeless/releases/download/v1.0.6/kubeless-v1.0.6.yaml
@$(K8S) apply -f https://raw.githubusercontent.com/kubeless/kubeless-ui/master/k8s.yaml
@$(K8S) apply -f kubeless/kubeless-ui.yaml
kubeless-delete:
@$(K8S) delete -f kubeless/kubeless-ui.yaml
@$(K8S) delete -f https://raw.githubusercontent.com/kubeless/kubeless-ui/master/k8s.yaml
@$(K8S) delete -f https://github.com/kubeless/kubeless/releases/download/v1.0.6/kubeless-v1.0.6.yaml --ignore-not-found=true
@$(K8S) delete crd cronjobtriggers.kubeless.io --ignore-not-found=true
@$(K8S) delete crd functions.kubeless.io --ignore-not-found=true
@$(K8S) delete crd httptriggers.kubeless.io --ignore-not-found=true
@$(K8S) delete ns kubeless
fnproject-sources:
@mkdir -p fnproject && rm -rf fnproject/fn/ && rm -rf fnproject/fn-helm
@git clone --depth 1 https://github.com/fnproject/fn.git fnproject/fn
@git clone --depth 1 https://github.com/fnproject/fn-helm.git fnproject/fn-helm
fnproject-install:
@curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh
@helm install --name cert-manager --namespace kube-system --set ingressShim.defaultIssuerName=letsencrypt-staging --set ingressShim.defaultIssuerKind=ClusterIssuer stable/cert-manager --version v0.3.0
@cd fnproject/fn-helm && helm dep build fn && helm install --name fnproject -f ../values.yaml fn
fnproject-delete:
@helm delete --purge fnproject
openfaas-arcade:
@curl -SLsf https://dl.get-arkade.dev/ | sudo sh
openfaas-sources:
@mkdir -p openfaas && rm -rf openfaas/faas/ && rm -rf openfaas/faas-netes/
@git clone --depth 1 https://github.com/openfaas/faas.git openfaas/faas
@git clone --depth 1 https://github.com/openfaas/faas-netes.git openfaas/faas-netes
openfaas-install-helm2:
@$(K8S) apply -f openfaas/faas-netes/namespaces.yml
@helm repo add openfaas https://openfaas.github.io/faas-netes/
@$(K8S) -n openfaas create secret generic basic-auth --from-literal=basic-auth-user=admin --from-literal=basic-auth-password=openfaas
@helm upgrade openfaas --install openfaas/openfaas --namespace openfaas --set basic_auth=true --set functionNamespace=openfaas-fn --set serviceType=LoadBalancer --set ingress.enabled=true
@$(K8S) apply -f openfaas/openfaas-gateway.yaml
export OPENFAAS_URL=http://openfaas.demo
@faas-cli login --password openfaas
openfaas-install-arcade:
@ark install openfaas --load-balancer
@kubectl get svc -o wide gateway-external -n openfaas
@$(K8S) apply -f openfaas/openfaas-gateway.yaml
openfaas-deploy:
faas-cli deploy -f https://raw.githubusercontent.com/openfaas/faas/master/stack.yml
openfaas-delete:
@helm delete --purge openfaas
@$(K8S) delete namespace/openfaas
@$(K8S) delete namespace/openfaas-fn
nuclio-sources:
@mkdir -p nuclio && rm -rf nuclio/nuclio/ && rm -rf nuclio/templates/
@git clone --depth 1 https://github.com/nuclio/nuclio.git nuclio/nuclio/
@git clone --depth 1 https://github.com/nuclio/nuclio-templates.git nuclio/templates/
@curl -sL https://github.com/nuclio/nuclio/releases/download/1.1.12/nuctl-1.1.12-darwin-amd64 -o nuclio/nuctl && chmod +x nuclio/nuctl
nuclio-install:
@$(K8S) create namespace nuclio
@echo "Remember to set DOCKER_USERNAME and DOCKER_PASSWORD env variables."
@$(K8S) create secret docker-registry registry-credentials --namespace nuclio --docker-username $$DOCKER_USERNAME --docker-password $$DOCKER_PASSWORD --docker-server registry.hub.docker.com --docker-email [email protected]
@$(K8S) create configmap --namespace nuclio nuclio-registry --from-literal=registry_url=registry.hub.docker.com/lreimer
@$(K8S) apply -f nuclio/nuclio/hack/k8s/resources/nuclio-rbac.yaml
@$(K8S) apply -f nuclio/nuclio/hack/gke/resources/nuclio.yaml
@$(K8S) apply -f nuclio/nuclio-dashboard.yaml
@$(K8S) -n nuclio get all
nuclio-delete:
@$(K8S) delete -f nuclio/nuclio/hack/gke/resources/nuclio.yaml --ignore-not-found=true
@$(K8S) delete -f nuclio/nuclio/hack/k8s/resources/nuclio-rbac.yaml --ignore-not-found=true
@$(K8S) delete namespace nuclio --ignore-not-found=true
knative-gloo:
@glooctl install gateway
@glooctl install knative --install-knative --install-eventing --install-monitoring
@$(K8S) apply --filename https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.8.0/release.yaml
@$(K8S) get pods --namespace gloo-system
@$(K8S) get pods --namespace knative-serving
@$(K8S) get pods --namespace knative-eventing
@$(K8S) get pods --namespace knative-monitoring
@$(K8S) get pods --namespace tekton-pipelines
@$(K8S) get svc -n gloo-system
@$(K8S) edit cm config-domain --namespace knative-serving
gcloud-login:
@$(GCP) auth application-default login
access-token:
@$(GCP) config config-helper --format=json | jq .credential.access_token
dashboard:
@$(K8S) proxy & 2>&1
@sleep 3
@$(GCP) config config-helper --format=json | jq .credential.access_token
@open http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
destroy:
@$(GCP) container clusters delete $(NAME) --async --quiet