1 # Provides datanode helper scripts.
5 name: {{ template "hdfs-k8s.datanode.fullname" . }}-scripts
7 app: {{ template "hdfs-k8s.datanode.name" . }}
8 chart: {{ template "hdfs-k8s.subchart" . }}
9 release: {{ .Release.Name }}
13 # Exit on error. Append "|| true" if you expect an error.
15 # Exit on error inside any functions or subshells.
17 # Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR
19 # Catch an error in command pipes. e.g. mysqldump fails (but gzip succeeds)
20 # in `mysqldump |gzip`
22 # Turn on traces, useful while debugging.
25 # Check if datanode registered with the namenode and got non-null cluster ID.
27 _URL_PATH="jmx?qry=Hadoop:service=DataNode,name=DataNodeInfo"
29 for _PORT in $_PORTS; do
30 _CLUSTER_ID+=$(curl -s http://localhost:${_PORT}/$_URL_PATH | \
31 grep ClusterId) || true
33 echo $_CLUSTER_ID | grep -q -v null
35 # Deleting a daemonset may need some trick. See
36 # https://github.com/kubernetes/kubernetes/issues/33245#issuecomment-261250489
37 apiVersion: extensions/v1beta1
40 name: {{ template "hdfs-k8s.datanode.fullname" . }}
42 app: {{ template "hdfs-k8s.datanode.name" . }}
43 chart: {{ template "hdfs-k8s.subchart" . }}
44 release: {{ .Release.Name }}
49 app: {{ template "hdfs-k8s.datanode.name" . }}
50 release: {{ .Release.Name }}
51 {{- if .Values.podAnnotations }}
53 {{ toYaml .Values.podAnnotations | indent 8 }}
56 {{- if .Values.affinity }}
58 {{ toYaml .Values.affinity | indent 8 }}
59 {{- else if .Values.global.defaultAffinityEnabled }}
62 requiredDuringSchedulingIgnoredDuringExecution:
65 - key: {{ template "hdfs-k8s.datanode.fullname" . }}-exclude
66 operator: DoesNotExist
68 {{- if .Values.nodeSelector }}
70 {{ toYaml .Values.nodeSelector | indent 8 }}
72 {{- if .Values.tolerations }}
74 {{ toYaml .Values.tolerations | indent 8 }}
78 dnsPolicy: ClusterFirstWithHostNet
81 image: uhopper/hadoop-datanode:2.7.2
83 - name: HADOOP_CUSTOM_CONF_DIR
84 value: /etc/hadoop-custom-conf
85 - name: MULTIHOMED_NETWORK
87 {{- if and .Values.global.kerberosEnabled .Values.global.jsvcEnabled }}
88 - name: HADOOP_SECURE_DN_USER
100 - /dn-scripts/check-status.sh
101 initialDelaySeconds: 60
106 - /dn-scripts/check-status.sh
107 initialDelaySeconds: 60
113 mountPath: /dn-scripts
116 mountPath: /etc/hadoop-custom-conf
118 {{- range $index, $path := .Values.global.dataNodeHostPath }}
119 - name: hdfs-data-{{ $index }}
120 mountPath: /hadoop/dfs/data/{{ $index }}
122 {{- if .Values.global.kerberosEnabled }}
123 - name: kerberos-config
124 mountPath: /etc/krb5.conf
125 subPath: {{ .Values.global.kerberosConfigFileName }}
127 - name: kerberos-keytab-copy
128 mountPath: /etc/security/
130 {{- if .Values.global.jsvcEnabled }}
132 mountPath: /jsvc-home
135 {{- if .Values.global.kerberosEnabled }}
137 - name: copy-kerberos-keytab
138 image: busybox:1.27.1
139 command: ['sh', '-c']
141 - cp /kerberos-keytabs/$MY_NODE_NAME.keytab /kerberos-keytab-copy/hdfs.keytab
146 fieldPath: spec.nodeName
148 - name: kerberos-keytabs
149 mountPath: /kerberos-keytabs
150 - name: kerberos-keytab-copy
151 mountPath: /kerberos-keytab-copy
152 {{- if .Values.global.jsvcEnabled }}
154 # Pull by digest because the image doesn't have tags to pin.
155 image: mschlimb/jsvc@sha256:bf20eb9a319e9a2f87473d8da7418d21503a97528b932800b6b8417cd31e30ef
156 command: ['sh', '-c']
158 - cp /usr/bin/jsvc /jsvc-home/jsvc
161 mountPath: /jsvc-home
164 restartPolicy: Always
168 name: {{ template "hdfs-k8s.datanode.fullname" . }}-scripts
170 {{- range $index, $path := .Values.global.dataNodeHostPath }}
171 - name: hdfs-data-{{ $index }}
177 name: {{ template "hdfs-k8s.config.fullname" . }}
178 {{- if .Values.global.kerberosEnabled }}
179 - name: kerberos-config
181 name: {{ template "krb5-configmap" . }}
182 - name: kerberos-keytabs
184 secretName: {{ template "krb5-keytabs-secret" . }}
185 - name: kerberos-keytab-copy
187 {{- if .Values.global.jsvcEnabled }}