Add template for image on Spark Chart

This commit is contained in:
miguelaeh
2019-07-02 11:37:42 +02:00
parent 47bc916aa8
commit 7a6535fc25
4 changed files with 27 additions and 3 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ apiVersion: v1
appVersion: 2.4.3
description: Spark is a fast and general-purpose cluster computing system.
name: spark
version: 0.0.1
version: 0.0.2
icon: https://bitnami.com/assets/stacks/spark/img/spark-stack-220x234-1ea65541e9e427ca5b93300e61d4778576c7f679ae02addb86a2641b0ca70476.png
home: https://spark.apache.org/
sources:
+24
View File
@@ -6,6 +6,30 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Spark image name
*/}}
{{- define "spark.image" -}}
{{- $registryName := .Values.image.registry -}}
{{- $repositoryName := .Values.image.repository -}}
{{- $tag := .Values.image.tag | toString -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
Also, we can't use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imageRegistry }}
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}
{{- /*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
@@ -44,7 +44,7 @@ spec:
{{- end }}
containers:
- name: spark-master
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
image: "{{ template "spark.image" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
@@ -44,7 +44,7 @@ spec:
{{- end }}
containers:
- name: spark-worker
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
image: "{{ template "spark.image" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http