From 53757c5e50c5fa495ccad9685578d26339f6c709 Mon Sep 17 00:00:00 2001 From: alexis Date: Tue, 9 Mar 2021 10:18:43 +0100 Subject: [PATCH 1/4] ajout de lookup --- charts/jupyter/templates/_helpers.tpl | 20 ++++++++++++++++++++ charts/jupyter/templates/configmap-hive.yaml | 11 +++++++++++ charts/jupyter/values.yaml | 5 ++++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 charts/jupyter/templates/configmap-hive.yaml diff --git a/charts/jupyter/templates/_helpers.tpl b/charts/jupyter/templates/_helpers.tpl index 47fa17fa..a0608e3e 100644 --- a/charts/jupyter/templates/_helpers.tpl +++ b/charts/jupyter/templates/_helpers.tpl @@ -110,4 +110,24 @@ ingress annotations {{- if .Values.security.whitelist.enable }} nginx.ingress.kubernetes.io/whitelist-source-range: {{ .Values.security.whitelist.ip }} {{- end }} +{{- end }} + + +{{- define "hiveMestastore.configmap" -}} +{{ printf "" }} +{{ printf "" }} +{{ printf ""}} +{{- $virgule := 0 }} +{{ range $index, $service := (lookup "v1" "Service" .Release.Namespace "").items }} +{{- if hasPrefix "hive-mestastore" (index $service "metadata" "labels" "helm.sh/chart") }} +{{- if $virgule }} +{{- end }} +{{ printf ""}} +{{ printf "metastore.thrift.uris" | indent 4}} +{{ printf "thrift://\"%s\":9083" $service.metadata.name | indent 4}} +{{ printf ""}} +{{- $virgule = 1}} +{{ printf ""}} +{{- end }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/charts/jupyter/templates/configmap-hive.yaml b/charts/jupyter/templates/configmap-hive.yaml new file mode 100644 index 00000000..07d3eb82 --- /dev/null +++ b/charts/jupyter/templates/configmap-hive.yaml @@ -0,0 +1,11 @@ +{{- if contains "thrift" (include "hiveMestastore.configmap" .) }} +apiVersion: v1 +kind: ConfigMap +metadata: +# name: {{- printf "%s-configmaphive" (include "jupyter.fullname" .) }} + labels: + {{- include "jupyter.labels" . | nindent 4 }} +data: + hive-site.xml: | + {{- include "hiveMestastore.configmap" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/charts/jupyter/values.yaml b/charts/jupyter/values.yaml index 6b39bbe3..90bc9dd3 100644 --- a/charts/jupyter/values.yaml +++ b/charts/jupyter/values.yaml @@ -68,6 +68,9 @@ git: email: "" cache: "" +hive: + configMapName: "" + # This is a YAML-formatted file. # Declare variables to be passed into your templates. replicaCount: 1 @@ -159,4 +162,4 @@ nodeSelector: {} tolerations: [] -affinity: {} +affinity: {} \ No newline at end of file From 9e8cb1362955f3d518af9f9388e04df6742b0444 Mon Sep 17 00:00:00 2001 From: alexis Date: Tue, 9 Mar 2021 11:21:06 +0100 Subject: [PATCH 2/4] correction --- charts/jupyter/templates/_helpers.tpl | 2 +- charts/jupyter/templates/configmap-hive.yaml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/jupyter/templates/_helpers.tpl b/charts/jupyter/templates/_helpers.tpl index a0608e3e..d6f30a5b 100644 --- a/charts/jupyter/templates/_helpers.tpl +++ b/charts/jupyter/templates/_helpers.tpl @@ -119,7 +119,7 @@ nginx.ingress.kubernetes.io/whitelist-source-range: {{ .Values.security.whitelis {{ printf ""}} {{- $virgule := 0 }} {{ range $index, $service := (lookup "v1" "Service" .Release.Namespace "").items }} -{{- if hasPrefix "hive-mestastore" (index $service "metadata" "labels" "helm.sh/chart") }} +{{- if hasPrefix "hive-metastore" (index $service "metadata" "labels" "helm.sh/chart") }} {{- if $virgule }} {{- end }} {{ printf ""}} diff --git a/charts/jupyter/templates/configmap-hive.yaml b/charts/jupyter/templates/configmap-hive.yaml index 07d3eb82..31730e4b 100644 --- a/charts/jupyter/templates/configmap-hive.yaml +++ b/charts/jupyter/templates/configmap-hive.yaml @@ -1,11 +1,11 @@ -{{- if contains "thrift" (include "hiveMestastore.configmap" .) }} +{{- if contains "thrift" (include "hiveMetastore.configmap" .) }} apiVersion: v1 kind: ConfigMap metadata: -# name: {{- printf "%s-configmaphive" (include "jupyter.fullname" .) }} + name: {{- printf "%s-configmaphive" (include "jupyter.fullname" .) }} labels: {{- include "jupyter.labels" . | nindent 4 }} data: hive-site.xml: | - {{- include "hiveMestastore.configmap" . | nindent 4 }} + {{- include "hiveMetastore.configmap" . | nindent 4 }} {{- end }} \ No newline at end of file From 53afbf9ad2616c2fd4a7485776d910db4a090899 Mon Sep 17 00:00:00 2001 From: alexisdondon Date: Wed, 10 Mar 2021 07:17:10 +0000 Subject: [PATCH 3/4] ajout du discovery --- charts/jupyter/templates/_helpers.tpl | 16 ++++++++++++++-- charts/jupyter/templates/configmap-hive.yaml | 4 ++-- charts/jupyter/values.yaml | 4 ++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/charts/jupyter/templates/_helpers.tpl b/charts/jupyter/templates/_helpers.tpl index d6f30a5b..26940fa6 100644 --- a/charts/jupyter/templates/_helpers.tpl +++ b/charts/jupyter/templates/_helpers.tpl @@ -113,7 +113,7 @@ nginx.ingress.kubernetes.io/whitelist-source-range: {{ .Values.security.whitelis {{- end }} -{{- define "hiveMestastore.configmap" -}} +{{- define "hiveMetastore.configmap" -}} {{ printf "" }} {{ printf "" }} {{ printf ""}} @@ -124,10 +124,22 @@ nginx.ingress.kubernetes.io/whitelist-source-range: {{ .Values.security.whitelis {{- end }} {{ printf ""}} {{ printf "metastore.thrift.uris" | indent 4}} -{{ printf "thrift://\"%s\":9083" $service.metadata.name | indent 4}} +{{ printf "thrift://%s:9083" $service.metadata.name | indent 4}} {{ printf ""}} {{- $virgule = 1}} +{{- end }} +{{- end }} {{ printf ""}} {{- end }} + +{{/* +Create the name of the config map hive to use +*/}} +{{- define "jupyter.configMapNameHive" -}} +{{- if .Values.discovery.hive }} +{{- $name:= (printf "%s-configmaphive" (include "jupyter.fullname" .) ) }} +{{- default $name .Values.hive.configMapName }} +{{- else }} +{{- default "default" .Values.hive.configMapName }} {{- end }} {{- end }} \ No newline at end of file diff --git a/charts/jupyter/templates/configmap-hive.yaml b/charts/jupyter/templates/configmap-hive.yaml index 31730e4b..9b1adf2d 100644 --- a/charts/jupyter/templates/configmap-hive.yaml +++ b/charts/jupyter/templates/configmap-hive.yaml @@ -1,8 +1,8 @@ -{{- if contains "thrift" (include "hiveMetastore.configmap" .) }} +{{- if .Values.discovery.hive -}} apiVersion: v1 kind: ConfigMap metadata: - name: {{- printf "%s-configmaphive" (include "jupyter.fullname" .) }} + name: {{ include "jupyter.configMapNameHive" . }} labels: {{- include "jupyter.labels" . | nindent 4 }} data: diff --git a/charts/jupyter/values.yaml b/charts/jupyter/values.yaml index 90bc9dd3..2b5e64ad 100644 --- a/charts/jupyter/values.yaml +++ b/charts/jupyter/values.yaml @@ -67,6 +67,10 @@ git: name: "" email: "" cache: "" +#active ou non la recherche d'un hiveMetastore dans le namespace +# see configmap-hive.yaml et helpers template +discovery: + hive: true hive: configMapName: "" From 220a11f91a4b076b0d3729c222437ed3ada1e7ae Mon Sep 17 00:00:00 2001 From: alexisdondon Date: Wed, 10 Mar 2021 07:27:32 +0000 Subject: [PATCH 4/4] version 0.3.0 --- charts/jupyter/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/jupyter/Chart.yaml b/charts/jupyter/Chart.yaml index 43daa1a0..4e2e491b 100644 --- a/charts/jupyter/Chart.yaml +++ b/charts/jupyter/Chart.yaml @@ -16,7 +16,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.17 +version: 0.3.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to