-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path_deployment.yaml
More file actions
169 lines (169 loc) · 6.68 KB
/
_deployment.yaml
File metadata and controls
169 lines (169 loc) · 6.68 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
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
{{- define "cap-app-proxy.resources.deployment" }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cap-app-proxy.fullname" . }}
labels:
{{- include "cap-app-proxy.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "cap-app-proxy.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "cap-app-proxy.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "cap-app-proxy.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: init
image: "{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}"
{{- include "cap-app-proxy.environment-variables.init-container" . | nindent 8}}
imagePullPolicy: {{ .Values.initContainer.image.pullPolicy }}
command:
{{- toYaml .Values.initContainer.command | nindent 8 }}
volumeMounts:
{{- with .Values.initContainer.extraVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
- mountPath: /app/config/git-tls-certs
name: git-tls-certs
readOnly: true
- mountPath: /app/config/all
name: all-certs
resources:
{{- toYaml .Values.initContainer.resources | nindent 12 }}
containers:
- name: 'cap-app-proxy'
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- include "cap-app-proxy.environment-variables" . | nindent 8}}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
- name: http-metrics
containerPort: 9100
readinessProbe:
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
httpGet:
port: http
path: /api/readyz
livenessProbe:
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
httpGet:
port: http
path: /api/healthz
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
- mountPath: /app/config/all
name: all-certs
readOnly: true
{{- if gt (int .Values.replicaCount) 1 }}
- name: leader-elector
image: {{ include "codefresh-gitops-runtime.image.name" (dict "image" (index .Values "leader-elector" "image") "context" .) }}
imagePullPolicy: {{ index .Values "leader-elector" "image" "pullPolicy" | default "IfNotPresent" }}
command:
- leader-elector
args:
- --id=$(POD_NAME)
- --lease-name=$(LEASE_NAME)
- --namespace=$(NAMESPACE)
- --lease-duration=$(LEASE_DURATION)
- --lease-renew-duration=$(LEASE_RENEW_DURATION)
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: LEASE_NAME
value: cap-app-proxy
- name: LEASE_DURATION
value: 10s
- name: LEASE_RENEW_DURATION
value: 5s
{{- with index .Values "leader-elector" "containerSecurityContext" }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
livenessProbe:
httpGet:
path: /healthz
port: 4040
initialDelaySeconds: {{ index .Values "leader-elector" "livenessProbe" "initialDelaySeconds" }}
periodSeconds: {{ index .Values "leader-elector" "livenessProbe" "periodSeconds" }}
timeoutSeconds: {{ index .Values "leader-elector" "livenessProbe" "timeoutSeconds" }}
successThreshold: {{ index .Values "leader-elector" "livenessProbe" "successThreshold" }}
failureThreshold: {{ index .Values "leader-elector" "livenessProbe" "failureThreshold" }}
readinessProbe:
httpGet:
path: /readyz
port: 4040
initialDelaySeconds: {{ index .Values "leader-elector" "readinessProbe" "initialDelaySeconds" }}
periodSeconds: {{ index .Values "leader-elector" "readinessProbe" "periodSeconds" }}
timeoutSeconds: {{ index .Values "leader-elector" "readinessProbe" "timeoutSeconds" }}
successThreshold: {{ index .Values "leader-elector" "readinessProbe" "successThreshold" }}
failureThreshold: {{ index .Values "leader-elector" "readinessProbe" "failureThreshold" }}
{{- with index .Values "leader-elector" "resources" }}
resources:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector | default .Values.global.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8}}
{{- end }}
{{- with .Values.tolerations | default .Values.global.tolerations}}
tolerations:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "codefresh-gitops-runtime.tplrender" (dict "Values" . "context" .) | nindent 8 }}
{{- end }}
volumes:
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 6 }}
{{- end }}
- name: git-tls-certs
secret:
secretName: codefresh-workflow-pipelines-tls
defaultMode: 420
optional: true
- name: all-certs
emptyDir: {}
{{- end }}