-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-wine-separate-k8s-deployment.yaml
155 lines (155 loc) · 4.82 KB
/
docker-wine-separate-k8s-deployment.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
apiVersion: apps/v1
kind: Deployment
metadata:
name: "$Username-$brand-$product-$random-$i"
labels:
user: "$Username"
client: "$brand"
app: "$product"
id: "$random-$i"
spec:
replicas: 1
selector:
matchLabels:
user: "$Username"
client: "$brand"
app: "$product"
id: "$random-$i"
strategy:
type: Recreate
template:
metadata:
labels:
user: "$Username"
client: "$brand"
app: "$product"
id: "$random-$i"
spec:
securityContext:
fsGroup: 1010
containers:
- name: display
image: launchthatbrand/solarkennedy-wine-x11-novnc-docker:$display_release
securityContext:
runAsUser: 0
resources:
requests:
memory: "100Mi"
cpu: "100m"
env:
- name: USE_NOVNC
value: "$novnc"
- name: USER_PASSWD
value: "$Password"
- name: BRAND
value: "$brand"
- name: mt4
image: launchthatbrand/nevmerzhitsky-headless-metatrader4:$mt4_release
#command: [ "/bin/bash", "-c", "--" ]
#args: [ "while true; do sleep 30; done;" ]
# need poststart to copy files from DockerFile path into pvc path. cant run chmod here as it needs root.
#lifecycle:
# postStart:
# exec:
# command:
# - "/bin/sh"
# - "-c"
# - >
# if [ ! -f /home/winer/.wine/drive_c/mt4/terminal.exe ]; then
# mkdir -p /home/winer/.wine/drive_c/mt4;
# cp -R /home/winer/.cache/mt4_kot4x/* /home/winer/.wine/drive_c/mt4/;
# fi;
# if [ ! -f /home/winer/.wine/drive_c/windows/Fonts/wingding.ttf ]; then
# mkdir -p /home/winer/.wine/drive_c/windows/Fonts;
# cp -R /home/winer/.cache/fonts/* /home/winer/.wine/drive_c/windows/Fonts;
# fi;
# winetricks settings fontsmooth=rgb;
resources:
requests:
memory: "${REQ_MEM}Mi"
cpu: "${REQ_CPU}m"
limits:
memory: "${MEM}Mi"
cpu: "${CPU}m"
env:
- name: RDP_SERVER
value: "yes"
- name: USER_NAME
value: "$Usernam"
- name: USER_PASSWD
value: "$Password"
- name: SCREEN_WHD
value: "1600x900x24"
- name: BRAND
value: "$brand"
- name: PRODUCT
value: "$product"
- name: PRODUCT_VER
value: "$product_ver"
- name: PRODUCT_EXT
value: "$product_ext"
- name: EMAIL_ALERT_EA
value: "$email_alert_ea"
volumeMounts:
- name: "$Username-$brand-$product-$random-$i"
mountPath: /home/winer/.wine/
#- name: "$Username-gitsync"
# image: k8s.gcr.io/git-sync:v3.0.1
# resources:
# requests:
# memory: "50Mi"
# cpu: "50m"
# limits:
# memory: "100Mi"
# cpu: "100m"
# securityContext:
# runAsUser: 1000
# env:
# - name: GIT_SYNC_REPO
# value: https://github.com/launchthatbrand/mt4_filesystem.git
# - name: GIT_SYNC_BRANCH
# value: "$brand-$mt4"
# - name: GIT_SYNC_ROOT
# value: /home/winer/.wine/drive_c/
# - name: GIT_SYNC_DEST
# value: mt4
# - name: GIT_SYNC_ADD_USER
# value: 1000:1010
# - name: GIT_SYNC_PERMISSIONS
# value: 1000:1010
# - name: GIT_SYNC_WAIT
# value: "3600"
# #- name: GIT_SYNC_USERNAME
# # value: launchthatbrand
# #- name: GIT_SYNC_PASSWORD
# # value: 8S9me^fQ6c
# volumeMounts:
# - name: "$Username-$brand-$product-$random"
# mountPath: /home/winer/.wine/
initContainers:
# need init container to run chown command as root. Cant use postStart as then everything would need to run as root.
- name: init-busybox
image: busybox
command: ['sh', '-c', 'mkdir -p /home/winer/.wine/drive_c; chown -R 1000:1010 /home/winer/; echo The app is running!']
# command: ['sh', '-c', 'while true; do sleep 30; done;']
volumeMounts:
- name: "$Username-$brand-$product-$random-$i"
mountPath: /home/winer/.wine/
nodeSelector:
node.kubernetes.io/instance-type: $instancetype
node-pool: "$brand-mt4"
imagePullSecrets:
- name: regcred
volumes:
- name: "$Username-$brand-$product-$random-$i"
persistentVolumeClaim:
claimName: "$Username-$brand-$product-$random-$i"
tolerations:
- key: "client"
operator: "Equal"
value: $brand
effect: "NoSchedule"
- key: "app"
operator: "Equal"
value: "mt4"
effect: "NoSchedule"