aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/applications/charts/sample-horovod-app/templates/statefulset.yaml
blob: 1d3f7577ba091547a88b3a741f3903db159be986 (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
apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
  name: {{ template "horovod.fullname" . }}
  labels:
    app: {{ template "horovod.name" . }}
    chart: {{ template "horovod.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
    role: worker
spec:
  selector:
    matchLabels:
      app: {{ template "horovod.name" . }}
      release: {{ .Release.Name }}
      heritage: {{ .Release.Service }}
      role: worker
  serviceName: {{ template "horovod.fullname" . }}
  podManagementPolicy: {{ .Values.worker.podManagementPolicy }}
  replicas: {{.Values.worker.number}}
  template:
    metadata:
      labels:
        app: {{ template "horovod.name" . }}
        chart: {{ template "horovod.chart" . }}
        release: {{ .Release.Name }}
        heritage: {{ .Release.Service }}
        role: worker
    spec:
      selector:
        matchLabels:
          app: {{ template "horovod.name" . }}
          release: {{ .Release.Name }}
          role: worker
      {{- if .Values.useHostNetwork }}
      hostNetwork: {{ .Values.useHostNetwork }}
      dnsPolicy: ClusterFirstWithHostNet
      {{- end }}
      {{- if .Values.useHostPID }}
      hostPID: {{ .Values.useHostPID }}
      {{- end }}
      volumes:
      - name: {{ template "horovod.fullname" . }}-cm
        configMap:
          name: {{ template "horovod.fullname" . }}
          items:
          - key: hostfile.config
            path: hostfile
            mode: 438
          - key: ssh.readiness
            path: check.sh
            mode: 365
          - key: worker.run
            path: run.sh
            mode: 365
      {{- if .Values.ssh.useSecrets }}
      - name: {{ template "horovod.fullname" . }}-secret
        secret:
          secretName: {{ template "horovod.fullname" . }}
          defaultMode: 448
          items:
          - key: host-key
            path: id_rsa
          - key: host-key-pub
            path: authorized_keys
      {{- end }}
{{- if .Values.volumes }}
{{ toYaml .Values.volumes | indent  6 }}
{{- end }}
      containers:
      - name: worker
        image: "{{ .Values.worker.image.repository }}:{{ .Values.worker.image.tag }}"
        imagePullPolicy: {{ .Values.worker.image.pullPolicy }}
        env:
        - name: SSHPORT
          value: "{{ .Values.ssh.port }}"
       {{- if .Values.ssh.useSecrets }}
        - name: USESECRETS
          value: "{{ .Values.ssh.useSecrets }}"
       {{- end }}
       {{- if .Values.master.env }}
       {{- range $key, $value := .Values.master.env }}
        - name: "{{ $key }}"
          value: "{{ $value }}"
       {{- end }}
       {{- end }}
{{- if .Values.worker.privileged }}
        securityContext:
          privileged: true
{{- end }}
        ports:
        - containerPort: {{ .Values.ssh.port }}
        volumeMounts:
        - name: {{ template "horovod.fullname" . }}-cm
          mountPath: /horovod/generated
        {{- if .Values.ssh.useSecrets }}
        - name: {{ template "horovod.fullname" . }}-secret
          readOnly: true
          mountPath: "/etc/secret-volume"
        {{- end }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | indent 8 }}
{{- end }}
        command:
        - /horovod/generated/run.sh
{{- if .Values.ssh.useSecrets }}
        readinessProbe:
          exec:
            command:
            - /horovod/generated/check.sh
          initialDelaySeconds: 1
          periodSeconds: 2
{{- end }}
        resources:
{{ toYaml .Values.resources | indent 10 }}