Skip to content

Commit c867d6f

Browse files
committed
ci: helm values + deployment files for all 5 services (wip)
1 parent ff228a5 commit c867d6f

15 files changed

Lines changed: 943 additions & 138 deletions

helm/templates/_helpers.tpl

Lines changed: 122 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,91 @@ If release name contains chart name it will be used as a full name.
2323
{{- end }}
2424
{{- end }}
2525

26+
{{/*
27+
Create a fully qualified datatracker name.
28+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
29+
*/}}
30+
{{- define "datatracker.datatracker.fullname" -}}
31+
{{- if .Values.datatracker.fullnameOverride -}}
32+
{{- .Values.datatracker.fullnameOverride | trunc 63 | trimSuffix "-" -}}
33+
{{- else -}}
34+
{{- $name := default .Chart.Name .Values.nameOverride -}}
35+
{{- if contains $name .Release.Name -}}
36+
{{- printf "%s-%s" .Release.Name .Values.datatracker.name | trunc 63 | trimSuffix "-" -}}
37+
{{- else -}}
38+
{{- printf "%s-%s-%s" .Release.Name $name .Values.datatracker.name | trunc 63 | trimSuffix "-" -}}
39+
{{- end -}}
40+
{{- end -}}
41+
{{- end -}}
42+
43+
{{/*
44+
Create a fully qualified celery name.
45+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
46+
*/}}
47+
{{- define "datatracker.celery.fullname" -}}
48+
{{- if .Values.celery.fullnameOverride -}}
49+
{{- .Values.celery.fullnameOverride | trunc 63 | trimSuffix "-" -}}
50+
{{- else -}}
51+
{{- $name := default .Chart.Name .Values.nameOverride -}}
52+
{{- if contains $name .Release.Name -}}
53+
{{- printf "%s-%s" .Release.Name .Values.celery.name | trunc 63 | trimSuffix "-" -}}
54+
{{- else -}}
55+
{{- printf "%s-%s-%s" .Release.Name $name .Values.celery.name | trunc 63 | trimSuffix "-" -}}
56+
{{- end -}}
57+
{{- end -}}
58+
{{- end -}}
59+
60+
{{/*
61+
Create a fully qualified celery name.
62+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
63+
*/}}
64+
{{- define "datatracker.beat.fullname" -}}
65+
{{- if .Values.beat.fullnameOverride -}}
66+
{{- .Values.beat.fullnameOverride | trunc 63 | trimSuffix "-" -}}
67+
{{- else -}}
68+
{{- $name := default .Chart.Name .Values.nameOverride -}}
69+
{{- if contains $name .Release.Name -}}
70+
{{- printf "%s-%s" .Release.Name .Values.beat.name | trunc 63 | trimSuffix "-" -}}
71+
{{- else -}}
72+
{{- printf "%s-%s-%s" .Release.Name $name .Values.beat.name | trunc 63 | trimSuffix "-" -}}
73+
{{- end -}}
74+
{{- end -}}
75+
{{- end -}}
76+
77+
{{/*
78+
Create a fully qualified rabbitmq name.
79+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
80+
*/}}
81+
{{- define "datatracker.rabbitmq.fullname" -}}
82+
{{- if .Values.rabbitmq.fullnameOverride -}}
83+
{{- .Values.rabbitmq.fullnameOverride | trunc 63 | trimSuffix "-" -}}
84+
{{- else -}}
85+
{{- $name := default .Chart.Name .Values.nameOverride -}}
86+
{{- if contains $name .Release.Name -}}
87+
{{- printf "%s-%s" .Release.Name .Values.rabbitmq.name | trunc 63 | trimSuffix "-" -}}
88+
{{- else -}}
89+
{{- printf "%s-%s-%s" .Release.Name $name .Values.rabbitmq.name | trunc 63 | trimSuffix "-" -}}
90+
{{- end -}}
91+
{{- end -}}
92+
{{- end -}}
93+
94+
{{/*
95+
Create a fully qualified memcached name.
96+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
97+
*/}}
98+
{{- define "datatracker.memcached.fullname" -}}
99+
{{- if .Values.memcached.fullnameOverride -}}
100+
{{- .Values.memcached.fullnameOverride | trunc 63 | trimSuffix "-" -}}
101+
{{- else -}}
102+
{{- $name := default .Chart.Name .Values.nameOverride -}}
103+
{{- if contains $name .Release.Name -}}
104+
{{- printf "%s-%s" .Release.Name .Values.memcached.name | trunc 63 | trimSuffix "-" -}}
105+
{{- else -}}
106+
{{- printf "%s-%s-%s" .Release.Name $name .Values.memcached.name | trunc 63 | trimSuffix "-" -}}
107+
{{- end -}}
108+
{{- end -}}
109+
{{- end -}}
110+
26111
{{/*
27112
Create chart name and version as used by the chart label.
28113
*/}}
@@ -53,10 +138,42 @@ app.kubernetes.io/instance: {{ .Release.Name }}
53138
{{/*
54139
Create the name of the service account to use
55140
*/}}
56-
{{- define "datatracker.serviceAccountName" -}}
57-
{{- if .Values.serviceAccount.create }}
58-
{{- default (include "datatracker.fullname" .) .Values.serviceAccount.name }}
59-
{{- else }}
60-
{{- default "default" .Values.serviceAccount.name }}
141+
{{- define "datatracker.serviceAccountName.datatracker" -}}
142+
{{- if .Values.serviceAccounts.datatracker.create -}}
143+
{{ default (include "datatracker.datatracker.fullname" .) .Values.serviceAccounts.datatracker.name }}
144+
{{- else -}}
145+
{{ default "default" .Values.serviceAccounts.datatracker.name }}
146+
{{- end -}}
61147
{{- end }}
148+
149+
{{- define "datatracker.serviceAccountName.celery" -}}
150+
{{- if .Values.serviceAccounts.celery.create -}}
151+
{{ default (include "datatracker.celery.fullname" .) .Values.serviceAccounts.celery.name }}
152+
{{- else -}}
153+
{{ default "default" .Values.serviceAccounts.celery.name }}
154+
{{- end -}}
155+
{{- end }}
156+
157+
{{- define "datatracker.serviceAccountName.beat" -}}
158+
{{- if .Values.serviceAccounts.beat.create -}}
159+
{{ default (include "datatracker.beat.fullname" .) .Values.serviceAccounts.beat.name }}
160+
{{- else -}}
161+
{{ default "default" .Values.serviceAccounts.beat.name }}
162+
{{- end -}}
163+
{{- end }}
164+
165+
{{- define "datatracker.serviceAccountName.rabbitmq" -}}
166+
{{- if .Values.serviceAccounts.rabbitmq.create -}}
167+
{{ default (include "datatracker.rabbitmq.fullname" .) .Values.serviceAccounts.rabbitmq.name }}
168+
{{- else -}}
169+
{{ default "default" .Values.serviceAccounts.rabbitmq.name }}
170+
{{- end -}}
171+
{{- end }}
172+
173+
{{- define "datatracker.serviceAccountName.memcached" -}}
174+
{{- if .Values.serviceAccounts.memcached.create -}}
175+
{{ default (include "datatracker.memcached.fullname" .) .Values.serviceAccounts.memcached.name }}
176+
{{- else -}}
177+
{{ default "default" .Values.serviceAccounts.memcached.name }}
178+
{{- end -}}
62179
{{- end }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ spec:
2929
image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}"
3030
imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
3131
env:
32+
CONTAINER_ROLE: beat
3233
{{- if .Values.env }}
3334
{{- toYaml .Values.env | nindent 12 }}
3435
{{- end }}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "datatracker.fullname" . }}
5+
labels:
6+
{{- include "datatracker.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
10+
selector:
11+
matchLabels:
12+
{{- include "datatracker.selectorLabels" . | nindent 6 }}
13+
template:
14+
metadata:
15+
labels:
16+
{{- include "datatracker.selectorLabels" . | nindent 8 }}
17+
spec:
18+
{{- with .Values.imagePullSecrets }}
19+
imagePullSecrets:
20+
{{- toYaml . | nindent 8 }}
21+
{{- end }}
22+
serviceAccountName: {{ include "datatracker.serviceAccountName" . }}
23+
securityContext:
24+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
25+
containers:
26+
- name: {{ .Chart.Name }}
27+
securityContext:
28+
{{- toYaml .Values.securityContext | nindent 12 }}
29+
image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}"
30+
imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
31+
env:
32+
CONTAINER_ROLE: celery
33+
{{- if .Values.env }}
34+
{{- toYaml .Values.env | nindent 12 }}
35+
{{- end }}
36+
{{- with .Values.volumeMounts }}
37+
volumeMounts:
38+
{{- toYaml . | nindent 12 }}
39+
{{- end }}
40+
ports:
41+
- name: http
42+
containerPort: 8000
43+
protocol: TCP
44+
livenessProbe:
45+
{{- toYaml .Values.livenessProbe | nindent 12 }}
46+
readinessProbe:
47+
{{- toYaml .Values.readinessProbe | nindent 12 }}
48+
startupProbe:
49+
{{- toYaml .Values.startupProbe | nindent 12 }}
50+
resources:
51+
{{- toYaml .Values.resources | nindent 12 }}
52+
{{- with .Values.nodeSelector }}
53+
nodeSelector:
54+
{{- toYaml . | nindent 8 }}
55+
{{- end }}
56+
{{- with .Values.affinity }}
57+
affinity:
58+
{{- toYaml . | nindent 8 }}
59+
{{- end }}
60+
{{- with .Values.tolerations }}
61+
tolerations:
62+
{{- toYaml . | nindent 8 }}
63+
{{- end }}
64+
{{- with .Values.volumes }}
65+
volumes:
66+
{{- toYaml . | nindent 8 }}
67+
{{- end }}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "datatracker.fullname" . }}
5+
labels:
6+
{{- include "datatracker.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
10+
selector:
11+
matchLabels:
12+
{{- include "datatracker.selectorLabels" . | nindent 6 }}
13+
template:
14+
metadata:
15+
labels:
16+
{{- include "datatracker.selectorLabels" . | nindent 8 }}
17+
spec:
18+
{{- with .Values.imagePullSecrets }}
19+
imagePullSecrets:
20+
{{- toYaml . | nindent 8 }}
21+
{{- end }}
22+
serviceAccountName: {{ include "datatracker.serviceAccountName" . }}
23+
securityContext:
24+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
25+
containers:
26+
- name: {{ .Chart.Name }}
27+
securityContext:
28+
{{- toYaml .Values.securityContext | nindent 12 }}
29+
image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}"
30+
imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
31+
env:
32+
CONTAINER_ROLE: datatracker
33+
{{- if .Values.env }}
34+
{{- toYaml .Values.env | nindent 12 }}
35+
{{- end }}
36+
{{- with .Values.volumeMounts }}
37+
volumeMounts:
38+
{{- toYaml . | nindent 12 }}
39+
{{- end }}
40+
ports:
41+
- name: http
42+
containerPort: 8000
43+
protocol: TCP
44+
livenessProbe:
45+
{{- toYaml .Values.livenessProbe | nindent 12 }}
46+
readinessProbe:
47+
{{- toYaml .Values.readinessProbe | nindent 12 }}
48+
startupProbe:
49+
{{- toYaml .Values.startupProbe | nindent 12 }}
50+
resources:
51+
{{- toYaml .Values.resources | nindent 12 }}
52+
{{- with .Values.nodeSelector }}
53+
nodeSelector:
54+
{{- toYaml . | nindent 8 }}
55+
{{- end }}
56+
{{- with .Values.affinity }}
57+
affinity:
58+
{{- toYaml . | nindent 8 }}
59+
{{- end }}
60+
{{- with .Values.tolerations }}
61+
tolerations:
62+
{{- toYaml . | nindent 8 }}
63+
{{- end }}
64+
{{- with .Values.volumes }}
65+
volumes:
66+
{{- toYaml . | nindent 8 }}
67+
{{- end }}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "datatracker.fullname" . }}
5+
labels:
6+
{{- include "datatracker.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
10+
selector:
11+
matchLabels:
12+
{{- include "datatracker.selectorLabels" . | nindent 6 }}
13+
template:
14+
metadata:
15+
labels:
16+
{{- include "datatracker.selectorLabels" . | nindent 8 }}
17+
spec:
18+
{{- with .Values.imagePullSecrets }}
19+
imagePullSecrets:
20+
{{- toYaml . | nindent 8 }}
21+
{{- end }}
22+
serviceAccountName: {{ include "datatracker.serviceAccountName" . }}
23+
securityContext:
24+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
25+
containers:
26+
- name: {{ .Chart.Name }}
27+
securityContext:
28+
{{- toYaml .Values.securityContext | nindent 12 }}
29+
image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}"
30+
imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
31+
env:
32+
CONTAINER_ROLE: beat
33+
{{- if .Values.env }}
34+
{{- toYaml .Values.env | nindent 12 }}
35+
{{- end }}
36+
{{- with .Values.volumeMounts }}
37+
volumeMounts:
38+
{{- toYaml . | nindent 12 }}
39+
{{- end }}
40+
ports:
41+
- name: http
42+
containerPort: 8000
43+
protocol: TCP
44+
livenessProbe:
45+
{{- toYaml .Values.livenessProbe | nindent 12 }}
46+
readinessProbe:
47+
{{- toYaml .Values.readinessProbe | nindent 12 }}
48+
startupProbe:
49+
{{- toYaml .Values.startupProbe | nindent 12 }}
50+
resources:
51+
{{- toYaml .Values.resources | nindent 12 }}
52+
{{- with .Values.nodeSelector }}
53+
nodeSelector:
54+
{{- toYaml . | nindent 8 }}
55+
{{- end }}
56+
{{- with .Values.affinity }}
57+
affinity:
58+
{{- toYaml . | nindent 8 }}
59+
{{- end }}
60+
{{- with .Values.tolerations }}
61+
tolerations:
62+
{{- toYaml . | nindent 8 }}
63+
{{- end }}
64+
{{- with .Values.volumes }}
65+
volumes:
66+
{{- toYaml . | nindent 8 }}
67+
{{- end }}

0 commit comments

Comments
 (0)