-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
init_containers_migrations_deploy.yml
63 lines (63 loc) · 1.34 KB
/
init_containers_migrations_deploy.yml
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
apiVersion: apps/v1
kind: Deployment
metadata:
name: init-container-migrations
spec:
revisionHistoryLimit: 0
selector:
matchLabels:
app: init-container-migrations
replicas: 5
template:
metadata:
labels:
app: init-container-migrations
svc: example
spec:
serviceAccountName: job-read
initContainers:
- name: wait-for-migrations
image: sikalabs/kubectl
command:
- "/bin/sh"
- "-c"
- "sleep 2 && kubectl wait --for=condition=complete --timeout=600s job/sleep20s"
containers:
- name: main
image: ondrejsika/training-example
ports:
- containerPort: 80
resources:
requests:
memory: 10Mi
cpu: 10m
limits:
memory: 100Mi
cpu: 20m
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: job-read
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: job-read
rules:
- apiGroups: ["batch"]
resources: ["jobs"]
resourceNames: ["sleep20s"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: job-read
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: job-read
subjects:
- kind: ServiceAccount
name: job-read