Skip to content
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

Refactor renderTemplate calls in flyte-binary chart #3156

Merged
merged 1 commit into from
Dec 15, 2022
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
11 changes: 0 additions & 11 deletions charts/flyte-binary/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,6 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{/*
Renders a value that contains template.
*/}}
{{- define "flyte-binary.renderTemplate" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}

{{/*
Get the Flyte configuration ConfigMap name.
*/}}
Expand Down
4 changes: 2 additions & 2 deletions charts/flyte-binary/templates/admin-auth-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ metadata:
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "flyte-binary.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonLabels | toYaml ) . | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
type: Opaque
{{- end }}
4 changes: 2 additions & 2 deletions charts/flyte-binary/templates/auth-client-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ metadata:
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "flyte-binary.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonLabels | toYaml ) . | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
type: Opaque
stringData:
Expand Down
8 changes: 4 additions & 4 deletions charts/flyte-binary/templates/cluster-resource-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ metadata:
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "flyte-binary.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonLabels | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.clusterResourceTemplates.labels }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.clusterResourceTemplates.labels "context" $ ) | nindent 4 }}
{{- tpl ( .Values.clusterResourceTemplates.labels | toYaml ) . | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.clusterResourceTemplates.annotations }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.clusterResourceTemplates.annotations "context" $) | nindent 4 }}
{{- tpl ( .Values.clusterResourceTemplates.annotations | toYaml ) . | nindent 4 }}
{{- end }}
data:
{{- if .Values.clusterResourceTemplates.inline }}
Expand Down
8 changes: 4 additions & 4 deletions charts/flyte-binary/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ metadata:
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "flyte-binary.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonLabels | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.rbac.labels }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.rbac.labels "context" $) | nindent 4 }}
{{- tpl ( .Values.rbac.labels | toYaml ) . | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.rbac.annotations }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.rbac.annotations "context" $) | nindent 4 }}
{{- tpl ( .Values.rbac.annotations | toYaml ) . | nindent 4 }}
{{- end }}
rules:
- apiGroups:
Expand Down
8 changes: 4 additions & 4 deletions charts/flyte-binary/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ metadata:
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "flyte-binary.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonLabels | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.rbac.labels }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.rbac.labels "context" $) | nindent 4 }}
{{- tpl ( .Values.rbac.labels | toYaml ) . | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.rbac.annotations }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.rbac.annotations "context" $) | nindent 4 }}
{{- tpl ( .Values.rbac.annotations | toYaml ) . | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
14 changes: 7 additions & 7 deletions charts/flyte-binary/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ metadata:
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "flyte-binary.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonLabels | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.configuration.labels }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.configuration.labels "context" $) | nindent 4 }}
{{- tpl ( .Values.configuration.labels | toYaml ) . | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.configuration.annotations }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.configuration.annotations "context" $) | nindent 4 }}
{{- tpl ( .Values.configuration.annotations | toYaml ) . | nindent 4 }}
{{- end }}
data:
000-core.yaml: |
Expand Down Expand Up @@ -83,7 +83,7 @@ data:
region: {{ required "Region required for S3 storage provider" .region }}
disable-ssl: {{ .disableSSL }}
{{- if .endpoint }}
endpoint: {{ include "flyte-binary.renderTemplate" ( dict "value" .endpoint "context" $ ) }}
endpoint: {{ tpl .endpoint $ }}
{{- end }}
{{- if eq "iam" .authType }}
auth-type: "iam"
Expand Down Expand Up @@ -167,7 +167,7 @@ data:
- all
authorizedUris:
{{- if .Values.ingress.host }}
- https://{{ include "flyte-binary.renderTemplate" ( dict "value" .Values.ingress.host "context" $ ) }}
- https://{{ tpl .Values.ingress.host . }}
{{- end }}
- http://{{ include "flyte-binary.fullname" . }}:{{ include "flyte-binary.service.httpPort" . }}
- http://{{ include "flyte-binary.fullname" . }}.{{ .Release.Namespace }}:{{ include "flyte-binary.service.httpPort" . }}
Expand All @@ -186,7 +186,7 @@ data:
{{- end }}
{{- if .Values.configuration.inline }}
010-inline-config.yaml: |
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.configuration.inline "context" $ ) | nindent 4 }}
{{- tpl ( .Values.configuration.inline | toYaml ) . | nindent 4 }}
{{- else if .Values.configuration.sourcePath }}
{{- (tpl (.Files.Glob .Values.configuration.sourcePath).AsConfig . ) | nindent 2 }}
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions charts/flyte-binary/templates/db-password-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ metadata:
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "flyte-binary.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonLabels | toYaml ) . | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
type: Opaque
stringData:
Expand Down
48 changes: 24 additions & 24 deletions charts/flyte-binary/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ metadata:
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "flyte-binary.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonLabels | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.deployment.labels }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.labels "context" $) | nindent 4 }}
{{- tpl ( .Values.deployment.labels | toYaml ) . | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.deployment.annotations }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.annotations "context" $) | nindent 4 }}
{{- tpl ( .Values.deployment.annotations | toYaml ) . | nindent 4 }}
{{- end }}
spec:
replicas: 1
Expand All @@ -27,10 +27,10 @@ spec:
metadata:
labels: {{- include "flyte-binary.selectorLabels" . | nindent 8 }}
{{- if .Values.commonLabels }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }}
{{- tpl ( .Values.commonLabels | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.deployment.podLabels }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.podLabels "context" $) | nindent 8 }}
{{- tpl ( .Values.deployment.podLabels | toYaml ) . | nindent 4 }}
{{- end }}
annotations:
{{- if not .Values.configuration.existingConfigmap }}
Expand All @@ -47,14 +47,14 @@ spec:
checksum/auth-client-secret: {{ include (print $.Template.BasePath "/auth-client-secret.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 8 }}
{{- tpl ( .Values.commonAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.deployment.podAnnotations }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.podAnnotations "context" $) | nindent 8 }}
{{- tpl ( .Values.deployment.podAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.deployment.extraPodSpec }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.extraPodSpec "context" $) | nindent 6 }}
{{- tpl ( .Values.deployment.extraPodSpec | toYaml ) . | nindent 6 }}
{{- end }}
{{- if .Values.deployment.podSecurityContext.enabled }}
securityContext: {{- omit .Values.deployment.podSecurityContext "enabled" | toYaml | nindent 12 }}
Expand All @@ -70,14 +70,14 @@ spec:
{{- end }}
command:
{{- if .Values.deployment.waitForDB.command }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.waitForDB.command "context" $) | nindent 12 }}
{{- tpl ( .Values.deployment.waitForDB.command | toYaml ) . | nindent 12 }}
{{- else }}
- sh
- -ec
{{- end }}
args:
{{- if .Values.deployment.waitForDB.args }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.waitForDB.args "context" $) | nindent 12 }}
{{- tpl ( .Values.deployment.waitForDB.args | toYaml ) . | nindent 12 }}
{{- else }}
{{- with .Values.configuration.database }}
- |
Expand All @@ -103,14 +103,14 @@ spec:
{{- end }}
command:
{{- if .Values.deployment.genAdminAuthSecret.command }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.genAdminAuthSecret.command "context" $) | nindent 12 }}
{{- tpl ( .Values.deployment.genAdminAuthSecret.command | toYaml ) . | nindent 12 }}
{{- else }}
- sh
- -ec
{{- end }}
args:
{{- if .Values.deployment.genAdminAuthSecret.args }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.genAdminAuthSecret.args "context" $) | nindent 12 }}
{{- tpl ( .Values.deployment.genAdminAuthSecret.args | toYaml ) . | nindent 12 }}
{{- else }}
- |
flyteadmin --config=/etc/flyte/config.d/*.yaml \
Expand All @@ -133,7 +133,7 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.deployment.initContainers }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.deployment.initContainers "context" $ ) | nindent 8 }}
{{- tpl ( .Values.deployment.initContainers | toYaml ) . | nindent 8 }}
{{- end }}
{{- end }}
containers:
Expand All @@ -143,11 +143,11 @@ spec:
imagePullPolicy: {{ .pullPolicy | quote }}
{{- end }}
{{- if .Values.deployment.command }}
command: {{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.command "context" $) | nindent 12 }}
command: {{- tpl ( .Values.deployment.command | toYaml ) . | nindent 12 }}
{{- end }}
args:
{{- if .Values.deployment.args }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.args "context" $) | nindent 12 }}
{{- tpl ( .Values.deployment.args | toYaml ) . | nindent 12 }}
{{- else }}
- start
- --config
Expand All @@ -163,7 +163,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.deployment.extraEnvVars }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.extraEnvVars "context" $) | nindent 12 }}
{{- tpl ( .Values.deployment.extraEnvVars | toYaml ) . | nindent 12 }}
{{- end }}
{{- if or .Values.deployment.extraEnvVarsConfigMap .Values.deployment.extraEnvVarsSecret }}
envFrom:
Expand All @@ -184,19 +184,19 @@ spec:
- name: webhook
containerPort: 9443
{{- if .Values.deployment.startupProbe }}
startupProbe: {{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.customStartupProbe "context" $) | nindent 12 }}
startupProbe: {{- tpl ( .Values.deployment.customStartupProbe | toYaml ) . | nindent 12 }}
{{- end }}
livenessProbe:
{{- if .Values.deployment.livenessProbe }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.livenessProbe "context" $) | nindent 12 }}
{{- tpl ( .Values.deployment.livenessProbe | toYaml ) . | nindent 12 }}
{{- else }}
httpGet:
path: /healthcheck
port: http
{{- end }}
readinessProbe:
{{- if .Values.deployment.readinessProbe }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.readinessProbe "context" $) | nindent 12 }}
{{- tpl ( .Values.deployment.readinessProbe | toYaml ) . | nindent 12 }}
{{- else }}
httpGet:
path: /healthcheck
Expand All @@ -206,7 +206,7 @@ spec:
resources: {{- toYaml .Values.deployment.resources | nindent 12 }}
{{- end }}
{{- if .Values.deployment.lifecycleHooks }}
lifecycle: {{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.lifecycleHooks "context" $) | nindent 12 }}
lifecycle: {{- tpl ( .Values.deployment.lifecycleHooks | toYaml ) . | nindent 12 }}
{{- end }}
volumeMounts:
{{- if .Values.configuration.auth.enabled }}
Expand All @@ -225,10 +225,10 @@ spec:
- name: state
mountPath: /var/run/flyte
{{- if .Values.deployment.extraVolumeMounts }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.deployment.extraVolumeMounts "context" $) | nindent 12 }}
{{- tpl ( .Values.deployment.extraVolumeMounts | toYaml ) . | nindent 12 }}
{{- end }}
{{- if .Values.deployment.sidecars }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.deployment.sidecars "context" $ ) | nindent 8 }}
{{- tpl ( .Values.deployment.sidecars | toYaml ) . | nindent 8 }}
{{- end }}
volumes:
{{- if .Values.configuration.auth.enabled }}
Expand All @@ -254,5 +254,5 @@ spec:
- name: state
emptyDir: {}
{{- if .Values.deployment.extraVolumes }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.deployment.extraVolumes "context" $ ) | nindent 8 }}
{{- tpl ( .Values.deployment.extraVolumes | toYaml ) . | nindent 8 }}
{{- end }}
12 changes: 6 additions & 6 deletions charts/flyte-binary/templates/ingress/grpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ metadata:
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "flyte-binary.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonLabels | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.ingress.labels }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.ingress.labels "context" $) | nindent 4 }}
{{- tpl ( .Values.ingress.labels | toYaml ) . | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "flyte-binary.renderTemplate" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- tpl ( .Values.commonAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.ingress.commonAnnotations }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.ingress.commonAnnotations "context" $) | nindent 4 }}
{{- tpl ( .Values.ingress.commonAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
{{- if .Values.ingress.grpcAnnotations }}
{{- include "flyte-binary.renderTemplate" (dict "value" .Values.ingress.grpcAnnotations "context" $) | nindent 4 }}
{{- tpl ( .Values.ingress.grpcAnnotations | toYaml ) . | nindent 4 }}
{{- end }}
spec:
rules:
Expand Down Expand Up @@ -96,6 +96,6 @@ spec:
path: /grpc.health.v1.Health/*
pathType: ImplementationSpecific
{{- if .Values.ingress.host }}
host: {{ include "flyte-binary.renderTemplate" ( dict "value" .Values.ingress.host "context" $ ) }}
host: {{ tpl .Values.ingress.host . | quote }}
{{- end }}
{{- end }}
Loading