-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s-deploy-cddru-new.yaml
226 lines (202 loc) · 5.18 KB
/
k8s-deploy-cddru-new.yaml
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
# region: Volumes
# apiVersion: v1
# kind: PersistentVolume
# metadata:
# name: nfs-pv-main-site
# spec:
# capacity:
# storage: 5Gi
# volumeMode: Filesystem
# accessModes:
# - ReadWriteMany
# persistentVolumeReclaimPolicy: Recycle
# storageClassName: nfs
# mountOptions:
# - hard
# - nfsvers=4.1
# nfs:
# server: ${NFS_SERVER}
# path: /var/nfs/main-site
# ---
# apiVersion: v1
# kind: PersistentVolumeClaim
# metadata:
# namespace: test-app
# name: nfs-pvc-main-site
# spec:
# storageClassName: nfs
# accessModes:
# - ReadWriteMany
# resources:
# requests:
# storage: 3500Mi
# volumeName: nfs-pv-main-site
# ---
# apiVersion: v1
# kind: PersistentVolume
# metadata:
# name: nfs-pv-cdddru
# spec:
# capacity:
# storage: 5Gi
# volumeMode: Filesystem
# accessModes:
# - ReadWriteMany
# persistentVolumeReclaimPolicy: Recycle
# storageClassName: nfs
# mountOptions:
# - hard
# - nfsvers=4.1
# nfs:
# server: ${NFS_SERVER}
# path: /var/nfs/cdddru
# ---
# apiVersion: v1
# kind: PersistentVolumeClaim
# metadata:
# namespace: test-app
# name: nfs-pvc-cdddru
# spec:
# accessModes:
# - ReadWriteMany
# storageClassName: nfs
# resources:
# requests:
# storage: 512Mi
# volumeName: nfs-pv-cdddru
# # endregion
# ---
# MAIN DEPLOYMENT
apiVersion: apps/v1
kind: Deployment
metadata:
name: cdddru-02
namespace: test-app
labels:
app: cdddru-02
release: v1.0.25
spec:
selector:
matchLabels:
app: cdddru-02
template:
metadata:
labels:
app: cdddru-02
spec:
containers:
# docker_in_docker container
- name: dind
image: docker:dind
command:
[
"/bin/sh",
"-c",
"dockerd --tls=false --insecure-registry=registry.srv.local:5000 -H tcp://0.0.0.0:2375",
]
resources:
requests:
cpu: 500m
memory: 512Mi
limits:
cpu: 950m
memory: 950Mi
volumeMounts:
- name: dockerconfig
mountPath: /root/.docker
readOnly: true
- name: dind-storage
mountPath: /var/lib/docker
ports:
- containerPort: 2375
securityContext:
runAsUser: 0
runAsGroup: 0
privileged: true
# container with cdddru binary
- name: cdddru
image: kuznetcovay/cdddru:v1.0.25
resources:
requests:
cpu: 250m
memory: 256Mi
limits:
cpu: 950m
memory: 950Mi
command:
- "sh"
- "-c"
- |
/bin/sh /usr/local/bin/docker-entrypoint.sh || true ;
/app/cdddru /app/nfs-store/jobs/config-main-ddru.yaml /app/nfs-store/jobs/config-main-ddru-assets.yaml -v;
imagePullPolicy: Always
volumeMounts:
- name: dockerconfig
mountPath: /run/configs/dockerconfig
- name: gitcred
mountPath: /run/configs/gitcred
- name: kubeconfig
mountPath: /run/configs/kubeconfig
# volume from nfs server to sync main-site data
- name: main-site-data
mountPath: /app/nfs-store/main-site
subPath: main-site
# volume from nfs server to store jobs files
- name: nfs-pvc-cdddru
mountPath: /app/nfs-store/jobs
subPath: cdddru-jobs
securityContext:
runAsUser: 0
runAsGroup: 0
env:
- name: DOCKER_HOST
value: tcp://localhost:2375
- name: DOCKER_PASSWORD
valueFrom:
secretKeyRef:
name: dockerhub-token
key: token
- name: DOCKER_USER
valueFrom:
secretKeyRef:
name: dockerhub-token
key: username
- name: DOCKER_SERVER
valueFrom:
secretKeyRef:
name: dockerhub-token
key: server
- name: GIT_CRED
valueFrom:
secretKeyRef:
name: gitcred
key: id_rsa
- name: KUBE_CONFIG
valueFrom:
secretKeyRef:
name: kubeconfig
key: config
nodeSelector:
# kubernetes.io/hostname: opiz3-1
kubernetes.io/hostname: n150-netbook
volumes:
- name: dockerconfig
secret:
secretName: dockerhub-cred
- name: kubeconfig
secret:
secretName: kubeconfig
- name: gitcred
secret:
secretName: gitcred
- name: dind-storage
hostPath:
path: /tmp/dind/storage
type: DirectoryOrCreate
- name: main-site-data
persistentVolumeClaim:
claimName: nfs-pvc-main-site
- name: nfs-pvc-cdddru
persistentVolumeClaim:
claimName: nfs-pvc-cdddru
# endregion