Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion helm/defectdojo/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ dependencies:
condition: redis.enabled
annotations:
artifacthub.io/prerelease: "true"
artifacthub.io/changes: ""
artifacthub.io/changes: |
- kind: changed
description: DRY cloudsql-proxy
37 changes: 37 additions & 0 deletions helm/defectdojo/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,43 @@
{{- end }}
{{- end -}}

{{- /*
Define cloudsql-proxy
*/}}
{{- define "cloudsqlProxy" -}}
- name: cloudsql-proxy
image: {{ .Values.cloudsql.image.repository }}:{{ .Values.cloudsql.image.tag }}
imagePullPolicy: {{ .Values.cloudsql.image.pullPolicy }}
{{- with .Values.cloudsql.extraEnv }}
env: {{- . | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.cloudsql.resources }}
resources: {{- . | toYaml | nindent 4 }}
{{- end }}
restartPolicy: Always
{{- if .Values.securityContext.enabled }}
securityContext:
{{- include "helpers.securityContext" (list
.Values
"securityContext.containerSecurityContext"
"cloudsql.containerSecurityContext"
) | nindent 4 }}
{{- end }}
command: ["/cloud_sql_proxy"]
args:
- "-verbose={{ .Values.cloudsql.verbose }}"
- "-instances={{ .Values.cloudsql.instance }}=tcp:{{ .Values.postgresql.primary.service.ports.postgresql }}"
{{- if .Values.cloudsql.enable_iam_login }}
- "-enable_iam_login"
{{- end }}
{{- if .Values.cloudsql.use_private_ip }}
- "-ip_address_types=PRIVATE"
{{- end }}
{{- with .Values.cloudsql.extraVolumeMounts }}
volumeMounts: {{ . | toYaml | nindent 4 }}
{{- end }}
{{- end -}}

{{- /*
Returns the JSON representation of the value for a dot-notation path
from a given context.
Expand Down
26 changes: 1 addition & 25 deletions helm/defectdojo/templates/celery-beat-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,31 +87,7 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.cloudsql.enabled }}
- name: cloudsql-proxy
image: {{ .Values.cloudsql.image.repository }}:{{ .Values.cloudsql.image.tag }}
imagePullPolicy: {{ .Values.cloudsql.image.pullPolicy }}
{{- with .Values.cloudsql.resources }}
resources: {{- . | toYaml | nindent 10 }}
{{- end }}
restartPolicy: Always
{{- if .Values.securityContext.enabled }}
securityContext:
{{- include "helpers.securityContext" (list
.Values
"securityContext.containerSecurityContext"
"cloudsql.containerSecurityContext"
) | nindent 10 }}
{{- end }}
command: ["/cloud_sql_proxy"]
args:
- "-verbose={{ .Values.cloudsql.verbose }}"
- "-instances={{ .Values.cloudsql.instance }}=tcp:{{ .Values.postgresql.primary.service.ports.postgresql }}"
{{- if .Values.cloudsql.enable_iam_login }}
- "-enable_iam_login"
{{- end }}
{{- if .Values.cloudsql.use_private_ip }}
- "-ip_address_types=PRIVATE"
{{- end }}
{{- include "cloudsqlProxy" . | nindent 6 }}
{{- end }}
{{- if .Values.dbMigrationChecker.enabled }}
{{$data := dict "fullName" $fullName }}
Expand Down
26 changes: 1 addition & 25 deletions helm/defectdojo/templates/celery-worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,7 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.cloudsql.enabled }}
- name: cloudsql-proxy
image: {{ .Values.cloudsql.image.repository }}:{{ .Values.cloudsql.image.tag }}
imagePullPolicy: {{ .Values.cloudsql.image.pullPolicy }}
{{- with .Values.cloudsql.resources }}
resources: {{- . | toYaml | nindent 10 }}
{{- end }}
restartPolicy: Always
{{- if .Values.securityContext.enabled }}
securityContext:
{{- include "helpers.securityContext" (list
.Values
"securityContext.containerSecurityContext"
"cloudsql.containerSecurityContext"
) | nindent 10 }}
{{- end }}
command: ["/cloud_sql_proxy"]
args:
- "-verbose={{ .Values.cloudsql.verbose }}"
- "-instances={{ .Values.cloudsql.instance }}=tcp:{{ .Values.postgresql.primary.service.ports.postgresql }}"
{{- if .Values.cloudsql.enable_iam_login }}
- "-enable_iam_login"
{{- end }}
{{- if .Values.cloudsql.use_private_ip }}
- "-ip_address_types=PRIVATE"
{{- end }}
{{- include "cloudsqlProxy" . | nindent 6 }}
{{- end }}
{{- if .Values.dbMigrationChecker.enabled }}
{{$data := dict "fullName" $fullName }}
Expand Down
32 changes: 1 addition & 31 deletions helm/defectdojo/templates/django-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,37 +104,7 @@ spec:
- {{- . | toYaml | nindent 8 }}
{{- end }}
{{- if .Values.cloudsql.enabled }}
- name: cloudsql-proxy
image: {{ .Values.cloudsql.image.repository }}:{{ .Values.cloudsql.image.tag }}
imagePullPolicy: {{ .Values.cloudsql.image.pullPolicy }}
{{- with .Values.cloudsql.extraEnv }}
env: {{- . | toYaml | nindent 8 }}
{{- end }}
{{- with .Values.cloudsql.resources }}
resources: {{- . | toYaml | nindent 10 }}
{{- end }}
restartPolicy: Always
{{- if .Values.securityContext.enabled }}
securityContext:
{{- include "helpers.securityContext" (list
.Values
"securityContext.containerSecurityContext"
"cloudsql.containerSecurityContext"
) | nindent 10 }}
{{- end }}
command: ["/cloud_sql_proxy"]
args:
- "-verbose={{ .Values.cloudsql.verbose }}"
- "-instances={{ .Values.cloudsql.instance }}=tcp:{{ .Values.postgresql.primary.service.ports.postgresql }}"
{{- if .Values.cloudsql.enable_iam_login }}
- "-enable_iam_login"
{{- end }}
{{- if .Values.cloudsql.use_private_ip }}
- "-ip_address_types=PRIVATE"
{{- end }}
{{- with .Values.cloudsql.extraVolumeMounts }}
volumeMounts: {{ . | toYaml | nindent 10 }}
{{- end }}
{{- include "cloudsqlProxy" . | nindent 6 }}
{{- end }}
{{- if .Values.dbMigrationChecker.enabled }}
{{- $data := dict "fullName" $fullName }}
Expand Down
33 changes: 1 addition & 32 deletions helm/defectdojo/templates/initializer-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,38 +74,7 @@ spec:
{{- end }}
initContainers:
{{- if .Values.cloudsql.enabled }}
- name: cloudsql-proxy
image: {{ .Values.cloudsql.image.repository }}:{{ .Values.cloudsql.image.tag }}
imagePullPolicy: {{ .Values.cloudsql.image.pullPolicy }}
{{- with .Values.cloudsql.resources }}
resources: {{- . | toYaml | nindent 10 }}
{{- end }}
restartPolicy: Always
{{- if .Values.securityContext.enabled }}
securityContext:
{{- include "helpers.securityContext" (list
.Values
"securityContext.containerSecurityContext"
"cloudsql.containerSecurityContext"
) | nindent 10 }}
{{- end }}
command: ["/cloud_sql_proxy"]
args:
- "-verbose={{ .Values.cloudsql.verbose }}"
- "-instances={{ .Values.cloudsql.instance }}=tcp:{{ .Values.postgresql.primary.service.ports.postgresql }}"
{{- if .Values.cloudsql.enable_iam_login }}
- "-enable_iam_login"
{{- end }}
{{- if .Values.cloudsql.use_private_ip }}
- "-ip_address_types=PRIVATE"
{{- end }}
volumeMounts:
{{- range .Values.initializer.extraVolumes }}
- name: userconfig-{{ .name }}
readOnly: true
mountPath: {{ .path }}
subPath: {{ .subPath }}
{{- end }}
{{- include "cloudsqlProxy" . | nindent 6 }}
{{- end }}
- name: wait-for-db
command:
Expand Down