Skip to content

Commit

Permalink
feat(kratos): support skaffold image format (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
Demonsthere committed Jun 29, 2021
1 parent 863cf58 commit c92de53
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
23 changes: 23 additions & 0 deletions helm/charts/kratos/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}

4 changes: 2 additions & 2 deletions helm/charts/kratos/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions helm/charts/kratos/templates/job-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions helm/charts/kratos/templates/statefulset-mail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions helm/charts/kratos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down

0 comments on commit c92de53

Please sign in to comment.