-
Notifications
You must be signed in to change notification settings - Fork 983
Expand file tree
/
Copy pathdeployment.yaml
More file actions
153 lines (153 loc) · 5.45 KB
/
Copy pathdeployment.yaml
File metadata and controls
153 lines (153 loc) · 5.45 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
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# License found in the LICENSE file in the root directory
# of this source tree.
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "whatsapp-proxy-chart.fullname" . }}
labels:
{{- include "whatsapp-proxy-chart.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "whatsapp-proxy-chart.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/haproxy-config: {{ tpl .Values.haproxyConfig . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "whatsapp-proxy-chart.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "whatsapp-proxy-chart.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
# The container entrypoint substitutes #PUBLIC_IP -> `set-dst` in
# /usr/local/etc/haproxy/haproxy.cfg in place. A ConfigMap volume is
# always mounted read-only by the kubelet (the readOnly flag can't
# change that), which makes that in-place edit fail and leaves HAProxy
# advertising the pod's private IP. So seed a writable emptyDir with the
# image defaults (e.g. errors/) and overlay the ConfigMap haproxy.cfg.
- name: haproxy-config-init
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /bin/sh
- -c
- |
set -e
cp -a /usr/local/etc/haproxy/. /haproxy-runtime/
cp /haproxy-config-src/haproxy.cfg /haproxy-runtime/haproxy.cfg
volumeMounts:
- name: haproxy-config-src
mountPath: /haproxy-config-src
readOnly: true
- name: haproxy-config
mountPath: /haproxy-runtime
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
{{- if .Values.service.http_proxy_port }}
- name: http-proxy
containerPort: 8080
protocol: TCP
{{- end}}
{{- if .Values.service.http_port }}
- name: http
containerPort: 80
protocol: TCP
{{- end}}
{{- if .Values.service.https_proxy_port }}
- name: https-proxy
containerPort: 8443
protocol: TCP
{{- end}}
{{- if .Values.service.https_port }}
- name: https
containerPort: 443
protocol: TCP
{{- end}}
{{- if .Values.service.jabber_proxy_port }}
- name: jabber-proxy
containerPort: 8222
protocol: TCP
{{- end}}
{{- if .Values.service.jabber_port }}
- name: jabber
containerPort: 5222
protocol: TCP
{{- end}}
{{- if .Values.service.media_port }}
- name: media
containerPort: 587
protocol: TCP
{{- end}}
{{- if .Values.service.media_proxy_port}}
- name: media-proxy
containerPort: 7777
protocol: TCP
{{- end}}
{{- if .Values.service.stats_port }}
- name: stats
containerPort: 8199
protocol: TCP
{{- end}}
readinessProbe:
exec:
command:
- /usr/local/bin/healthcheck.sh
initialDelaySeconds: 30
periodSeconds: 30
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: "PUBLIC_IP"
value: "{{ .Values.public_ip }}"
{{- with .Values.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
# Writable copy of the config dir (populated by the initContainer)
# so the entrypoint can edit haproxy.cfg in place, while keeping it
# at its canonical /usr/local/etc/haproxy/haproxy.cfg location.
- name: haproxy-config
mountPath: /usr/local/etc/haproxy
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: haproxy-config-src
configMap:
name: {{ include "whatsapp-proxy-chart.fullname" . }}-haproxy
- name: haproxy-config
emptyDir: {}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}