-
Notifications
You must be signed in to change notification settings - Fork 5
CH-256 feat: add PostgreSQL operator support #841
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
base: develop
Are you sure you want to change the base?
Changes from all commits
2cdd5ab
e75071b
d2ad88a
8622f9c
73e756f
bab3bca
aefb84c
9f09581
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,86 @@ | ||
| {{- define "deploy_utils.database.postgres.operator" }} | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: {{ printf "%s-credentials" .app.harness.database.name | quote }} | ||
| namespace: {{ .root.Values.namespace }} | ||
| labels: | ||
| app: {{ .app.harness.database.name | quote }} | ||
| {{ include "deploy_utils.labels" .root | indent 4 }} | ||
| type: kubernetes.io/basic-auth | ||
| stringData: | ||
| username: {{ .app.harness.database.user | quote }} | ||
| password: {{ .app.harness.database.pass | quote }} | ||
| --- | ||
| apiVersion: postgresql.cnpg.io/v1 | ||
| kind: Cluster | ||
| metadata: | ||
| name: {{ .app.harness.database.name | quote }} | ||
| namespace: {{ .root.Values.namespace }} | ||
| labels: | ||
| app: {{ .app.harness.database.name | quote }} | ||
| {{ include "deploy_utils.labels" .root | indent 4 }} | ||
| spec: | ||
| instances: {{ .app.harness.database.postgres.instances | default 1 }} | ||
|
|
||
| inheritedMetadata: | ||
| labels: | ||
| app: {{ .app.harness.database.name | quote }} | ||
| service: db | ||
|
|
||
| bootstrap: | ||
| initdb: | ||
| database: {{ .app.harness.database.postgres.initialdb | quote }} | ||
| owner: {{ .app.harness.database.user | quote }} | ||
| secret: | ||
| name: {{ printf "%s-credentials" .app.harness.database.name | quote }} | ||
|
|
||
| storage: | ||
| size: {{ .app.harness.database.size }} | ||
|
|
||
| {{- with .app.harness.database.resources }} | ||
| resources: | ||
| {{- with .requests }} | ||
| requests: | ||
| {{- with .memory }} | ||
| memory: {{ . | quote }} | ||
| {{- end }} | ||
| {{- with .cpu }} | ||
| cpu: {{ . | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- with .limits }} | ||
| limits: | ||
| {{- with .memory }} | ||
| memory: {{ . | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{- if .app.harness.database.image_ref }} | ||
| imageName: {{ index (index .app "task-images") .app.harness.database.image_ref | default ("Image ref not found!" | quote) }} | ||
| {{- else if .app.harness.database.postgres.image }} | ||
| imageName: {{ .app.harness.database.postgres.image | quote }} | ||
| {{- end }} | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: {{ .app.harness.database.name | quote }} | ||
| namespace: {{ .root.Values.namespace }} | ||
| labels: | ||
| app: {{ .app.harness.deployment.name | quote }} | ||
| {{ include "deploy_utils.labels" .root | indent 4 }} | ||
| spec: | ||
| type: {{ if .app.harness.database.expose }}LoadBalancer{{ else }}ClusterIP{{ end }} | ||
| selector: | ||
| app: {{ .app.harness.database.name | quote }} | ||
| cnpg.io/instanceRole: primary | ||
| ports: | ||
| {{- range $port := .app.harness.database.postgres.ports }} | ||
| - name: {{ $port.name }} | ||
| port: {{ $port.port }} | ||
| targetPort: 5432 | ||
| {{- end }} | ||
| {{- end }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,9 @@ spec: | |
| --- | ||
| {{- end }} | ||
| {{- define "deploy_utils.database" }} | ||
| {{- if and (eq .app.harness.database.type "postgres") .app.harness.database.postgres.operator }} | ||
| {{- include "deploy_utils.database.postgres.operator" . }} | ||
|
Collaborator
Author
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. another PR will address backups |
||
| {{- else }} | ||
| --- | ||
| kind: PersistentVolumeClaim | ||
| apiVersion: v1 | ||
|
|
@@ -105,6 +108,7 @@ spec: | |
| - name: {{ $port.name }} | ||
| port: {{ $port.port }} | ||
| {{- end }} | ||
| {{- end }} | ||
| --- | ||
| {{- include "deploy_utils.database_network_policy" (dict "root" .root "app" .app) }} | ||
| {{ end }} | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,6 @@ | ||
| harness: | ||
| database: {auto: true, type: postgres} | ||
| database: | ||
| auto: true | ||
| type: postgres | ||
| postgres: | ||
| image: postgres:17 |
Uh oh!
There was an error while loading. Please reload this page.