Skip to content

Commit d51c7de

Browse files
authored
Use a common configmap and remove duplicates (#43)
* Add krb5-server chart * krb5-server runs * Support multiple test cases * Add cases * Support skip cleaning up * Kerberos test sets up config and keytabs * Fix bugs * Fix typo * Enable kerberos for journal nodes * Fix a bug * Fix a bug * Specify journalnode princiapls in the namenode config * Test client use kerberos * Use nn0 pod for hdfs admin commands * Run test cases back to back * Describe pod when tests fail * Debug travis * debug travis * debug travis * debug travis * debug travis * debug travis * debug travis * debug travis * debug travis * debug travis * debug travis * debug travis * debug travis * Fix typo * debug travis * debug travis * Do mount --make-share for travis * Works end-to-end even in Travis * Document the krb5-server chart * Minor clean up * Clean up * Use -k option * Add a chart for common configmap * Remove vim file * Switch charts to use the new configmap * Fix a minor bug * Fix a typo * Fix a bug * Disable service level RPC authorization * Add group mapping for the hdfs user * Remove redundant license notices * CI clean up the hdfs-config chart * Remove redundant zookeeper param in CI * Test multiple datanode data dirs * Test custom Hadoop config values in CI * Update README.md's * Cover non-HA in CI * Address review comment
1 parent 3b0f9c6 commit d51c7de

File tree

24 files changed

+585
-386
lines changed

24 files changed

+585
-386
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sudo: required
33
env:
44
- CASES=_basic.sh
55
- CASES=_kerberos.sh
6+
- CASES=_single-namenode.sh
67

78
before_script:
89
# Required for K8s v1.10.x. See

charts/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ title: HDFS charts
55

66
# HDFS charts
77
Helm charts for launching HDFS daemons in a K8s cluster. Note that the HDFS
8-
charts are currently being heavily revised and are subject to change.
8+
charts are currently in pre-alpha quality. They are also being heavily revised
9+
and are subject to change.
910

1011
# Prerequisite
1112

@@ -26,8 +27,8 @@ The HDFS daemons should be launched in the following order.
2627
[hdfs-datanode-k8s/README.md](hdfs-datanode-k8s/README.md)
2728
for how to launch.
2829

29-
Kerberos is supported. See the `kerberosEnabled` option in the namenode and
30-
datanode charts.
30+
Kerberos is supported in the HA setup with the `kerberosEnabled` option.
31+
For more details, see the namenode `README.md`.
3132

3233
There is also a HDFS client chart `hdfs-client` that can be convenient for
3334
testing.

charts/hdfs-client/templates/client-deployment.yaml

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
# Licensed to the Apache Software Foundation (ASF) under one or more
2-
# contributor license agreements. See the NOTICE file distributed with
3-
# this work for additional information regarding copyright ownership.
4-
# The ASF licenses this file to You under the Apache License, Version 2.0
5-
# (the "License"); you may not use this file except in compliance with
6-
# the License. You may obtain a copy of the License at
7-
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
10-
# Unless required by applicable law or agreed to in writing, software
11-
# distributed under the License is distributed on an "AS IS" BASIS,
12-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
# See the License for the specific language governing permissions and
14-
# limitations under the License.
15-
161
apiVersion: apps/v1
172
apiVersion: extensions/v1beta1
183
kind: Deployment
@@ -34,47 +19,17 @@ spec:
3419
- name: hdfs-client
3520
image: uhopper/hadoop:2.7.2
3621
env:
37-
# The following env vars are listed according to low-to-high precedence order.
38-
# i.e. Whoever comes last will override the earlier value of the same variable.
39-
{{- if .Values.kerberosEnabled }}
40-
- name: CORE_CONF_hadoop_security_authentication
41-
value: kerberos
42-
- name: CORE_CONF_hadoop_security_authorization
43-
value: "true"
44-
- name: CORE_CONF_hadoop_rpc_protection
45-
value: privacy
46-
{{- end }}
47-
{{- range $key, $value := .Values.customHadoopConfig }}
48-
- name: {{ $key | quote }}
49-
value: {{ $value | quote }}
50-
{{- end }}
51-
{{- if .Values.namenodeHAEnabled }}
52-
- name: CORE_CONF_fs_defaultFS
53-
value: hdfs://hdfs-k8s
54-
- name: HDFS_CONF_dfs_nameservices
55-
value: hdfs-k8s
56-
- name: HDFS_CONF_dfs_ha_namenodes_hdfs___k8s
57-
value: nn0,nn1
58-
- name: HDFS_CONF_dfs_namenode_rpc___address_hdfs___k8s_nn0
59-
value: hdfs-namenode-0.hdfs-namenode.default.svc.cluster.local:8020
60-
- name: HDFS_CONF_dfs_namenode_rpc___address_hdfs___k8s_nn1
61-
value: hdfs-namenode-1.hdfs-namenode.default.svc.cluster.local:8020
62-
- name: HDFS_CONF_dfs_namenode_http___address_hdfs___k8s_nn0
63-
value: hdfs-namenode-0.hdfs-namenode.default.svc.cluster.local:50070
64-
- name: HDFS_CONF_dfs_namenode_http___address_hdfs___k8s_nn1
65-
value: hdfs-namenode-1.hdfs-namenode.default.svc.cluster.local:50070
66-
- name: HDFS_CONF_dfs_client_failover_proxy_provider_hdfs___k8s
67-
value: org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider
68-
{{- else }}
69-
- name: CORE_CONF_fs_defaultFS
70-
value: hdfs://hdfs-namenode-0.hdfs-namenode.default.svc.cluster.local:8020
71-
{{- end }}
22+
- name: HADOOP_CUSTOM_CONF_DIR
23+
value: /etc/hadoop-custom-conf
7224
- name: MULTIHOMED_NETWORK
7325
value: "0"
7426
command: ['/bin/sh', '-c']
7527
args:
7628
- /entrypoint.sh /usr/bin/tail -f /var/log/dmesg
7729
volumeMounts:
30+
- name: hdfs-config
31+
mountPath: /etc/hadoop-custom-conf
32+
readOnly: true
7833
{{- if .Values.kerberosEnabled }}
7934
- name: kerberos-config
8035
mountPath: /etc/krb5.conf
@@ -83,6 +38,9 @@ spec:
8338
{{- end }}
8439
restartPolicy: Always
8540
volumes:
41+
- name: hdfs-config
42+
configMap:
43+
name: {{ .Values.hdfsConfigMap }}
8644
{{- if .Values.kerberosEnabled }}
8745
- name: kerberos-config
8846
configMap:

charts/hdfs-client/values.yaml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,17 @@
1515

1616
# Default values for template variables.
1717

18-
# Custom hadoop config keys passed through env variables to hadoop uhopper images.
19-
# See https://hub.docker.com/r/uhopper/hadoop/ to get more details
20-
# Please note that these are not hadoop env variables, but docker env variables that
21-
# will be transformed into hadoop config keys
22-
# HDFS_CONF_dfs_datanode_data_dir and CORE_CONF_fs_defaultFS need special handling and
23-
# they're already set by the chart so any value coming from below config will be ignored
24-
customHadoopConfig: {}
25-
# Set variables through a hash where env variable is the key, e.g.
26-
# HDFS_CONF_dfs_datanode_use_datanode_hostname: "false"
18+
# Name of the k8s config map containing Hadoop config files such as core-site.xml
19+
# and hdfs-site.xml.
20+
hdfsConfigMap: hdfs-config
2721

2822
# Whether or not Kerberos support is enabled.
2923
kerberosEnabled: false
3024

31-
# Required to be non-empty if Kerberos is enabled. Specify your Kerberos realm name.
32-
# This should match the realm name in your Kerberos config file.
33-
kerberosRealm: ""
34-
3525
# Effective only if Kerberos is enabled. Name of the k8s config map containing
3626
# the kerberos config file.
3727
kerberosConfigMap: kerberos-config
3828

3929
# Effective only if Kerberos is enabled. Name of the kerberos config file inside
4030
# the config map.
4131
kerberosConfigFileName: krb5.conf
42-
43-
# Whether or not to expect namenodes in the HA setup.
44-
namenodeHAEnabled: true

charts/hdfs-config-k8s/.helmignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

charts/hdfs-config-k8s/Chart.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
appVersion: "1.0"
3+
description: A Helm chart for configuring HDFS on Kubernetes
4+
name: hdfs-config-k8s
5+
version: 0.1.0
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "hdfs-config-k8s.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "hdfs-config-k8s.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "hdfs-config-k8s.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Create the kerberos principal suffix for core HDFS services
36+
*/}}
37+
{{- define "hdfs-principal" -}}
38+
{{- printf "hdfs/_HOST@%s" .Values.kerberosRealm -}}
39+
{{- end -}}
40+
41+
{{/*
42+
Create the kerberos principal for HTTP services
43+
*/}}
44+
{{- define "http-principal" -}}
45+
{{- printf "HTTP/_HOST@%s" .Values.kerberosRealm -}}
46+
{{- end -}}
47+
48+
{{/*
49+
Create the datanode data dir list. The below uses two loops to make sure the
50+
last item does not have comma. It uses index 0 for the last item since that is
51+
the only special index that helm template gives us.
52+
*/}}
53+
{{- define "datanode-data-dirs" -}}
54+
{{- range $index, $path := .Values.dataNodeHostPath -}}
55+
{{- if ne $index 0 -}}
56+
/hadoop/dfs/data/{{ $index }},
57+
{{- end -}}
58+
{{- end -}}
59+
{{- range $index, $path := .Values.dataNodeHostPath -}}
60+
{{- if eq $index 0 -}}
61+
/hadoop/dfs/data/{{ $index }}
62+
{{- end -}}
63+
{{- end -}}
64+
{{- end -}}

0 commit comments

Comments
 (0)