Skip to content

Commit b1368d1

Browse files
committed
[IMP] cnpg affinity and init
1 parent 1dac87b commit b1368d1

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

charts/adhoc-odoo/v0.2.9/templates/cnpg_pg.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ spec:
190190
initdb:
191191
database: "odoo"
192192
owner: "odoo"
193+
# encoding: 'UTF8'
194+
# localeCollate: 'C'
195+
localeCType: 'en_US.utf8'
196+
# postInitSQL:
197+
# - CREATE ROLE example
198+
# - CREATE ROLE anotherexample
193199
secret:
194200
name: {{ include "adhoc-odoo.fullname" . }}-pg-app
195201
{{- end }}

charts/adhoc-odoo/v0.2.9/templates/deployment.yaml

+21-22
Original file line numberDiff line numberDiff line change
@@ -113,34 +113,33 @@ spec:
113113
- weight: 100
114114
podAffinityTerm:
115115
labelSelector:
116-
matchExpressions:
117-
- key: "app.kubernetes.io/instance"
118-
operator: In
119-
values:
120-
- {{ .Release.Name }}
116+
matchLabels:
117+
app.kubernetes.io/instance: {{ .Release.Name }}
118+
adhoc.ar/app-name: "odoo"
121119
topologyKey: "kubernetes.io/hostname"
122120
{{/* Try to distribute services of the same type among nodes */}}
123121
- weight: 50
124122
podAffinityTerm:
125123
labelSelector:
126-
matchExpressions:
127-
- key: "adhoc.ar/tier"
128-
operator: In
129-
values:
130-
- {{ .Values.adhoc.appType | lower }}
124+
matchLabels:
125+
adhoc.ar/tier: {{ .Values.adhoc.appType | lower }}
131126
topologyKey: "kubernetes.io/hostname"
132-
{{/* Try to distribute services of the same type among nodes
133-
# Try to distribute the pods with the same service level among nodes
134-
# - weight: 50
135-
# podAffinityTerm:
136-
# labelSelector:
137-
# matchExpressions:
138-
# - key: "adhoc.ar/service-level"
139-
# operator: In
140-
# values:
141-
# - {{ .Values.adhoc.serviceLevel }}
142-
# topologyKey: "kubernetes.io/hostname"
143-
*/}}
127+
{{/* Try to distribute the pods with the same service level among nodes */}}
128+
- weight: 50
129+
podAffinityTerm:
130+
labelSelector:
131+
matchLabels:
132+
adhoc.ar/service-level: {{ .Values.adhoc.serviceLevel }}
133+
topologyKey: "kubernetes.io/hostname"
134+
{{- if .Values.cloudNativePG.enabled }}
135+
podAntiAffinity:
136+
preferredDuringSchedulingIgnoredDuringExecution:
137+
- weight: 100
138+
podAffinityTerm:
139+
labelSelector:
140+
cnpg.io/cluster: {{ .Release.Name }}-pg
141+
topologyKey: "kubernetes.io/hostname"
142+
{{- end }}
144143
{{- if .Values.nodeTag }}
145144
nodeAffinity:
146145
requiredDuringSchedulingIgnoredDuringExecution:

0 commit comments

Comments
 (0)