Skip to content

Commit bb9d673

Browse files
committed
[IMP] role mng
1 parent 1b69c01 commit bb9d673

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

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

+20-26
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
{{- if .Values.cloudNativePG.enabled }}
2-
3-
{{- if not .Values.cloudNativePG.restore.inTimeRecovery }}
42
apiVersion: v1
53
kind: Secret
64
metadata:
7-
name: {{ include "adhoc-odoo.fullname" . }}-pg-superuser
5+
name: {{ include "adhoc-odoo.fullname" . }}-pg-app
86
labels:
97
{{- include "adhoc-odoo.labels" . | nindent 4 }}
108
type: kubernetes.io/basic-auth
119
data:
12-
dbname: {{ "*" | b64enc }}
13-
password: {{ .Values.cloudNativePG.superUserPassword | b64enc }}
14-
port: {{ "5432" | b64enc }}
15-
user: {{ "odoo" | b64enc }}
16-
username: {{ "odoo" | b64enc }}
10+
username: {{ "odoo" | b64enc | quote }}
11+
password: {{ .Values.cloudNativePG.superUserPassword | b64enc | quote }}
1712
---
18-
{{- end }}
1913
apiVersion: postgresql.cnpg.io/v1
2014
kind: Cluster
2115
metadata:
@@ -34,10 +28,6 @@ metadata:
3428
{{/*https://cloudnative-pg.io/documentation/1.22/cloudnative-pg.v1/#postgresql-cnpg-io-v1-ClusterSpec */}}
3529
spec:
3630

37-
enableSuperuserAccess: true
38-
superuserSecret:
39-
name: {{ .Release.Name }}-pg-superuser
40-
4131
{{/*
4232
# Name of the priority class which will be used in every generated Pod, if the PriorityClass specified does not exist, the pod will not be able to schedule. Please refer to https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass for more information
4333
# priorityClassName:
@@ -127,7 +117,6 @@ spec:
127117
target: prefer-standby
128118
retentionPolicy: "360d"
129119

130-
{{- if or .Values.cloudNativePG.restore.fromSnapshot .Values.cloudNativePG.restore.fromGCPSnapshot }}
131120
bootstrap:
132121
{{- if .Values.cloudNativePG.restore.inTimeRecovery }}
133122
recovery:
@@ -150,17 +139,22 @@ spec:
150139
targetTime: {{ .Values.cloudNativePG.restore.inTimeRecovery | quote }}
151140
{{- end }}
152141
{{- else }}
153-
# initdb:
154-
# database: "app"
155-
# owner: "odoo"
156-
# # encoding: 'UTF8'
157-
# # localeCollate: 'C'
158-
# localeCType: 'en_US.utf8'
159-
# # postInitSQL:
160-
# # - CREATE ROLE example
161-
# # - CREATE ROLE anotherexample
162-
# secret:
163-
# name: {{ include "adhoc-odoo.fullname" . }}-pg-app
142+
initdb:
143+
database: "app"
144+
postInitSQL:
145+
- DROP DATABASE app
146+
- DELETE ROLE app
164147
{{- end }}
165-
{{- end }}
148+
149+
{{- if not .Values.cloudNativePG.restore.inTimeRecovery }}
150+
managed:
151+
roles:
152+
- name: odoo
153+
ensure: present
154+
comment: Odoo User
155+
login: true
156+
superuser: true
157+
passwordSecret:
158+
name: {{ include "adhoc-odoo.fullname" . }}-pg-app
159+
{{- end }}
166160
{{- end }}

0 commit comments

Comments
 (0)