-
Notifications
You must be signed in to change notification settings - Fork 4
Cloud native postgres #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5073b2b
c45cfcf
8952d09
d12b7c3
d57719c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| apiVersion: v1 | ||
| description: Cloud Native Postgres | ||
| name: cnpg | ||
| version: 0.1.0 | ||
| appVersion: 0.1.0 | ||
| maintainers: | ||
| - name: Developer | ||
| email: dev@opsta.in.th | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| {{- if .Values.enabled }} | ||
| #{{- $cnpg := .Values.cnpg -}} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| {{- $backup := .Values.backup -}} | ||
| {{- $bos := $backup.barmanObjectStore -}} | ||
| {{- $s3 := $bos.s3Credentials -}} | ||
| {{- $defaultS3Secret := printf "%s-cnpg-s3-creds" .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
|
|
||
|
|
||
| {{- $s3SecretName := $defaultS3Secret -}} | ||
|
|
||
| {{- if and $backup.enabled (not $s3SecretName) -}} | ||
| {{- fail "backup.enabled=true but S3 secret name resolved empty (unexpected)" -}} | ||
| {{ end }} | ||
|
Comment on lines
+11
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| apiVersion: postgresql.cnpg.io/v1 | ||
| kind: Cluster | ||
| metadata: | ||
| name: {{ printf "%s-cnpg" .Release.Name | trunc 63 | trimSuffix "-" | quote }} | ||
| spec: | ||
| imageName: {{ .Values.cluster.imageName | quote }} | ||
| instances: {{ .Values.cluster.instances }} | ||
|
|
||
| {{- if .Values.superuser.enabled }} | ||
| enableSuperuserAccess: true | ||
| superuserSecret: | ||
| name: {{ printf "%s-cnpg-superuser-secret" .Release.Name | trunc 63 | trimSuffix "-" | quote }} | ||
| {{ end }} | ||
|
|
||
| {{- with .Values.cluster.resources }} | ||
| resources: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{ end }} | ||
|
|
||
| storage: | ||
| size: {{ .Values.cluster.storage.size | quote }} | ||
| storageClass: {{ .Values.cluster.storage.storageClass | quote }} | ||
|
|
||
| walStorage: | ||
| size: {{ .Values.cluster.walStorage.size | quote }} | ||
| storageClass: {{ .Values.cluster.walStorage.storageClass | quote }} | ||
|
|
||
| {{- if $backup.enabled }} | ||
| backup: | ||
| retentionPolicy: {{ $backup.retentionPolicy | quote }} | ||
| barmanObjectStore: | ||
| serverName: {{ printf "%s-cnpg-backup" .Release.Name | trunc 63 | trimSuffix "-" | quote }} | ||
| destinationPath: {{ $bos.destinationPath | quote }} | ||
| endpointURL: {{ $bos.endpointURL | quote }} | ||
| s3Credentials: | ||
| accessKeyId: | ||
| name: {{ $s3SecretName | quote }} | ||
| key: {{ default "S3_ACCESS_KEY" $s3.accessKeyKey | quote }} | ||
| secretAccessKey: | ||
| name: {{ $s3SecretName | quote }} | ||
| key: {{ default "S3_SECRET_KEY" $s3.secretKeyKey | quote }} | ||
| data: | ||
| compression: {{ $bos.compression.data | quote }} | ||
| wal: | ||
| compression: {{ $bos.compression.wal | quote }} | ||
| {{ end }} | ||
|
|
||
| {{- if .Values.bootstrap.enabled }} | ||
| bootstrap: | ||
| initdb: | ||
| {{- toYaml .Values.bootstrap.initdb | nindent 6 }} | ||
| secret: | ||
| name: {{ printf "%s-cnpg-app-creds" .Release.Name | trunc 63 | trimSuffix "-" | quote }} | ||
| {{ end }} | ||
| {{ end }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| {{- if and .Values.enabled .Values.scheduledBackup.enabled }} | ||
| apiVersion: postgresql.cnpg.io/v1 | ||
| kind: ScheduledBackup | ||
| metadata: | ||
| name: {{ printf "%s-scheduled-backup" .Release.Name | trunc 63 | trimSuffix "-" | quote }} | ||
| spec: | ||
| schedule: {{ .Values.scheduledBackup.schedule | quote }} | ||
| backupOwnerReference: {{ .Values.scheduledBackup.backupOwnerReference | quote }} | ||
| cluster: | ||
| name: {{ printf "%s-cnpg" .Release.Name | trunc 63 | trimSuffix "-" | quote }} | ||
| immediate: {{ .Values.scheduledBackup.immediate }} | ||
| {{- end }} | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| {{- if and .Values.enabled .Values.superuser.enabled }} | ||
| {{- $secretName := printf "%s-cnpg-superuser-secret" .Release.Name | trunc 63 | trimSuffix "-" }} | ||
| {{- $existing := lookup "v1" "Secret" .Release.Namespace $secretName }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: {{ $secretName | quote }} | ||
| type: {{ default "kubernetes.io/basic-auth" }} | ||
| stringData: | ||
| username: postgres | ||
| password: {{- if .Values.superuser.password }} | ||
| {{ .Values.superuser.password | quote }} | ||
| {{- else if $existing }} | ||
| {{ index $existing.data "password" | b64dec | quote }} | ||
| {{- else }} | ||
| {{ randAlphaNum 32 | quote }} | ||
| {{- end }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| {{- if and .Values.enabled .Values.postgresAuth.create }} | ||
| {{- $secretName := printf "%s-cnpg-app-creds" .Release.Name | trunc 63 | trimSuffix "-" }} | ||
| {{- $existing := lookup "v1" "Secret" .Release.Namespace $secretName }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: {{ $secretName | quote }} | ||
| type: {{ .Values.postgresAuth.type | default "kubernetes.io/basic-auth" }} | ||
| stringData: | ||
| username: {{ .Values.postgresAuth.username | quote }} | ||
| password: {{- if .Values.postgresAuth.password }} | ||
| {{ .Values.postgresAuth.password | quote }} | ||
| {{- else if $existing }} | ||
| {{ index $existing.data "password" | b64dec | quote }} | ||
| {{- else }} | ||
| {{ randAlphaNum 32 | quote }} | ||
| {{- end }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| {{- $s3 := .Values.backup.barmanObjectStore.s3Credentials -}} | ||
| {{- if and .Values.enabled .Values.backup.enabled ($s3.create) }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: {{ printf "%s-cnpg-s3-creds" .Release.Name | trunc 63 | trimSuffix "-" | quote }} | ||
| type: Opaque | ||
| stringData: | ||
| {{ default "S3_ACCESS_KEY" $s3.accessKeyKey }}: {{ required "accessKeyValue required when create=true" $s3.accessKeyValue | quote }} | ||
| {{ default "S3_SECRET_KEY" $s3.secretKeyKey }}: {{ required "secretKeyValue required when create=true" $s3.secretKeyValue | quote }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| enabled: true | ||
|
|
||
| superuser: | ||
| enabled: true | ||
|
|
||
| cluster: | ||
| imageName: ghcr.io/cloudnative-pg/postgresql:16.8-13-bullseye | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The image tag imageName: ghcr.io/cloudnative-pg/postgresql:16.2 |
||
| instances: 3 | ||
| storage: | ||
| size: 5Gi | ||
| storageClass: standard | ||
| walStorage: | ||
| size: 2Gi | ||
| storageClass: standard | ||
| resources: | ||
| requests: | ||
| cpu: "500m" | ||
| memory: "1Gi" | ||
| limits: | ||
| cpu: "2" | ||
| memory: "4Gi" | ||
|
|
||
| postgresAuth: | ||
| create: true | ||
| username: | ||
| password: | ||
|
|
||
| backup: | ||
| enabled: true | ||
| retentionPolicy: "7d" | ||
| barmanObjectStore: | ||
| destinationPath: s3://postgres-backups/ | ||
| endpointURL: https://opsta.in.th/buckets/ | ||
| s3Credentials: | ||
| create: false | ||
| accessKeyValue: | ||
| secretKeyValue: | ||
| compression: | ||
| data: gzip | ||
| wal: gzip | ||
|
|
||
| scheduledBackup: | ||
| enabled: true | ||
| schedule: "0 0 * * *" | ||
| backupOwnerReference: self | ||
| immediate: true | ||
|
|
||
| bootstrap: | ||
| enabled: true | ||
| initdb: | ||
| database: cnpg | ||
| owner: cnpg | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maintainer information appears to be using placeholder values. Please update this section with the actual maintainer's details for proper ownership and contact purposes.