Skip to content

fix: predeploy cloudsql timeout #1458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
35 changes: 34 additions & 1 deletion applications/job/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,37 @@ For backwards compatibility, this concatenates targets from cloudsql.connectionN
{{- end -}}

{{- end }}
{{- end }}
{{- end }}

{{/*
Get image repository, using global if available
*/}}
{{- define "docker-template.getImageRepository" -}}
{{- if and .Values.global .Values.global.image -}}
{{- .Values.global.image.repository -}}
{{- else -}}
{{- .Values.image.repository -}}
{{- end -}}
{{- end -}}

{{/*
Get image tag, using global if available
*/}}
{{- define "docker-template.getImageTag" -}}
{{- if and .Values.global .Values.global.image -}}
{{- .Values.global.image.tag -}}
{{- else -}}
{{- .Values.image.tag -}}
{{- end -}}
{{- end -}}

{{/*
Get image pull secret, using global if available
*/}}
{{- define "docker-template.getImagePullSecret" -}}
{{- if and .Values.image .Values.image.imagePullSecret -}}
{{- .Values.image.imagePullSecret -}}
{{- else if and .Values.global .Values.global.image .Values.global.image.imagePullSecret -}}
{{- .Values.global.image.imagePullSecret -}}
{{- end -}}
{{- end -}}
37 changes: 6 additions & 31 deletions applications/job/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,40 +72,21 @@ spec:
{{ else }}
serviceAccountName: {{ include "docker-template.serviceAccountName" . }}
{{- end }}
{{- if and .Values.image .Values.image.imagePullSecret }}
{{- $pullSecret := include "docker-template.getImagePullSecret" . -}}
{{- if $pullSecret }}
imagePullSecrets:
- name: {{ .Values.image.imagePullSecret }}
{{- else if and .Values.global .Values.global.image .Values.global.image.imagePullSecret }}
imagePullSecrets:
- name: {{ .Values.global.image.imagePullSecret }}
- name: {{ $pullSecret }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- if .Values.global }}
{{- if .Values.global.image }}
image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.tag }}"
{{- end }}
{{- else }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- end }}
image: "{{ include "docker-template.getImageRepository" . }}:{{ include "docker-template.getImageTag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.global }}
{{- if .Values.global.image }}
{{- if and .Values.container.command (not (eq .Values.global.image.repository "public.ecr.aws/o1j4x7p4/hello-porter")) }}
{{- if and .Values.container.command (not (eq (include "docker-template.getImageRepository" .) "public.ecr.aws/o1j4x7p4/hello-porter")) }}
command:
{{- range $command := trim .Values.container.command | splitList " " }}
- {{ $command | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- else }}
{{- if (and .Values.container.command (not (or (eq .Values.image.repository "porterdev/hello-porter") (eq .Values.image.repository "public.ecr.aws/o1j4x7p4/hello-porter-job")))) }}
command:
{{- range $command := trim .Values.container.command | splitList " " }}
- {{ $command | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.container.args }}
args:
{{- range $arg := .Values.container.args }}
Expand All @@ -124,14 +105,8 @@ spec:
{{ end }}
{{ end }}
env:
{{- if .Values.global }}
{{- if .Values.global.image }}
{{- if .Values.global.image.tag }}
- name: PORTER_IMAGE_TAG
value: "{{ .Values.global.image.tag }}"
{{- end }}
{{- end }}
{{- end }}
value: "{{ include "docker-template.getImageTag" . }}"
{{- range $key, $val := .Values.container.env.normal }}
- name: {{ $key }}
{{- $splVal := split "_" $val -}}
Expand Down
Loading