aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/training-core/charts/kubernetes-HDFS/charts/hdfs-simple-namenode-k8s/templates/namenode-statefulset.yaml
blob: ab92efa96fde35383c10212dd7a16ae957a844c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# A headless service to create DNS records.
apiVersion: v1
kind: Service
metadata:
  name: {{ template "hdfs-k8s.namenode.fullname" . }}
  labels:
    app: {{ template "hdfs-k8s.namenode.name" . }}
    chart: {{ template "hdfs-k8s.subchart" . }}
    release: {{ .Release.Name }}
spec:
  ports:
  - port: 8020
    name: fs
  clusterIP: None
  selector:
    app: {{ template "hdfs-k8s.namenode.name" . }}
    release: {{ .Release.Name }}
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: {{ template "hdfs-k8s.namenode.fullname" . }}
  labels:
    app: {{ template "hdfs-k8s.namenode.name" . }}
    chart: {{ template "hdfs-k8s.subchart" . }}
    release: {{ .Release.Name }}
spec:
  serviceName: {{ template "hdfs-k8s.namenode.fullname" . }}
  # Create a size-1 set.
  replicas: 1
  template:
    metadata:
      labels:
        app: {{ template "hdfs-k8s.namenode.name" . }}
        release: {{ .Release.Name }}
      {{- if .Values.podAnnotations }}
      annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
      {{- end }}
    spec:
      {{- if .Values.affinity }}
      affinity:
{{ toYaml .Values.affinity | indent 8 }}
      {{- end }}
      {{- if .Values.nodeSelector }}
      nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
      {{- end }}
      {{- if .Values.tolerations }}
      tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
      {{- end }}
      # Use hostNetwork so datanodes connect to namenode without going through an overlay network
      # like weave. Otherwise, namenode fails to see physical IP address of datanodes.
      hostNetwork: true
      hostPID: true
      dnsPolicy: ClusterFirstWithHostNet
      containers:
        - name: hdfs-namenode
          image: uhopper/hadoop-namenode:2.7.2
          env:
            - name: HADOOP_CUSTOM_CONF_DIR
              value: /etc/hadoop-custom-conf
            - name: CLUSTER_NAME
              value: hdfs-k8s
          ports:
          - containerPort: 8020
            name: fs
          volumeMounts:
            - name: hdfs-name
              mountPath: /hadoop/dfs/name
            - name: hdfs-config
              mountPath: /etc/hadoop-custom-conf
              readOnly: true
      restartPolicy: Always
      volumes:
        - name: hdfs-name
          hostPath:
            path: {{ .Values.nameNodeHostPath }}
        - name: hdfs-config
          configMap:
            name: {{ template "hdfs-k8s.config.fullname" . }}