aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/deploy/training-core/charts/kubernetes-HDFS/charts/hdfs-journalnode-k8s/templates/journalnode-statefulset.yaml
blob: 22a4a2b43cc6ecbc4f10ec3181facb74bd5aaf83 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# A headless service to create DNS records.
apiVersion: v1
kind: Service
metadata:
  name: {{ template "hdfs-k8s.journalnode.fullname" . }}
  labels:
    app: {{ template "hdfs-k8s.journalnode.name" . }}
    chart: {{ template "hdfs-k8s.subchart" . }}
    release: {{ .Release.Name }}
  annotations:
    # TODO: Deprecated. Replace tolerate-unready-endpoints with
    # v1.Service.PublishNotReadyAddresses.
    service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec:
  ports:
  - port: 8485
    name: jn
  - port: 8480
    name: http
  clusterIP: None
  selector:
    app: {{ template "hdfs-k8s.journalnode.name" . }}
    release: {{ .Release.Name }}
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
  name: {{ template "hdfs-k8s.journalnode.fullname" . }}
  labels:
    app: {{ template "hdfs-k8s.journalnode.name" . }}
    chart: {{ template "hdfs-k8s.subchart" . }}
    release: {{ .Release.Name }}
spec:
  selector:
    matchLabels:
      app: {{ template "hdfs-k8s.journalnode.name" . }}
      release: {{ .Release.Name }}
  minAvailable: {{ div .Values.global.journalnodeQuorumSize 2 | add1 }}
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: {{ template "hdfs-k8s.journalnode.fullname" . }}
  labels:
    app: {{ template "hdfs-k8s.journalnode.name" . }}
    chart: {{ template "hdfs-k8s.subchart" . }}
    release: {{ .Release.Name }}
spec:
  serviceName: {{ template "hdfs-k8s.journalnode.fullname" . }}
  replicas: {{ .Values.global.journalnodeQuorumSize }}
  template:
    metadata:
      labels:
        app: {{ template "hdfs-k8s.journalnode.name" . }}
        release: {{ .Release.Name }}
      {{- if .Values.podAnnotations }}
      annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
      {{- end }}
    spec:
      {{- if .Values.affinity }}
      affinity:
{{ toYaml .Values.affinity | indent 8 }}
      {{- else if .Values.global.defaultAffinityEnabled }}
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: "app"
                    operator: In
                    values:
                      - {{ template "hdfs-k8s.journalnode.name" . }}
                  - key: "release"
                    operator: In
                    values:
                      - {{ .Release.Name }}
              topologyKey: "kubernetes.io/hostname"
      {{- end }}
      {{- if .Values.nodeSelector }}
      nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
      {{- end }}
      {{- if .Values.tolerations }}
      tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
      {{- end }}
      containers:
        - name: hdfs-journalnode
          image: uhopper/hadoop-namenode:2.7.2
          env:
            - name: HADOOP_CUSTOM_CONF_DIR
              value: /etc/hadoop-custom-conf
          command: ["/entrypoint.sh"]
          args: ["/opt/hadoop-2.7.2/bin/hdfs", "--config", "/etc/hadoop", "journalnode"]
          ports:
          - containerPort: 8485
            name: jn
          - containerPort: 8480
            name: http
          volumeMounts:
            # Mount a subpath of the volume so that the journal subdir would be
            # a brand new empty dir. This way, we won't get affected by
            # existing files in the volume top dir.
            - name: editdir
              mountPath: /hadoop/dfs/journal
              subPath: journal
            - name: editdir
              mountPath: /hadoop/dfs/name
              subPath: name
            - name: hdfs-config
              mountPath: /etc/hadoop-custom-conf
              readOnly: true
           {{- if .Values.global.kerberosEnabled }}
            - name: kerberos-config
              mountPath: /etc/krb5.conf
              subPath: {{ .Values.global.kerberosConfigFileName }}
              readOnly: true
            - name: kerberos-keytab-copy
              mountPath: /etc/security/
              readOnly: true
            {{- end }}
     {{- if .Values.global.kerberosEnabled }}
      initContainers:
        - name: copy-kerberos-keytab
          image: busybox:1.27.1
          command: ['sh', '-c']
          args:
            - cp /kerberos-keytabs/${MY_KERBEROS_NAME}*.keytab /kerberos-keytab-copy/hdfs.keytab
          env:
            - name: MY_KERBEROS_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
          volumeMounts:
            - name: kerberos-keytabs
              mountPath: /kerberos-keytabs
            - name: kerberos-keytab-copy
              mountPath: /kerberos-keytab-copy
      {{- end }}
      restartPolicy: Always
      volumes:
        - name: hdfs-config
          configMap:
            name: {{ template "hdfs-k8s.config.fullname" . }}
        {{- if .Values.global.kerberosEnabled }}
        - name: kerberos-config
          configMap:
            name: {{ template "krb5-configmap" . }}
        - name: kerberos-keytabs
          secret:
            secretName: {{ template "krb5-keytabs-secret" . }}
        - name: kerberos-keytab-copy
          emptyDir: {}
        {{- end }}
      {{- if .Values.global.podSecurityContext.enabled }}
      securityContext:
        runAsUser: {{ .Values.global.podSecurityContext.runAsUser }}
        fsGroup: {{ .Values.global.podSecurityContext.fsGroup }}
      {{- end }}
  volumeClaimTemplates:
    - metadata:
        name: editdir
      spec:
        accessModes:
          - {{ .Values.persistence.accessMode | quote }}
        resources:
          requests:
            storage: {{ .Values.persistence.size | quote }}
      {{- if .Values.persistence.storageClass }}
        {{- if (eq "-" .Values.persistence.storageClass) }}
        storageClassName: ""
        {{- else }}
        storageClassName: "{{ .Values.persistence.storageClass }}"
        {{- end }}
      {{- end }}
      {{- if .Values.persistence.selector }}
        selector:
{{ toYaml .Values.persistence.selector | indent 10 }}
      {{- end }}