-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinfra.yml
More file actions
284 lines (283 loc) · 6.46 KB
/
Copy pathinfra.yml
File metadata and controls
284 lines (283 loc) · 6.46 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
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
---
#service account for kubernetes-dashboard
apiVersion: v1
kind: ServiceAccount
metadata:
name: kubernetes-dashboard
namespace: kubernetes-dashboard
---
#cluster role for kubernetes-dashboard
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kubernetes-dashboard
rules:
# allow any action on any api
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
# allow any action on any api
- nonResourceURLs: ["*"]
verbs: ["*"]
#cluster role for kubernetes-dashboard
---
#cluster role binding for kubernetes-dashboard
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubernetes-dashboard
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: faas-api-role
rules:
- apiGroups: ["serving.knative.dev"]
resources: ["services"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: faas-api
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: faas-api-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: faas-api-role
subjects:
- kind: ServiceAccount
name: faas-api
namespace: default
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: faas-frontend
labels:
app: faas-frontend
spec:
replicas: 1
selector:
matchLabels:
app: faas-frontend
template:
metadata:
labels:
app: faas-frontend
spec:
containers:
- name: faas-frontend
image: nginx:1.14.2
ports:
- containerPort: 80
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
volumeMounts:
- name: faas-html
mountPath: /usr/share/nginx/html
volumes:
- name: faas-html
configMap:
name: faas-html
---
apiVersion: v1
kind: ConfigMap
metadata:
name: faas-api-env
data:
DOCKER_REGISTRY: "index.docker.io"
DOCKER_HOST: "tcp://localhost:2375"
COOKIE_DOMAIN: ""
COOKIE_SECURE: "false"
---
apiVersion: v1
kind: Secret
metadata:
name: faas-api-secret
type: Opaque
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: faas-api
spec:
replicas: 1
selector:
matchLabels:
app: faas-api
template:
metadata:
labels:
app: faas-api
spec:
serviceAccountName: faas-api
containers:
- name: dind
image: docker:20.10-dind
securityContext:
privileged: true
env:
- name: DOCKER_TLS_CERTDIR
value: ""
volumeMounts:
- name: dind-data
mountPath: /var/lib/docker
resources:
requests:
cpu: "500m"
memory: "1Gi"
limits:
cpu: "2"
memory: "4Gi"
- name: faas-api
image: jairjosafath/faas-api:latest
ports:
- containerPort: 8090
envFrom:
- configMapRef:
name: faas-api-env
env:
- name: DOCKER_USERNAME
valueFrom:
secretKeyRef:
name: faas-api-secret
key: DOCKER_USERNAME
- name: DOCKER_PASSWORD
valueFrom:
secretKeyRef:
name: faas-api-secret
key: DOCKER_PASSWORD
- name: AUTH0_CLIENT_ID
valueFrom:
secretKeyRef:
name: faas-api-secret
key: AUTH0_CLIENT_ID
- name: AUTH0_DOMAIN
valueFrom:
secretKeyRef:
name: faas-api-secret
key: AUTH0_DOMAIN
- name: AUTH0_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: faas-api-secret
key: AUTH0_CLIENT_SECRET
- name: AUTH0_CALLBACK_URL
valueFrom:
secretKeyRef:
name: faas-api-secret
key: AUTH0_CALLBACK_URL
- name: COOKIE_SECRET
valueFrom:
secretKeyRef:
name: faas-api-secret
key: COOKIE_SECRET
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
volumes:
- name: dind-data
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: faas-api
labels:
app: faas-api
spec:
ports:
- port: 8090
targetPort: 8090
selector:
app: faas-api
type: ClusterIP
---
apiVersion: v1
kind: ConfigMap
metadata:
name: faas-html
data:
index.html: |
<!DOCTYPE html>
<html>
<head>
<title>Simple FaaS FE</title>
</head>
<body>
<h1>Welcome to the Simple FaaS FE</h1>
<p>This is a simple FaaS FE.</p>
</body>
</html>
---
apiVersion: v1
kind: Service
metadata:
name: faas-frontend
labels:
app: faas-frontend
spec:
ports:
- port: 80
targetPort: 80
selector:
app: faas-frontend
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: faas-ingress
annotations:
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
nginx.ingress.kubernetes.io/cors-allow-origin: "https://www.faas.test"
nginx.ingress.kubernetes.io/cors-allow-methods: "GET, PUT, POST, DELETE, PATCH, OPTIONS"
nginx.ingress.kubernetes.io/cors-allow-headers: "*"
nginx.ingress.kubernetes.io/affinity: "cookie"
spec:
ingressClassName: nginx
rules:
- host: www.faas.test
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: faas-frontend
port:
number: 80
- path: /api
pathType: Prefix
backend:
service:
name: faas-api
port:
number: 8090