From c92de532ce47b80661b12f250235780bd73b467d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20B=C5=82aszczyk?= Date: Tue, 29 Jun 2021 15:44:11 +0200 Subject: [PATCH] feat(kratos): support skaffold image format (#291) --- helm/charts/kratos/templates/_helpers.tpl | 23 +++++++++++++++++++ helm/charts/kratos/templates/deployment.yaml | 4 ++-- .../kratos/templates/job-migration.yaml | 4 ++-- .../kratos/templates/statefulset-mail.yaml | 4 ++-- helm/charts/kratos/values.yaml | 3 +++ 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/helm/charts/kratos/templates/_helpers.tpl b/helm/charts/kratos/templates/_helpers.tpl index 8826b1632..6da03375d 100644 --- a/helm/charts/kratos/templates/_helpers.tpl +++ b/helm/charts/kratos/templates/_helpers.tpl @@ -91,3 +91,26 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end -}} + +{{/* +Generate image +*/}} +{{- define "kratos.image" -}} +{{- if eq "string" ( typeOf .Values.image ) }} +{{- printf "%s" .Values.image -}} +{{- else -}} +{{- printf "%s:%s" .Values.image.repository .Values.image.tag -}} +{{- end -}} +{{- end -}} + +{{/* +Generate imagePullPolicy +*/}} +{{- define "kratos.imagePullPolicy" -}} +{{- if eq "string" ( typeOf .Values.image ) }} +{{- printf "%s" .Values.imagePullPolicy -}} +{{- else -}} +{{- printf "%s" .Values.image.pullPolicy -}} +{{- end -}} +{{- end -}} + diff --git a/helm/charts/kratos/templates/deployment.yaml b/helm/charts/kratos/templates/deployment.yaml index 61fedcfb8..8d4b5cd1a 100644 --- a/helm/charts/kratos/templates/deployment.yaml +++ b/helm/charts/kratos/templates/deployment.yaml @@ -63,8 +63,8 @@ spec: automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + image: {{ include "kratos.image" . }} + imagePullPolicy: {{ include "kratos.imagePullPolicy" . }} command: ["kratos"] args: [ "serve", diff --git a/helm/charts/kratos/templates/job-migration.yaml b/helm/charts/kratos/templates/job-migration.yaml index 98a2808ac..6619c88c5 100644 --- a/helm/charts/kratos/templates/job-migration.yaml +++ b/helm/charts/kratos/templates/job-migration.yaml @@ -27,8 +27,8 @@ spec: automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} containers: - name: {{ .Chart.Name }}-automigrate - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + image: {{ include "kratos.image" . }} + imagePullPolicy: {{ include "kratos.imagePullPolicy" . }} command: ["kratos"] args: ["migrate", "sql", "-e", "--yes"] env: diff --git a/helm/charts/kratos/templates/statefulset-mail.yaml b/helm/charts/kratos/templates/statefulset-mail.yaml index 662e0d14f..4f4529f33 100644 --- a/helm/charts/kratos/templates/statefulset-mail.yaml +++ b/helm/charts/kratos/templates/statefulset-mail.yaml @@ -30,8 +30,8 @@ spec: spec: containers: - name: {{ include "kratos.fullname" . }}-courier - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + image: {{ include "kratos.image" . }} + imagePullPolicy: {{ include "kratos.imagePullPolicy" . }} args: [ "courier", "watch", "--config", "/etc/config/kratos.yaml" ] volumeMounts: - name: {{ include "kratos.fullname" . }}-config-volume diff --git a/helm/charts/kratos/values.yaml b/helm/charts/kratos/values.yaml index cf77d7343..5b76b31fb 100644 --- a/helm/charts/kratos/values.yaml +++ b/helm/charts/kratos/values.yaml @@ -12,6 +12,9 @@ image: repository: oryd/kratos tag: v0.6.3-alpha.1 pullPolicy: IfNotPresent +# Alternative format +# image: oryd/kratos:v0.6.3-alpha.1 +# imagePullPolicy: Always imagePullSecrets: [] nameOverride: ""