-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathdeployment.yaml
More file actions
129 lines (129 loc) · 4.47 KB
/
deployment.yaml
File metadata and controls
129 lines (129 loc) · 4.47 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
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: {{ template "pgbouncer.fullname" . }}
labels:
app: {{ template "pgbouncer.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ template "pgbouncer.name" . }}
release: {{ .Release.Name }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- if .Values.metrics.enabled }}
prometheus.io/scrape: 'true'
prometheus.io/port: '9127'
{{- end }}
spec:
affinity:
{{- if .Values.additionalAffinities }}
{{- toYaml .Values.additionalAffinities | nindent 8 }}
{{- end }}
{{- if eq .Values.antiAffinity "hard" }}
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app: {{ template "pgbouncer.name" . }}
release: "{{ .Release.Name }}"
{{- else if eq .Values.antiAffinity "soft" }}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app: {{ template "pgbouncer.name" . }}
release: "{{ .Release.Name }}"
{{- end }}
containers:
- name: pgbouncer
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{ if .Values.image.command }}
command:
{{ toYaml .Values.image.command | nindent 12 }}
{{ end }}
env:
{{- include "pgbouncer.environment" . | nindent 12 }}
ports:
- name: {{ .Values.service.name }}
containerPort: {{ .Values.service.internalPort }}
livenessProbe:
tcpSocket:
port: {{ .Values.service.internalPort }}
readinessProbe:
tcpSocket:
port: {{ .Values.service.internalPort }}
volumeMounts:
- name: secret
subPath: userlist.txt
mountPath: /etc/pgbouncer/userlist.txt
readOnly: true
- name: secret
subPath: pgbouncer.ini
mountPath: /etc/pgbouncer/pgbouncer.ini
readOnly: true
- name: secret
subPath: pg_root.crt
mountPath: /etc/pgbouncer/pg_root.crt
readOnly: true
- name: secret
subPath: postgresql.key
mountPath: /etc/pgbouncer/postgresql.key
readOnly: true
- name: secret
subPath: postgresql.crt
mountPath: /etc/pgbouncer/postgresql.crt
readOnly: true
- name: secret
subPath: server.key
mountPath: /etc/pgbouncer/server.key
readOnly: true
- name: secret
subPath: server.crt
mountPath: /etc/pgbouncer/server.crt
readOnly: true
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.metrics.enabled }}
- name: metrics
image: "{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}"
imagePullPolicy: {{ .Values.metrics.image.pullPolicy }}
env:
{{- range $key, $value := .Values.metricsEnvs }}
- name: {{ $key }}
value: {{ $value }}
{{- end }}
ports:
- name: metrics
containerPort: 9127
livenessProbe:
exec:
command:
- pgbouncer_exporter
- health
readinessProbe:
exec:
command:
- pgbouncer_exporter
- health
resources:
{{- toYaml .Values.metrics.resources | nindent 12 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ template "pgbouncer.fullname" . }}
- name: secret
secret:
secretName: {{ template "pgbouncer.fullname" . }}