Skip to content

Commit b0f3c00

Browse files
committed
[KYUUBI #6875] [K8S][HELM] Add Hadoop configuration files support
### Why are the changes needed? The PR adds support for Hadoop configuration files to be used by Apache Kyuubi, Apache Spark etc. The PR is continuation of PR #6521 and relates to the issue #6123. ### How was this patch tested? 1. Create `hadoop-configs.yaml` file (ConfigMap with `core-site.xml` and `hive-site.xml` entries): ```yaml apiVersion: v1 kind: ConfigMap metadata: name: hadoop-configs data: 'core-site.xml': | <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>hadoop.pr.test</name> <value>configmap</value> </property> </configuration> 'hive-site.xml': | <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>hive.pr.test</name> <value>configmap</value> </property> </configuration> ``` 2. Create ConfigMap from `hadoop-configs.yaml` file: ```shell kubectl create -f hadoop-configs.yaml ``` 3. Create custom `values-hadoop.yaml` (overwrites `core-site.xml`): ```yaml image: repository: apache/kyuubi tag: 1.10.0-spark rbac: create: true rules: - apiGroups: [""] resources: ["pods", "configmaps", "services"] verbs: ["create", "list", "delete", "watch", "deletecollection", "get"] hadoopConf: files: 'core-site.xml': | <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>hadoop.pr.test</name> <value>values</value> </property> </configuration> 'hdfs-site.xml': | <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>hdfs.pr.test</name> <value>values</value> </property> </configuration> filesFrom: - configMap: name: hadoop-configs sparkConf: files: 'spark-defaults.conf': | spark.submit.deployMode=client spark.kubernetes.container.image=apache/spark:3.5.2 spark.kubernetes.authenticate.driver.serviceAccountName=kyuubi ``` 4. Install the chart ```shell helm install kyuubi charts/kyuubi -f values-hadoop.yaml ``` 5. Check there are 3 files in the Hadoop configuration directory: ```shell kubectl exec kyuubi-0 -- ls /opt/hadoop/conf core-site.xml hdfs-site.xml hive-site.xml ``` 6. Check `/opt/hadoop/conf/core-site.xml` has content from ConfigMap: ```shell kubectl exec kyuubi-0 -- cat /opt/hadoop/conf/core-site.xml <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>hadoop.pr.test</name> <value>configmap</value> </property> </configuration> ``` 7. Check `/opt/hadoop/conf/hdfs-site.xml` has content from values: ```shell kubectl exec kyuubi-0 -- cat /opt/hadoop/conf/hdfs-site.xml <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>hdfs.pr.test</name> <value>values</value> </property> </configuration> ``` 8. Check `/opt/hadoop/conf/hive-site.xml` has content from ConfigMap: ```shell kubectl exec kyuubi-0 -- cat /opt/hadoop/conf/hive-site.xml <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>hive.pr.test</name> <value>configmap</value> </property> </configuration> ``` 9. Check configuration values from Spark session: ```shell kubectl exec kyuubi-0 -- ./bin/beeline -u 'jdbc:hive2://kyuubi-thrift-binary:10009' -e 'set hadoop.pr.test;' +-----------------+------------+ | key | value | +-----------------+------------+ | hadoop.pr.test | configmap | +-----------------+------------ kubectl exec kyuubi-0 -- ./bin/beeline -u 'jdbc:hive2://kyuubi-thrift-binary:10009' -e 'set hdfs.pr.test;' +---------------+---------+ | key | value | +---------------+---------+ | hdfs.pr.test | values | +---------------+--------- kubectl exec kyuubi-0 -- ./bin/beeline -u 'jdbc:hive2://kyuubi-thrift-binary:10009' -e 'set hive.pr.test;' +---------------+------------+ | key | value | +---------------+------------+ | hive.pr.test | configmap | +---------------+------------ ``` ### Was this patch authored or co-authored using generative AI tooling? No Closes #6875 from dnskr/helm-add-hadoop-configs-support. Closes #6875 8c8665f [dnskr] [K8S][HELM] Add Hadoop configuration files support Authored-by: dnskr <[email protected]> Signed-off-by: dnskr <[email protected]>
1 parent fff1841 commit b0f3c00

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/}}
17+
18+
apiVersion: v1
19+
kind: ConfigMap
20+
metadata:
21+
name: {{ .Release.Name }}-hadoop
22+
labels:
23+
{{- include "kyuubi.labels" . | nindent 4 }}
24+
data:
25+
{{- with .Values.hadoopConf.files }}
26+
{{- tpl (toYaml .) $ | nindent 2 }}
27+
{{- end }}

charts/kyuubi/templates/kyuubi-statefulset.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ spec:
3939
{{- include "kyuubi.selectorLabels" . | nindent 8 }}
4040
annotations:
4141
checksum/conf: {{ include (print $.Template.BasePath "/kyuubi-configmap.yaml") . | sha256sum }}
42+
checksum/conf-hadoop: {{ include (print $.Template.BasePath "/kyuubi-hadoop-configmap.yaml") . | sha256sum }}
4243
spec:
4344
{{- with .Values.imagePullSecrets }}
4445
imagePullSecrets: {{- toYaml . | nindent 8 }}
@@ -79,6 +80,8 @@ spec:
7980
env:
8081
- name: KYUUBI_CONF_DIR
8182
value: {{ .Values.kyuubiConf.dir }}
83+
- name: HADOOP_CONF_DIR
84+
value: {{ .Values.hadoopConf.dir }}
8285
- name: SPARK_CONF_DIR
8386
value: {{ .Values.sparkConf.dir }}
8487
{{- with .Values.env }}
@@ -124,6 +127,8 @@ spec:
124127
volumeMounts:
125128
- name: conf
126129
mountPath: {{ .Values.kyuubiConf.dir }}
130+
- name: conf-hadoop
131+
mountPath: {{ .Values.hadoopConf.dir }}
127132
- name: conf-spark
128133
mountPath: {{ .Values.sparkConf.dir }}
129134
{{- with .Values.volumeMounts }}
@@ -141,6 +146,14 @@ spec:
141146
{{- with .Values.kyuubiConf.filesFrom }}
142147
{{- tpl (toYaml .) $ | nindent 14 }}
143148
{{- end }}
149+
- name: conf-hadoop
150+
projected:
151+
sources:
152+
- configMap:
153+
name: {{ .Release.Name }}-hadoop
154+
{{- with .Values.hadoopConf.filesFrom }}
155+
{{- tpl (toYaml .) $ | nindent 14 }}
156+
{{- end }}
144157
- name: conf-spark
145158
projected:
146159
sources:

charts/kyuubi/values.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,38 @@ kyuubiConf:
171171
# - key: trust-store
172172
# path: certs/truststore.jks
173173

174+
# Hadoop configuration files
175+
hadoopConf:
176+
# $HADOOP_CONF_DIR directory
177+
dir: /opt/hadoop/conf
178+
# Configuration files from the specified keys (file name) and values (file content)
179+
files: ~
180+
#files:
181+
# 'core-site.xml': |
182+
# <?xml version="1.0"?>
183+
# <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
184+
# <configuration>
185+
# <property>
186+
# <name>hadoop.tmp.dir</name>
187+
# <value>/tmp/hadoop-${user.name}</value>
188+
# </property>
189+
# </configuration>
190+
191+
# Configuration files from the list of existing ConfigMaps and Secrets
192+
filesFrom: []
193+
#filesFrom:
194+
#- configMap:
195+
# name: hadoop-configs
196+
#- secret:
197+
# name: hadoop-secrets
198+
#- secret:
199+
# name: ssl-secrets
200+
# items:
201+
# - key: key-store
202+
# path: certs/keystore.jks
203+
# - key: trust-store
204+
# path: certs/truststore.jks
205+
174206
# Spark configuration, see https://github.com/apache/spark/tree/master/conf and Spark documentation for more details
175207
sparkConf:
176208
# $SPARK_CONF_DIR directory

0 commit comments

Comments
 (0)