Skip to content

Commit fac0a85

Browse files
authored
[postgresql-cnpg] change from bootstrap init db to database (#177)
1 parent d7ce40a commit fac0a85

10 files changed

Lines changed: 36 additions & 22 deletions

File tree

charts/postgresql-cnpg/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type: application
1111
# This is the chart version. This version number should be incremented each time you make changes
1212
# to the chart and its templates, including the app version.
1313
# Versions are expected to follow Semantic Versioning (https://semver.org/)
14-
version: 0.3.0
14+
version: 0.4.0
1515

1616
# This is the version number of the application being deployed. This version number should be
1717
# incremented each time you make changes to the application. Versions are not expected to

charts/postgresql-cnpg/templates/NOTES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,4 @@ print(dbGetQuery(conn, "SELECT version();"))
109109
dbDisconnect(conn)
110110
```
111111
</details>
112-
{{- end -}}
112+
{{- end -}}

charts/postgresql-cnpg/templates/_helpers.tpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ Create chart name and version as used by the chart label.
2929
{{- define "postgres-cnpg.chart" -}}
3030
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
3131
{{- end }}
32-

charts/postgresql-cnpg/templates/cluster.yaml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,20 @@ spec:
1515
kind: ClusterImageCatalog
1616
name: {{ .Values.imageCatalog.name }}
1717
major: {{ .Values.imageCatalog.major }}
18-
{{ if .Values.extension.pgvector }}
19-
extensions:
20-
- name: vector
21-
{{- end }}
22-
2318
storage:
24-
size: {{ .Values.storage.size }}
25-
19+
size: {{ .Values.storage.size }}
2620
resources:
2721
{{- toYaml .Values.resources | nindent 4 }}
28-
29-
bootstrap:
30-
initdb:
31-
database: {{ .Values.auth.database }}
32-
owner: {{ .Values.auth.username }}
33-
secret:
34-
name: {{ include "postgres-cnpg.fullname" . }}
35-
3622
enableSuperuserAccess: true
3723
superuserSecret:
3824
name: {{ include "postgres-cnpg.fullname" . }}-superuser
39-
4025
managed:
26+
roles:
27+
- name: {{ .Values.auth.username }}
28+
ensure: present
29+
login: true
30+
superuser: false
31+
passwordSecret:
32+
name: {{ include "postgres-cnpg.fullname" . }}-user
4133
services:
4234
disabledDefaultServices: ["ro"]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: postgresql.cnpg.io/v1
2+
kind: Database
3+
metadata:
4+
name: {{ include "postgres-cnpg.fullname" . }}
5+
spec:
6+
name: {{ .Values.auth.database }}
7+
owner: {{ .Values.auth.username }}
8+
cluster:
9+
name: {{ include "postgres-cnpg.fullname" . }}
10+
{{ if .Values.extension.pgvector }}
11+
extensions:
12+
- name: vector
13+
{{- end }}
14+
15+

charts/postgresql-cnpg/templates/discovery-secret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ data:
1313
postgres-username: {{ .Values.auth.username | default ".Values.auth.username" | b64enc | quote }}
1414
postgres-database: {{ .Values.auth.database | default ".Values.auth.database" | b64enc | quote }}
1515
postgres-port: {{ (index .Values.ports 0).port | quote }}
16-
{{- end -}}
16+
{{- end -}}

charts/postgresql-cnpg/templates/superuser-secret.yaml renamed to charts/postgresql-cnpg/templates/secret-superuser.yaml

File renamed without changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ include "postgres-cnpg.fullname" . }}-user
5+
type: kubernetes.io/basic-auth
6+
data:
7+
username: {{ .Values.auth.username | default ".Values.auth.username" | b64enc | quote }}
8+
password: {{ .Values.auth.password | default ".Values.auth.password" | b64enc | quote }}

charts/postgresql-cnpg/values.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,4 @@
237237
}
238238
}
239239
}
240-
}
240+
}

charts/postgresql-cnpg/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ userPreferences:
3636
language: en
3737

3838
discovery:
39-
enabled: false
39+
enabled: false

0 commit comments

Comments
 (0)