Skip to content

Commit e73a6a7

Browse files
Rafael Porres Molinakimoonkim
authored andcommitted
Pass env config variables to hadoop if needed (#15)
* Pass env config variables to hadoop if needed * s/hadoop_env/customHadoopConfig/ It is a more compliant name (camelCase) and also less confusing as hadoop also accepts env variables. Also clarified the meaning of these env variables so that they do not get confused with hadoop env variables
1 parent ab652ce commit e73a6a7

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

charts/hdfs-datanode-k8s/templates/datanode-daemonset.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ spec:
5050
# K8s version 1.6 will fix this, per https://github.com/kubernetes/kubernetes/pull/29378.
5151
- name: CORE_CONF_fs_defaultFS
5252
value: hdfs://hdfs-namenode-0.hdfs-namenode.default.svc.cluster.local:8020
53+
# We now add custom hadoop configuration provided
54+
{{- range $key, $value := .Values.customHadoopConfig }}
55+
{{- if and (ne $key "HDFS_CONF_dfs_datanode_data_dir") (ne $key "CORE_CONF_fs_defaultFS") }}
56+
- name: {{ $key | quote }}
57+
value: {{ $value | quote }}
58+
{{- end }}
59+
{{- end }}
5360
livenessProbe:
5461
initialDelaySeconds: 30
5562
httpGet:

charts/hdfs-datanode-k8s/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,13 @@
2121
# e.g. --set "dataNodeHostPath={/hdfs-data,/hdfs-data1}"
2222
dataNodeHostPath:
2323
- /hdfs-data
24+
25+
# Custom hadoop config keys passed through env variables to hadoop uhopper images.
26+
# See https://hub.docker.com/r/uhopper/hadoop/ to get more details
27+
# Please note that these are not hadoop env variables, but docker env variables that
28+
# will be transformed into hadoop config keys
29+
# HDFS_CONF_dfs_datanode_data_dir and CORE_CONF_fs_defaultFS need special handling and
30+
# they're already set by the chart so any value coming from below config will be ignored
31+
customHadoopConfig: {}
32+
# Set variables through a hash where env variable is the key, e.g.
33+
# HDFS_CONF_dfs_datanode_use_datanode_hostname: "false"

charts/hdfs-namenode-k8s/templates/namenode-statefulset.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ spec:
5353
env:
5454
- name: CLUSTER_NAME
5555
value: hdfs-k8s
56+
# We now add custom hadoop configuration provided
57+
{{- range $key, $value := .Values.customHadoopConfig }}
58+
{{- if ne $key "CLUSTER_NAME" }}
59+
- name: {{ $key | quote }}
60+
value: {{ $value | quote }}
61+
{{- end }}
62+
{{- end }}
5663
ports:
5764
- containerPort: 8020
5865
name: fs

charts/hdfs-namenode-k8s/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,13 @@
1919
# fsimage and edit logs. This will be mounted to the namenode as a k8s HostPath
2020
# volume.
2121
nameNodeHostPath: /hdfs-name
22+
23+
# Custom hadoop config keys passed through env variables to hadoop uhopper images.
24+
# See https://hub.docker.com/r/uhopper/hadoop/ to get more details
25+
# Please note that these are not hadoop env variables, but docker env variables that
26+
# will be transformed into hadoop config keys
27+
# CLUSTER_NAME is already set by the chart so any value coming from below config
28+
# will be ignored
29+
customHadoopConfig: {}
30+
# Set variables through a hash where env variable is the key, e.g.
31+
# HDFS_CONF_dfs_datanode_use_datanode_hostname: "false"

0 commit comments

Comments
 (0)