-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_renders_pod.yml
More file actions
100 lines (77 loc) · 2.15 KB
/
Copy path_renders_pod.yml
File metadata and controls
100 lines (77 loc) · 2.15 KB
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
{{/*
* Standalone Pod Render
*
*/}}
{{- define "ph.pod.artifact" -}}
apiVersion: v1
kind: Pod
metadata:
name: {{ .name }}
{{- with .annotations }}
annotations: {{ . | toYaml | nindent 4 }}
{{- end }}
{{- with .labels }}
labels: {{ . | toYaml | nindent 4 }}
{{- end }}
spec: {{ include "ph.pod.render" . | nindent 2}}
{{- end -}}
{{/*
* Render for pods
*
*/}}
{{- define "ph.pod.render" -}}
{{ include "ph.init_containers.render" . -}}
containers: {{ include "ph.pod.containers.render" . | nindent 2}}
{{- if .serviceAccountName }}
serviceAccountName: {{ .serviceAccountName }}
{{- end }}
{{- if .restartPolicy }}
restartPolicy: {{ .restartPolicy }}
{{- end }}
{{- if .affinity }}
affinity: {{ .affinity | toYaml | nindent 2}}
{{- end }}
{{- if .nodeSelector }}
nodeSelector: {{ .nodeSelector | toYaml | nindent 2}}
{{- end }}
imagePullSecrets:
{{- range $v := default (list) .imagePullSecrets }}
- name: {{ $v }}
{{ end }}
volumes: {{ include "ph.pod_volumes.render" . | nindent 2 }}
{{ if hasKey . "automountServiceAccountToken" }}
automountServiceAccountToken: {{ .automountServiceAccountToken }}
{{ end }}
{{ if hasKey . "terminationGracePeriodSeconds" }}
terminationGracePeriodSeconds: {{ .terminationGracePeriodSeconds }}
{{ end }}
{{- end -}}
{{/* Render for containers (loop) */}}
{{- define "ph.pod.containers.render" -}}
{{- if hasKey . "containers_dict" -}}
{{- range $k := ( keys .containers_dict | sortAlpha ) }}
{{- include "ph.container.render" (get $.containers_dict $k) | nindent 2}}
{{- end }}
{{- else -}}
{{- range $c := .containers }}
{{- include "ph.container.render" $c | nindent 2}}
{{- end }}
{{- end -}}
{{- end -}}
{{/*
* Render for init containers
*
*/}}
{{- define "ph.init_containers.render" -}}
{{- if hasKey . "init_containers" -}}
initContainers:
{{- range $c := .init_containers }}
{{ include "ph.container.render" $c | nindent 2}}
{{- end -}}
{{- else if hasKey . "init_containers_dict" -}}
initContainers:
{{- range $k := ( keys .init_containers_dict | sortAlpha ) }}
{{ include "ph.container.render" (get $.init_containers_dict $k ) | nindent 2}}
{{- end -}}
{{- end -}}
{{- end -}}