-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
938099f
CH-234 feat: Allow secrets with quotes
afonsobspinto 73fab33
chore: Apply linting
afonsobspinto cb52695
Merge branch 'develop' into feature/CH-234
filippomc 2cdd5ab
CH-256 feat: add PostgreSQL operator support
filippomc e75071b
Potential fix for pull request finding
filippomc d2ad88a
Potential fix for pull request finding
filippomc 8622f9c
CH-256 support database image replacement on operator
filippomc 73e756f
CH-256 remove default postgres image
filippomc bab3bca
CH-256 test fix
filippomc aefb84c
CH-256 Improve network policy with auto-discovery
filippomc 9f09581
Fix template variable access issue
filippomc 7d369fb
Merge branch 'develop' of github.com:MetaCell/cloud-harness into feat…
filippomc 0b89c20
Merge branch 'develop' into feature/CH-256-postgres-operator
filippomc b371fa2
Merge branch 'develop' into feature/CH-256-postgres-operator
filippomc 738201b
Merge branch 'develop' into feature/CH-256-postgres-operator
filippomc 1bea451
Merge branch 'feature/CH-234' of github.com:MetaCell/cloud-harness in…
filippomc 7757798
CH-234 improve quotes in yaml
filippomc 85c0715
CH-234 tests fix
filippomc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Dev container user configuration | ||
| # Copy this file to .env and customize as needed | ||
| # These values will bind the container user to your host user for seamless file sharing | ||
|
|
||
| # Your username (defaults to 'devuser' if not set) | ||
| USERNAME=${USER} | ||
|
|
||
| # Your user ID (run 'id -u' on host to get this) | ||
| USER_UID=1000 | ||
|
|
||
| # Your group ID (run 'id -g' on host to get this) | ||
| USER_GID=1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| home |
86 changes: 86 additions & 0 deletions
86
deployment-configuration/helm/templates/auto-database-postgres-operator.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.