Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #26 from alexisdondon/lookup-jupyter
Browse files Browse the repository at this point in the history
Lookup jupyter
  • Loading branch information
fcomte authored Mar 10, 2021
2 parents 6bbb4f0 + 220a11f commit 6a74e2e
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/jupyter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions charts/jupyter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,36 @@ ingress annotations
{{- if .Values.security.whitelist.enable }}
nginx.ingress.kubernetes.io/whitelist-source-range: {{ .Values.security.whitelist.ip }}
{{- end }}
{{- end }}


{{- define "hiveMetastore.configmap" -}}
{{ printf "<?xml version=\"1.0\"?>" }}
{{ printf "<?xml-stylesheet type=\"text/xsl\" href=\"configuration.xsl\"?>" }}
{{ printf "<configuration>"}}
{{- $virgule := 0 }}
{{ range $index, $service := (lookup "v1" "Service" .Release.Namespace "").items }}
{{- if hasPrefix "hive-metastore" (index $service "metadata" "labels" "helm.sh/chart") }}
{{- if $virgule }}
{{- end }}
{{ printf "<property>"}}
{{ printf "<name>metastore.thrift.uris</name>" | indent 4}}
{{ printf "<value>thrift://%s:9083</value>" $service.metadata.name | indent 4}}
{{ printf "</property>"}}
{{- $virgule = 1}}
{{- end }}
{{- end }}
{{ printf "</configuration>"}}
{{- 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 }}
11 changes: 11 additions & 0 deletions charts/jupyter/templates/configmap-hive.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.discovery.hive -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "jupyter.configMapNameHive" . }}
labels:
{{- include "jupyter.labels" . | nindent 4 }}
data:
hive-site.xml: |
{{- include "hiveMetastore.configmap" . | nindent 4 }}
{{- end }}
9 changes: 8 additions & 1 deletion charts/jupyter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ 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: ""

# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
Expand Down Expand Up @@ -159,4 +166,4 @@ nodeSelector: {}

tolerations: []

affinity: {}
affinity: {}

0 comments on commit 6a74e2e

Please sign in to comment.