From 47d34ad270950e3efb0dac91bfc71f3e7ae0063b Mon Sep 17 00:00:00 2001 From: phlg <76954542+phlg@users.noreply.github.com> Date: Thu, 26 Jan 2023 10:44:01 +0100 Subject: [PATCH] library-chart : add CM for ivysettings.xml (#50) --- charts/library-chart/Chart.yaml | 2 +- charts/library-chart/templates/_configmap.tpl | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/charts/library-chart/Chart.yaml b/charts/library-chart/Chart.yaml index 7befc57..9ed1e44 100644 --- a/charts/library-chart/Chart.yaml +++ b/charts/library-chart/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v2 name: library-chart -version: 1.3.5 +version: 1.3.6 type: library diff --git a/charts/library-chart/templates/_configmap.tpl b/charts/library-chart/templates/_configmap.tpl index e09533d..f4f5e10 100644 --- a/charts/library-chart/templates/_configmap.tpl +++ b/charts/library-chart/templates/_configmap.tpl @@ -269,6 +269,44 @@ metadata: data: spark-defaults.conf: | {{- include "library-chart.sparkConf" . | nindent 4 }} + {{- if .Values.repository.mavenRepository -}} + {{ printf "spark.jars.ivySettings /opt/spark/conf/ivysettings.xml" }} + {{- end }} +{{- end }} +{{- end }} + + + +{{/* ConfigMap for Ivy Settings (custom maven repository for Spark) */}} +{{- define "library-chart.ivySettings" -}} +{{ printf "<ivysettings>" }} +{{ printf "<settings defaultResolver=\"custom_maven_repository\"/>" | indent 4 }} +{{ printf "<resolvers>" | indent 4 }} +{{ printf "<ibiblio name=\"custom_maven_repository\" m2compatible=\"true\" root=\"%s\"/>" .Values.repository.mavenRepository | indent 8 }} +{{ printf "</resolvers>" | indent 4 }} +{{ printf "</ivysettings>" }} +{{- end -}} + +{{/* Create the name of the config map Ivy Settings to use */}} +{{- define "library-chart.configMapNameIvySettings" -}} +{{- if and (.Values.spark.default) (.Values.repository.mavenRepository) }} +{{- $name:= (printf "%s-configmapivysettings" (include "library-chart.fullname" .) ) }} +{{- $name }} +{{- end }} +{{- end }} + +{{/* Template to generate a ConfigMap for Ivy Settings */}} +{{- define "library-chart.configMapIvySettings" -}} +{{- if and (.Values.spark.default) (.Values.repository.mavenRepository) }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "library-chart.configMapNameIvySettings" . }} + labels: + {{- include "library-chart.labels" . | nindent 4 }} +data: + ivysettings.xml: | + {{- include "library-chart.ivySettings" . | nindent 4 }} {{- end }} {{- end }} -- GitLab