Skip to content

Commit 0857ab6

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

File tree

1 file changed

+15
-27
lines changed

1 file changed

+15
-27
lines changed

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

+15-27
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:
@@ -149,18 +138,17 @@ spec:
149138
recoveryTarget:
150139
targetTime: {{ .Values.cloudNativePG.restore.inTimeRecovery | quote }}
151140
{{- end }}
152-
{{- 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
164141
{{- end }}
165-
{{- end }}
142+
143+
{{- if not .Values.cloudNativePG.restore.inTimeRecovery }}
144+
managed:
145+
roles:
146+
- name: odoo
147+
ensure: present
148+
comment: Odoo User
149+
login: true
150+
superuser: true
151+
passwordSecret:
152+
name: {{ include "adhoc-odoo.fullname" . }}-pg-app
153+
{{- end }}
166154
{{- end }}

0 commit comments

Comments
 (0)