File tree 11 files changed +148
-30
lines changed
11 files changed +148
-30
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ sources:
13
13
- https://github.com/apache/hive
14
14
- https://github.com/gradiant/charts
15
15
- https://github.com/big-data-europe/docker-hive
16
- version : 0.1.1
16
+ version : 0.1.2
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <?xml-stylesheet type =" text/xsl" href =" configuration.xsl" ?>
3
+ <configuration >
4
+ {{- range $key, $value := index .Values.conf "coreSite" }}
5
+ <property ><name >{{ $key }}</name ><value >{{ $value }}</value ></property >
6
+ {{- end }}
7
+ </configuration >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <?xml-stylesheet type =" text/xsl" href =" configuration.xsl" ?>
3
+ <configuration >
4
+ {{- range $key, $value := index .Values.conf "hdfsSite" }}
5
+ <property ><name >{{ $key }}</name ><value >{{ $value }}</value ></property >
6
+ {{- end }}
7
+
8
+ </configuration >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <?xml-stylesheet type =" text/xsl" href =" configuration.xsl" ?>
3
+ <configuration >
4
+ {{- if not (index .Values.conf "hiveSite" "hive.metastore.uris") }}
5
+ <property >
6
+ <name >hive.metastore.uris</name >
7
+ <value >{{- printf "thrift://%s-metastore" .Release.Name }}:9083</value >
8
+ </property >
9
+ {{- end }}
10
+ {{- if index .Values.conf "hiveSite" }}
11
+ {{- range $key, $value := index .Values.conf "hiveSite" }}
12
+ <property ><name >{{ $key }}</name ><value >{{ $value }}</value ></property >
13
+ {{- end }}
14
+ {{- end }}
15
+ </configuration >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <?xml-stylesheet type =" text/xsl" href =" configuration.xsl" ?>
3
+ <configuration >
4
+ {{- range $key, $value := index .Values.conf "mapredSite" }}
5
+ <property ><name >{{ $key }}</name ><value >{{ $value }}</value ></property >
6
+ {{- end }}
7
+ </configuration >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <?xml-stylesheet type =" text/xsl" href =" configuration.xsl" ?>
3
+ <configuration >
4
+ {{- range $key, $value := index .Values.conf "yarnSite" }}
5
+ <property ><name >{{ $key }}</name ><value >{{ $value }}</value ></property >
6
+ {{- end }}
7
+ </configuration >
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ : ${HADOOP_PREFIX:=/ usr/ local/ hadoop}
4
+
5
+ . $HADOOP_PREFIX /etc/hadoop/hadoop-env.sh
6
+
7
+ # Directory to find config artifacts
8
+ CONFIG_DIR=" /tmp/hadoop-config"
9
+
10
+ set -x
11
+
12
+ # Copy config files from volume mount
13
+ for f in slaves core-site.xml hdfs-site.xml mapred-site.xml yarn-site.xml; do
14
+ if [[ -e ${CONFIG_DIR} /$f ]]; then
15
+ cp ${CONFIG_DIR} /$f $HADOOP_HOME /etc/hadoop/$f
16
+ else
17
+ echo " ERROR: Could not find $f in $CONFIG_DIR "
18
+ exit 1
19
+ fi
20
+ done
21
+
22
+ # Note. This script set hive paths in hdfs with user hive and ensures hiveServer is runAsUser hive
23
+
24
+ HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -mkdir /tmp
25
+ HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -mkdir -p /user/hive/warehouse
26
+ HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -chmod g+w /tmp
27
+ HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -chmod g+w /user/hive/warehouse
28
+ HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -chown hive:hive /tmp
29
+ HADOOP_USER_NAME={{ .Values.conf.hdfsAdminUser }} hdfs dfs -chown hive:hive /user/hive/warehouse
30
+
31
+
32
+ if id -u hive ; then
33
+ echo " hive user exists" ;
34
+ else
35
+ echo " Creating hive user" ;
36
+ groupadd -g 500 -r hive && \
37
+ useradd --comment " Hive user" -u 500 --shell /bin/bash -M -r -g hive hive
38
+ fi
39
+
40
+ if [[ whoami != hive ]]
41
+ then
42
+ echo " Switching to hive user" ;
43
+ su hive -c " cd $HIVE_HOME /bin; ./hiveserver2 --hiveconf hive.server2.enable.doAs=false"
44
+ else
45
+ cd $HIVE_HOME /bin; ./hiveserver2 --hiveconf hive.server2.enable.doAs=false
46
+ fi
Original file line number Diff line number Diff line change
1
+ {{- if .Values.conf.hadoopSite }}
2
+ apiVersion : v1
3
+ kind : ConfigMap
4
+ metadata :
5
+ name : {{ include "hive.fullname" . }}-hadoop
6
+ labels :
7
+ app.kubernetes.io/name : {{ include "hive.name" . }}
8
+ {{- include "hive.labels" . | nindent 4 }}
9
+ data :
10
+ # TODO check if we need to include all this files for hive
11
+ core-site.xml : |-
12
+ {{ tpl (.Files.Get "resources/config/core-site.xml") . | indent 4 }}
13
+ hdfs-site.xml : |-
14
+ {{ tpl (.Files.Get "resources/config/hdfs-site.xml") . | indent 4 }}
15
+ mapred-site.xml : |-
16
+ {{ tpl (.Files.Get "resources/config/mapred-site.xml") . | indent 4 }}
17
+ yarn-site.xml : |-
18
+ {{ tpl (.Files.Get "resources/config/yarn-site.xml") . | indent 4 }}
19
+ {{- end }}
Original file line number Diff line number Diff line change @@ -6,19 +6,7 @@ metadata:
6
6
app.kubernetes.io/name : {{ include "hive.name" . }}
7
7
{{- include "hive.labels" . | nindent 4 }}
8
8
data :
9
+ startup.sh : |-
10
+ {{ tpl (.Files.Get "resources/startup.sh") . | indent 4 }}
9
11
hive-site.xml : |
10
- <?xml version="1.0"?>
11
- <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
12
- <configuration>
13
- {{- if not (index .Values.conf "hiveSite" "hive.metastore.uris") }}
14
- <property>
15
- <name>hive.metastore.uris</name>
16
- <value>{{- printf "thrift://%s-metastore" .Release.Name }}:9083</value>
17
- </property>
18
- {{- end }}
19
- {{- if index .Values.conf "hiveSite" }}
20
- {{- range $key, $value := index .Values.conf "hiveSite" }}
21
- <property><name>{{ $key }}</name><value>{{ $value }}</value></property>
22
- {{- end }}
23
- {{- end }}
24
- </configuration>
12
+ {{ tpl (.Files.Get "resources/config/hive-site.xml") . | indent 4 }}
Original file line number Diff line number Diff line change @@ -25,16 +25,11 @@ spec:
25
25
- name : server
26
26
image : " {{ .Values.image.repository }}:{{ .Values.image.tag }}"
27
27
imagePullPolicy : {{ .Values.image.pullPolicy | quote }}
28
+ command :
29
+ - /bin/bash
30
+ - /opt/hive/conf/startup.sh
28
31
resources :
29
32
{{ toYaml .Values.resources | indent 10 }}
30
- env :
31
- # TODO change this to use hadoop Configmap instead of env variables
32
- - name : CORE_CONF_fs_defaultFS
33
- {{- if not (index .Values.conf "coreSite" "fs.defaultFS") }}
34
- value : hdfs://{{.Release.Name}}-hdfs-namenode:8020
35
- {{- else }}
36
- value : {{ index .Values.conf "coreSite" "fs.defaultFS" }}
37
- {{- end }}
38
33
readinessProbe :
39
34
httpGet :
40
35
path : /
50
45
volumeMounts :
51
46
- name : hive-config
52
47
mountPath : /opt/hive/conf
48
+ - name : hadoop-config
49
+ mountPath : /tmp/hadoop-config
53
50
volumes :
51
+ - name : hadoop-config
52
+ configMap :
53
+ {{- if .Values.conf.hadoopSite }}
54
+ name : {{ include "hive.fullname" . }}-hadoop
55
+ {{- else }}
56
+ {{- if .Values.conf.hadoopConfigMap }}
57
+ name : {{ .Values.conf.hadoopConfigMap }}
58
+ {{- else }}
59
+ name : {{ .Release.Name }}-hdfs-hadoop
60
+ {{- end }}
61
+ {{- end }}
54
62
- name : hive-config
55
63
configMap :
56
64
name : {{ include "hive.fullname" . }}
Original file line number Diff line number Diff line change 9
9
10
10
resources : {}
11
11
12
- conf :
13
- coreSite :
14
- fs.defaultFS : # default is hdfs://{{.Release.Name}}-hdfs-namenode:8020
15
- hiveSite :
16
- hive.metastore.uris : # default is "thrift://{{.Release.Name}}-metastore:9083"
17
-
12
+ # Also deploy hive-metastore requirement
18
13
metastore :
19
14
enabled : true
20
15
16
+ # Also deploy hdfs requirement
21
17
hdfs :
22
18
enabled : true
23
19
20
+ conf :
21
+ hiveSite :
22
+ # if not set, default hive.metastore.uris is default uri
23
+ # from metastore requirement: "thrift://{{.Release.Name}}-metastore:9083"
24
+ hive.metastore.uris :
25
+ hdfsAdminUser : hdfs
26
+ # if not set, default is configMap from hdfs requirement {{.Release.Name}}-hdfs-hadoop
27
+ hadoopConfigMap :
28
+ # to manually provide hadoop config attributes instead of hadoopConfigMap.
29
+ # hadoopSite:
30
+ # coreSite:
31
+ # fs.defaultFS: hdfs://hdfs-cluster:8020
32
+ # hdfsSite:
33
+ # ...
34
+
35
+
36
+
You can’t perform that action at this time.
0 commit comments