summaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/applications/sample-horovod-app/templates/job.yaml
blob: da42ded8012987ac988b70072f48e62fa7865717 (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
---
apiVersion: batch/v1
kind: Job
metadata:
  name: {{ template "horovod.fullname" . }}
  labels:
    app: {{ template "horovod.name" . }}
    chart: {{ template "horovod.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
    role: master
spec:
  template:
    metadata:
      labels:
        app: {{ template "horovod.name" . }}
        release: {{ .Release.Name }}
        role: master
    spec:
      {{- if .Values.useHostNetwork }}
      hostNetwork: {{ .Values.useHostNetwork }}
      dnsPolicy: ClusterFirstWithHostNet
      {{- end }}
      {{- if .Values.useHostPID }}
      hostPID: {{ .Values.useHostPID }}
      {{- end }}
      restartPolicy: OnFailure
      volumes:
      - name: {{ template "horovod.fullname" . }}-cm
        configMap:
          name: {{ template "horovod.fullname" . }}
          items:
          - key: hostfile.config
            path: hostfile
            mode: 438
          - key: master.waitWorkerReady
            path: waitWorkersReady.sh
            mode: 365
          - key: master.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: horovod-master
        image: "{{ .Values.master.image.repository }}:{{ .Values.master.image.tag }}"
        imagePullPolicy: {{ .Values.master.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 }}
         - name: AWS_ACCESS_KEY_ID
           valueFrom:
             secretKeyRef:
               name: {{ if .Values.minio.existingSecret }}{{ .Values.minio.existingSecret }}{{ else }}{{ template "horovod.fullname" . }}-minio{{ end }}
               key: accesskey
         - name: AWS_SECRET_ACCESS_KEY
           valueFrom:
             secretKeyRef:
               name: {{ if .Values.minio.existingSecret }}{{ .Values.minio.existingSecret }}{{ else }}{{ template "horovod.fullname" . }}-minio{{ end }}
               key: secretkey
         {{- range $key, $val := .Values.minio.environment }}
         - name: {{ $key }}
           value: {{ $val | quote }}
         {{- end}}
{{- if .Values.master.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
        args:
{{ toYaml .Values.master.args | indent 10 }}         
        resources:
{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.ssh.useSecrets }}
      initContainers:
      - name: wait-workers
        image: "{{ .Values.master.image.repository }}:{{ .Values.master.image.tag }}"
        imagePullPolicy: {{ .Values.master.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 }}
        command: 
        - /horovod/generated/waitWorkersReady.sh
        args:
        - /horovod/generated/hostfile
        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 }}
{{- end }}