Skip to content

Commit 2cfad6d

Browse files
committed
ops: Creating Chart. Initialize chart. AddDeployments
1 parent 8eed5e0 commit 2cfad6d

File tree

4 files changed

+276
-0
lines changed

4 files changed

+276
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "medcat-trainer-helm.fullname" . }}-medcat-trainer-config
5+
labels:
6+
{{- include "medcat-trainer-helm.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: medcat-trainer
8+
data:
9+
# This is mounted in the path for MEDCAT_CONFIG_FILE in the backend. Default to /home/configs/base.txt
10+
medcat-base.txt: |
11+
{{ .Values.medcatConfig | indent 4 }}
12+
supervisord.conf: |
13+
[supervisord]
14+
nodaemon=true
15+
user=root
16+
logfile=/var/log/supervisord.log
17+
pidfile=/var/run/supervisord.pid
18+
19+
[program:medcattrainer]
20+
command=sh -c "exec /home/scripts/run.sh 2>&1 | sed 's/^/[medcattrainer] /'"
21+
stdout_logfile=/dev/stdout
22+
stdout_logfile_maxbytes=0
23+
stderr_logfile=/dev/stderr
24+
stderr_logfile_maxbytes=0
25+
autorestart=true
26+
27+
[program:bg-process]
28+
command=sh -c "exec /home/scripts/run-bg-process.sh 2>&1 | sed 's/^/[bg-process] /'"
29+
stdout_logfile=/dev/stdout
30+
stdout_logfile_maxbytes=0
31+
stderr_logfile=/dev/stderr
32+
stderr_logfile_maxbytes=0
33+
autorestart=true
34+
35+
[program:db-backup]
36+
command=sh -c "exec cron -f -l 2 2>&1 | sed 's/^/[db-backup] /'"
37+
stdout_logfile=/dev/stdout
38+
stdout_logfile_maxbytes=0
39+
stderr_logfile=/dev/stderr
40+
stderr_logfile_maxbytes=0
41+
autorestart=true
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "medcat-trainer-helm.fullname" . }}-medcat-trainer
5+
labels:
6+
{{- include "medcat-trainer-helm.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: medcat-trainer
8+
spec:
9+
{{- if not .Values.autoscaling.enabled }}
10+
replicas: {{ .Values.replicaCount }}
11+
{{- end }}
12+
selector:
13+
matchLabels:
14+
{{- include "medcat-trainer-helm.selectorLabels" . | nindent 6 }}
15+
app.kubernetes.io/component: medcat-trainer
16+
template:
17+
metadata:
18+
{{- with .Values.podAnnotations }}
19+
annotations:
20+
{{- toYaml . | nindent 8 }}
21+
{{- end }}
22+
labels:
23+
{{- include "medcat-trainer-helm.labels" . | nindent 8 }}
24+
app.kubernetes.io/component: medcat-trainer
25+
{{- with .Values.podLabels }}
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
spec:
29+
{{- with .Values.imagePullSecrets }}
30+
imagePullSecrets:
31+
{{- toYaml . | nindent 8 }}
32+
{{- end }}
33+
serviceAccountName: {{ include "medcat-trainer-helm.serviceAccountName" . }}
34+
{{- with .Values.podSecurityContext }}
35+
securityContext:
36+
{{- toYaml . | nindent 8 }}
37+
{{- end }}
38+
containers:
39+
- name: {{ .Chart.Name }}
40+
{{- with .Values.securityContext }}
41+
securityContext:
42+
{{- toYaml . | nindent 12 }}
43+
{{- end }}
44+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
45+
imagePullPolicy: {{ .Values.image.pullPolicy }}
46+
ports:
47+
- name: http
48+
containerPort: 8000
49+
protocol: TCP
50+
args:
51+
- /usr/bin/supervisord
52+
- -c
53+
- /etc/supervisord.conf
54+
envFrom:
55+
- configMapRef:
56+
name: {{ include "medcat-trainer-helm.fullname" . }}-medcat-trainer-env
57+
{{- with .Values.livenessProbe }}
58+
livenessProbe:
59+
{{- toYaml . | nindent 12 }}
60+
{{- end }}
61+
{{- with .Values.readinessProbe }}
62+
readinessProbe:
63+
{{- toYaml . | nindent 12 }}
64+
{{- end }}
65+
{{- with .Values.resources }}
66+
resources:
67+
{{- toYaml . | nindent 12 }}
68+
{{- end }}
69+
volumeMounts:
70+
- mountPath: /home/api/media
71+
name: api-media
72+
- mountPath: /home/api/static
73+
name: api-static
74+
- mountPath: /home/api/db
75+
name: api-db
76+
- mountPath: /home/api/db-backup
77+
name: api-db-backup
78+
- mountPath: /home/configs
79+
name: medcat-trainer-config
80+
subPath: medcat-base.txt
81+
- mountPath: /etc/supervisord.conf
82+
name: medcat-trainer-config
83+
subPath: supervisord.conf
84+
{{- with .Values.volumeMounts }}
85+
{{- toYaml . | nindent 12 }}
86+
{{- end }}
87+
volumes:
88+
- name: medcat-trainer-config
89+
configMap:
90+
name: {{ include "medcat-trainer-helm.fullname" . }}-medcat-trainer-config
91+
- name: api-media
92+
persistentVolumeClaim:
93+
claimName: {{ include "medcat-trainer-helm.fullname" . }}-api-media
94+
- name: api-static
95+
persistentVolumeClaim:
96+
claimName: {{ include "medcat-trainer-helm.fullname" . }}-api-static
97+
- name: api-db
98+
persistentVolumeClaim:
99+
claimName: {{ include "medcat-trainer-helm.fullname" . }}-api-db
100+
- name: api-db-backup
101+
persistentVolumeClaim:
102+
claimName: {{ include "medcat-trainer-helm.fullname" . }}-api-db-backup
103+
{{- with .Values.volumes }}
104+
{{- toYaml . | nindent 8 }}
105+
{{- end }}
106+
{{- with .Values.nodeSelector }}
107+
nodeSelector:
108+
{{- toYaml . | nindent 8 }}
109+
{{- end }}
110+
{{- with .Values.affinity }}
111+
affinity:
112+
{{- toYaml . | nindent 8 }}
113+
{{- end }}
114+
{{- with .Values.tolerations }}
115+
tolerations:
116+
{{- toYaml . | nindent 8 }}
117+
{{- end }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "medcat-trainer-helm.fullname" . }}-medcat-trainer-env
5+
labels:
6+
{{- include "medcat-trainer-helm.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: medcat-trainer
8+
data:
9+
CONCEPT_SEARCH_SERVICE_HOST: {{ include "medcat-trainer-helm.solrHost" . | quote }}
10+
CONCEPT_SEARCH_SERVICE_PORT: {{ include "medcat-trainer-helm.solrPort" . | quote }}
11+
MEDCAT_CONFIG_FILE: "/home/configs/base.txt"
12+
DB_BACKUP_DIR: "/home/api/db-backup"
13+
DB_DIR: "/home/api/db"
14+
DB_PATH: "/home/api/db/db.sqlite3"
15+
{{- range $key, $value := .Values.env }}
16+
{{ $key }}: {{ $value | quote }}
17+
{{- end }}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "medcat-trainer-helm.fullname" . }}-nginx
5+
labels:
6+
{{- include "medcat-trainer-helm.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: nginx
8+
spec:
9+
{{- if not .Values.autoscaling.enabled }}
10+
replicas: {{ .Values.replicaCount }}
11+
{{- end }}
12+
selector:
13+
matchLabels:
14+
{{- include "medcat-trainer-helm.selectorLabels" . | nindent 6 }}
15+
app.kubernetes.io/component: nginx
16+
template:
17+
metadata:
18+
{{- with .Values.podAnnotations }}
19+
annotations:
20+
{{- toYaml . | nindent 8 }}
21+
{{- end }}
22+
labels:
23+
{{- include "medcat-trainer-helm.labels" . | nindent 8 }}
24+
app.kubernetes.io/component: nginx
25+
{{- with .Values.podLabels }}
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
spec:
29+
{{- with .Values.imagePullSecrets }}
30+
imagePullSecrets:
31+
{{- toYaml . | nindent 8 }}
32+
{{- end }}
33+
serviceAccountName: {{ include "medcat-trainer-helm.serviceAccountName" . }}
34+
{{- with .Values.podSecurityContext }}
35+
securityContext:
36+
{{- toYaml . | nindent 8 }}
37+
{{- end }}
38+
containers:
39+
- name: {{ .Chart.Name }}
40+
{{- with .Values.securityContext }}
41+
securityContext:
42+
{{- toYaml . | nindent 12 }}
43+
{{- end }}
44+
image: "{{ .Values.nginxImage.repository }}:{{ .Values.nginxImage.tag }}"
45+
imagePullPolicy: {{ .Values.nginxImage.pullPolicy }}
46+
ports:
47+
- name: http
48+
containerPort: {{ .Values.service.port }}
49+
protocol: TCP
50+
{{- with .Values.livenessProbe }}
51+
livenessProbe:
52+
{{- toYaml . | nindent 12 }}
53+
{{- end }}
54+
{{- with .Values.readinessProbe }}
55+
readinessProbe:
56+
{{- toYaml . | nindent 12 }}
57+
{{- end }}
58+
{{- with .Values.resources }}
59+
resources:
60+
{{- toYaml . | nindent 12 }}
61+
{{- end }}
62+
63+
volumeMounts:
64+
- name: nginx-config
65+
mountPath: /etc/nginx/nginx.conf
66+
subPath: nginx.conf
67+
- name: nginx-config
68+
mountPath: /etc/nginx/sites-enabled/medcattrainer
69+
subPath: sitesenabled.medcattrainer
70+
- mountPath: /home/api/media
71+
name: api-media
72+
- mountPath: /home/api/static
73+
name: api-static
74+
{{- with .Values.volumeMounts }}
75+
{{- toYaml . | nindent 12 }}
76+
{{- end }}
77+
volumes:
78+
- name: nginx-config
79+
configMap:
80+
name: {{ include "medcat-trainer-helm.fullname" . }}-nginx-config
81+
- name: api-media
82+
persistentVolumeClaim:
83+
claimName: {{ include "medcat-trainer-helm.fullname" . }}-api-media
84+
- name: api-static
85+
persistentVolumeClaim:
86+
claimName: {{ include "medcat-trainer-helm.fullname" . }}-api-static
87+
{{- with .Values.volumes }}
88+
{{- toYaml . | nindent 8 }}
89+
{{- end }}
90+
{{- with .Values.nodeSelector }}
91+
nodeSelector:
92+
{{- toYaml . | nindent 8 }}
93+
{{- end }}
94+
{{- with .Values.affinity }}
95+
affinity:
96+
{{- toYaml . | nindent 8 }}
97+
{{- end }}
98+
{{- with .Values.tolerations }}
99+
tolerations:
100+
{{- toYaml . | nindent 8 }}
101+
{{- end }}

0 commit comments

Comments
 (0)