Skip to content

Commit 46f1d32

Browse files
authored
Prepare chart for migration to OCI (#1821)
Signed-off-by: Sergio Castaño Arteaga <[email protected]>
1 parent b934bd5 commit 46f1d32

13 files changed

+117
-78
lines changed

chart/Chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: clomonitor
33
description: CLOMonitor is a tool that periodically checks open source projects repositories to verify they meet certain project health best practices
44
type: application
5-
version: 1.0.0
5+
version: 1.0.1-1
66
appVersion: 1.0.0
77
kubeVersion: ">= 1.19.0-0"
88
keywords:
@@ -15,6 +15,6 @@ maintainers:
1515
1616
dependencies:
1717
- name: postgresql
18-
version: 8.2.1
19-
repository: https://charts.helm.sh/stable
18+
version: 18.0.15
19+
repository: https://charts.bitnami.com/bitnami
2020
condition: postgresql.enabled

chart/templates/_helpers.tpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,13 @@ longest resource name ("dbmigrator-install" = 18 chars).
7979
Provide an init container to verify the database is accessible
8080
*/}}
8181
{{- define "chart.checkDbIsReadyInitContainer" -}}
82+
{{- $securityContext := default (dict) .Values.checkDbIsReadyInitContainer.securityContext }}
8283
name: check-db-ready
84+
{{ if .Values.postgresql.image.registry -}}
85+
image: {{ .Values.postgresql.image.registry }}/{{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}
86+
{{- else }}
8387
image: {{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}
88+
{{- end }}
8489
imagePullPolicy: {{ .Values.pullPolicy }}
8590
env:
8691
- name: PGHOST
@@ -89,5 +94,10 @@ env:
8994
value: "{{ .Values.db.port }}"
9095
- name: PGUSER
9196
value: "{{ .Values.db.user }}"
97+
{{- if $securityContext }}
98+
securityContext:{{- toYaml $securityContext | nindent 2 }}
99+
{{- else }}
100+
securityContext: {}
101+
{{- end }}
92102
command: ['sh', '-c', 'until pg_isready; do echo waiting for database; sleep 2; done;']
93103
{{- end -}}

chart/templates/apiserver_deployment.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ spec:
2121
app.kubernetes.io/component: apiserver
2222
{{- include "chart.selectorLabels" . | nindent 8 }}
2323
spec:
24+
{{- with .Values.apiserver.deploy.podSecurityContext }}
25+
securityContext:
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
2428
{{- with .Values.imagePullSecrets }}
2529
imagePullSecrets:
2630
{{- toYaml . | nindent 8 }}
@@ -36,12 +40,20 @@ spec:
3640
{{ $kubectlImageVersion := ternary "1.33" $kubeVersion (semverCompare ">=1.34.0-0" (printf "%s.0" $kubeVersion)) }}
3741
image: "docker.io/bitnamilegacy/kubectl:{{ $kubectlImageVersion }}"
3842
imagePullPolicy: IfNotPresent
43+
{{- with .Values.checkDbIsReadyInitContainer.securityContext }}
44+
securityContext:
45+
{{- toYaml . | nindent 12 }}
46+
{{- end }}
3947
command: ['kubectl', 'wait', '--namespace={{ .Release.Namespace }}', '--for=condition=complete', 'job/{{ include "chart.resourceNamePrefix" . }}dbmigrator-install', '--timeout=60s']
4048
{{- end }}
4149
containers:
4250
- name: apiserver
4351
image: {{ .Values.apiserver.deploy.image.repository }}:{{ .Values.imageTag | default (printf "v%s" .Chart.AppVersion) }}
4452
imagePullPolicy: {{ .Values.pullPolicy }}
53+
{{- with .Values.apiserver.deploy.containerSecurityContext }}
54+
securityContext:
55+
{{- toYaml . | nindent 12 }}
56+
{{- end }}
4557
volumeMounts:
4658
- name: apiserver-config
4759
mountPath: {{ .Values.configDir | quote }}

chart/templates/apiserver_ingress.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
service:
1616
name: {{ include "chart.resourceNamePrefix" . }}apiserver
1717
port:
18-
number: {{ .Values.apiserver.service.port }}
18+
number: {{ .Values.apiserver.ingress.backendServicePort }}
1919
{{- with .Values.apiserver.ingress.rules }}
2020
rules:
2121
{{- toYaml . | nindent 4 }}

chart/templates/apiserver_service.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ metadata:
55
labels:
66
app.kubernetes.io/component: apiserver
77
{{- include "chart.labels" . | nindent 4 }}
8+
{{- with .Values.apiserver.service.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
812
spec:
13+
allocateLoadBalancerNodePorts: {{ .Values.apiserver.service.allocateLoadBalancerNodePorts }}
914
type: {{ .Values.apiserver.service.type }}
1015
ports:
11-
- port: {{ .Values.apiserver.service.port }}
12-
targetPort: http
13-
protocol: TCP
14-
name: http
16+
{{- toYaml .Values.apiserver.service.ports | nindent 4 }}
1517
selector:
1618
app.kubernetes.io/component: apiserver
1719
{{- include "chart.selectorLabels" . | nindent 4 }}

chart/templates/archiver_cronjob.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ spec:
1515
spec:
1616
template:
1717
spec:
18+
{{- with .Values.archiver.cronjob.podSecurityContext }}
19+
securityContext:
20+
{{- toYaml . | nindent 12 }}
21+
{{- end }}
1822
{{- with .Values.imagePullSecrets }}
1923
imagePullSecrets:
2024
{{- toYaml . | nindent 12 }}
@@ -26,6 +30,10 @@ spec:
2630
- name: archiver
2731
image: {{ .Values.archiver.cronjob.image.repository }}:{{ .Values.imageTag | default (printf "v%s" .Chart.AppVersion) }}
2832
imagePullPolicy: {{ .Values.pullPolicy }}
33+
{{- with .Values.archiver.cronjob.containerSecurityContext }}
34+
securityContext:
35+
{{- toYaml . | nindent 16 }}
36+
{{- end }}
2937
resources:
3038
{{- toYaml .Values.archiver.cronjob.resources | nindent 16 }}
3139
volumeMounts:

chart/templates/dbmigrator_job.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ metadata:
1313
spec:
1414
template:
1515
spec:
16+
{{- with .Values.dbmigrator.job.podSecurityContext }}
17+
securityContext:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
1620
{{- with .Values.imagePullSecrets }}
1721
imagePullSecrets:
1822
{{- toYaml . | nindent 8 }}
@@ -24,6 +28,10 @@ spec:
2428
- name: dbmigrator
2529
image: {{ .Values.dbmigrator.job.image.repository }}:{{ .Values.imageTag | default (printf "v%s" .Chart.AppVersion) }}
2630
imagePullPolicy: {{ .Values.pullPolicy }}
31+
{{- with .Values.dbmigrator.job.containerSecurityContext }}
32+
securityContext:
33+
{{- toYaml . | nindent 12 }}
34+
{{- end }}
2735
env:
2836
- name: TERN_CONF
2937
value: {{ .Values.configDir }}/tern.conf

chart/templates/dbmigrator_secret.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ stringData:
1111
database = {{ .Values.db.dbname }}
1212
user = {{ .Values.db.user }}
1313
password = {{ .Values.db.password }}
14+
sslmode = prefer

chart/templates/notifier_cronjob.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ spec:
1616
spec:
1717
template:
1818
spec:
19+
{{- with .Values.notifier.cronjob.podSecurityContext }}
20+
securityContext:
21+
{{- toYaml . | nindent 12 }}
22+
{{- end }}
1923
{{- with .Values.imagePullSecrets }}
2024
imagePullSecrets:
2125
{{- toYaml . | nindent 12 }}
@@ -27,6 +31,10 @@ spec:
2731
- name: notifier
2832
image: {{ .Values.notifier.cronjob.image.repository }}:{{ .Values.imageTag | default (printf "v%s" .Chart.AppVersion) }}
2933
imagePullPolicy: {{ .Values.pullPolicy }}
34+
{{- with .Values.notifier.cronjob.containerSecurityContext }}
35+
securityContext:
36+
{{- toYaml . | nindent 16 }}
37+
{{- end }}
3038
resources:
3139
{{- toYaml .Values.notifier.cronjob.resources | nindent 16 }}
3240
volumeMounts:

chart/templates/registrar_cronjob.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ spec:
1515
spec:
1616
template:
1717
spec:
18+
{{- with .Values.registrar.cronjob.podSecurityContext }}
19+
securityContext:
20+
{{- toYaml . | nindent 12 }}
21+
{{- end }}
1822
{{- with .Values.imagePullSecrets }}
1923
imagePullSecrets:
2024
{{- toYaml . | nindent 12 }}
@@ -26,6 +30,10 @@ spec:
2630
- name: registrar
2731
image: {{ .Values.registrar.cronjob.image.repository }}:{{ .Values.imageTag | default (printf "v%s" .Chart.AppVersion) }}
2832
imagePullPolicy: {{ .Values.pullPolicy }}
33+
{{- with .Values.registrar.cronjob.containerSecurityContext }}
34+
securityContext:
35+
{{- toYaml . | nindent 16 }}
36+
{{- end }}
2937
resources:
3038
{{- toYaml .Values.registrar.cronjob.resources | nindent 16 }}
3139
volumeMounts:

0 commit comments

Comments
 (0)