-
Notifications
You must be signed in to change notification settings - Fork 0
Initialize repository #1
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
17 commits
Select commit
Hold shift + click to select a range
151e8c6
Add chart
yannick-roeder 0bb2a3a
Add CI and versioning
yannick-roeder 32a7c44
Add CI and versioning
yannick-roeder a289cf9
Add CI and versioning
yannick-roeder c12a501
Add CI and versioning
yannick-roeder 2de8efc
Add CI and versioning
yannick-roeder b0f7234
Change dev suffix
yannick-roeder 500ee25
Add README
yannick-roeder 7066f30
Address feedback
yannick-roeder acc4dd9
Address feedback
yannick-roeder 086d1ed
Address feedback
yannick-roeder 8762ea9
Address feedback
yannick-roeder 39d64d7
Address feedback
yannick-roeder cc09a7e
Address feedback
yannick-roeder aa9de38
Address feedback
yannick-roeder 831fcf7
Address feedback
yannick-roeder a8b5a91
Address feedback
yannick-roeder 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,10 @@ | ||
| [bumpversion] | ||
| current_version = 0.1.0 | ||
| parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<suffix>\w+))? | ||
| serialize = | ||
| {major}.{minor}.{patch}-{suffix} | ||
| {major}.{minor}.{patch} | ||
|
|
||
| [bumpversion:file:charts/cnpg-database/Chart.yaml] | ||
| search = version: {current_version} | ||
| replace = version: {new_version} |
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 @@ | ||
| target-branch: "main" |
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,39 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
|
|
||
| jobs: | ||
| get-version: | ||
| name: Get Version | ||
| runs-on: ubuntu-24.04 | ||
| outputs: | ||
| version: ${{ steps.get-version.outputs.version }} | ||
| steps: | ||
| - name: Check out repository | ||
| uses: bakdata/ci-templates/actions/checkout@1.69.2 | ||
|
|
||
| - name: Get version | ||
| id: get-version | ||
| shell: bash | ||
| env: | ||
| DEFAULT_BRANCH: refs/heads/${{ github.event.repository.default_branch }} | ||
| run: | | ||
| version=$(sed -n 's/^current_version = \(\.*\)/\1/p' < .bumpversion.cfg) | ||
| if [[ "${GITHUB_REF}" != refs/tags/* ]]; then | ||
| version="${version}-dev" | ||
| fi | ||
| echo "version=${version}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| build-and-publish: | ||
| name: Helm | ||
| uses: bakdata/ci-templates/.github/workflows/helm-multi-release.yaml@1.69.2 | ||
| needs: get-version | ||
| with: | ||
| charts-path: "charts" | ||
| subdirs: "['cnpg-database']" | ||
| version: ${{ needs.get-version.outputs.version }} | ||
| secrets: | ||
| github-username: ${{ secrets.GH_USERNAME }} | ||
| github-email: ${{ secrets.GH_EMAIL }} | ||
| github-token: ${{ secrets.GH_TOKEN }} |
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,25 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| release-type: | ||
| description: "Scope of the release." | ||
| type: choice | ||
| required: true | ||
| default: patch | ||
| options: | ||
| - patch | ||
| - minor | ||
| - major | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release | ||
| uses: bakdata/ci-templates/.github/workflows/bump-version-release.yaml@1.35.1 | ||
| with: | ||
| release-type: "${{ github.event.inputs.release-type }}" | ||
| secrets: | ||
| github-username: "${{ secrets.GH_USERNAME }}" | ||
| github-email: "${{ secrets.GH_EMAIL }}" | ||
| github-token: "${{ secrets.GH_TOKEN }}" |
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,4 @@ | ||
| .* | ||
| !.github | ||
| !.gitignore | ||
| !.bumpversion.cfg |
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 |
|---|---|---|
| @@ -1,2 +1,11 @@ | ||
| # cnpg-database-helm-chart | ||
| Helm chart for a CNPG database | ||
|
|
||
| Helm chart for deploying a CNPG database | ||
|
|
||
| ## Install | ||
|
|
||
| ```shell | ||
| helm repo add cnpg-database https://bakdata.github.io/cnpg-database-helm-chart/ | ||
| helm repo update | ||
| helm install cnpg-database/cnpg-database | ||
| ``` |
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,23 @@ | ||
| # Patterns to ignore when building packages. | ||
| # This supports shell glob matching, relative path matching, and | ||
| # negation (prefixed with !). Only one pattern per line. | ||
| .DS_Store | ||
| # Common VCS dirs | ||
| .git/ | ||
| .gitignore | ||
| .bzr/ | ||
| .bzrignore | ||
| .hg/ | ||
| .hgignore | ||
| .svn/ | ||
| # Common backup files | ||
| *.swp | ||
| *.bak | ||
| *.tmp | ||
| *.orig | ||
| *~ | ||
| # Various IDEs | ||
| .project | ||
| .idea/ | ||
| *.tmproj | ||
| .vscode/ |
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,8 @@ | ||
| apiVersion: v2 | ||
| name: cnpg-database | ||
| description: A Helm chart for deploying a CNPG database | ||
| version: 0.1.0 | ||
| maintainers: | ||
| - name: bakdata | ||
| email: opensource@bakdata.com | ||
| url: bakdata.com |
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,62 @@ | ||
| {{/* | ||
| Expand the name of the chart. | ||
| */}} | ||
| {{- define "cnpg-database.name" -}} | ||
| {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create a default fully qualified app name. | ||
| We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
| If release name contains chart name it will be used as a full name. | ||
| */}} | ||
| {{- define "cnpg-database.fullname" -}} | ||
| {{- if .Values.fullnameOverride }} | ||
| {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- $name := default .Chart.Name .Values.nameOverride }} | ||
| {{- if contains $name .Release.Name }} | ||
| {{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create chart name and version as used by the chart label. | ||
| */}} | ||
| {{- define "cnpg-database.chart" -}} | ||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels | ||
| */}} | ||
| {{- define "cnpg-database.labels" -}} | ||
| helm.sh/chart: {{ include "cnpg-database.chart" . }} | ||
| {{ include "cnpg-database.selectorLabels" . }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Selector labels | ||
| */}} | ||
| {{- define "cnpg-database.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "cnpg-database.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create the name of the service account to use | ||
| */}} | ||
| {{- define "cnpg-database.serviceAccountName" -}} | ||
| {{- if .Values.serviceAccount.create }} | ||
| {{- default (include "cnpg-database.fullname" .) .Values.serviceAccount.name }} | ||
| {{- else }} | ||
| {{- default "default" .Values.serviceAccount.name }} | ||
| {{- 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 |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/datreeio/CRDs-catalog/refs/heads/main/postgresql.cnpg.io/cluster_v1.json | ||
| apiVersion: postgresql.cnpg.io/v1 | ||
| kind: Cluster | ||
| metadata: | ||
| name: {{ include "cnpg-database.fullname" . }} | ||
| labels: | ||
| {{- include "cnpg-database.labels" . | nindent 4 }} | ||
| {{- with .Values.postgres.annotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| {{- if .Values.postgres.description }} | ||
| description: {{ .Values.postgres.description }} | ||
| {{- end }} | ||
| instances: {{ .Values.postgres.instances }} | ||
| imageName: "{{ .Values.postgres.image.repository }}:{{ .Values.postgres.image.tag }}" | ||
| enablePDB: {{ .Values.postgres.enablePDB }} | ||
| enableSuperuserAccess: {{ .Values.postgres.enableSuperuserAccess }} | ||
| {{- with .Values.postgres.resources }} | ||
| resources: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| storage: | ||
| storageClass: {{ .Values.postgres.storage.class }} | ||
| resizeInUseVolumes: {{ .Values.postgres.storage.data.resizeInUseVolume }} | ||
| size: {{ .Values.postgres.storage.data.size }} | ||
| walStorage: | ||
| storageClass: {{ .Values.postgres.storage.class }} | ||
| size: {{ .Values.postgres.storage.wal.size }} | ||
| resizeInUseVolumes: {{ .Values.postgres.storage.wal.resizeInUseVolume }} | ||
| {{- if .Values.postgres.bootstrap.recovery.enabled }} | ||
| bootstrap: | ||
| recovery: | ||
| source: {{ .Values.postgres.bootstrap.recovery.name | default (include "cnpg-database.fullname" .) | quote }} | ||
| database: {{ .Values.postgres.bootstrap.database }} | ||
| owner: {{ .Values.postgres.bootstrap.owner }} | ||
| externalClusters: | ||
| - name: {{ .Values.postgres.bootstrap.recovery.name | default (include "cnpg-database.fullname" .) | quote }} | ||
| barmanObjectStore: | ||
| serverName: {{ .Values.postgres.bootstrap.recovery.name | default (include "cnpg-database.fullname" .) | quote }} | ||
| destinationPath: {{ .Values.backup.s3.destinationPath | quote }} | ||
| endpointURL: {{ .Values.backup.s3.endpointURL | quote }} | ||
| {{- if and .Values.backup.trustBundleName .Values.backup.trustBundleKey }} | ||
| endpointCA: | ||
| name: {{ .Values.backup.trustBundleName }} | ||
| key: {{ .Values.backup.trustBundleKey }} | ||
| {{- end }} | ||
| s3Credentials: | ||
| accessKeyId: | ||
| key: S3_ACCESS_KEY | ||
| name: {{ include "cnpg-database.fullname" . }}-s3 | ||
| secretAccessKey: | ||
| key: S3_SECRET_KEY | ||
| name: {{ include "cnpg-database.fullname" . }}-s3 | ||
| {{- else }} | ||
| bootstrap: | ||
| initdb: | ||
| database: {{ .Values.postgres.bootstrap.database }} | ||
| owner: {{ .Values.postgres.bootstrap.owner }} | ||
| {{- end }} | ||
| {{- with .Values.postgres.parameters }} | ||
| postgresql: | ||
| parameters: | ||
| {{- toYaml . | nindent 6 }} | ||
| {{- end }} | ||
| {{- if or .Values.postgres.groups .Values.postgres.users }} | ||
| managed: | ||
| roles: | ||
| {{- range .Values.postgres.groups }} | ||
| - name: {{ . | quote }} | ||
| ensure: present | ||
| {{- end }} | ||
| {{- range .Values.postgres.users }} | ||
| - name: {{ .username | quote }} | ||
| ensure: present | ||
| login: true | ||
| passwordSecret: | ||
| name: {{ printf "%s-creds-%s" (include "cnpg-database.fullname" $) .username | replace "." "-" | trunc 63 | quote }} | ||
| {{- with .inRoles }} | ||
| inRoles: | ||
| {{- range . }} | ||
| - {{ . | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .Values.backup.enabled }} | ||
| backup: | ||
| retentionPolicy: {{ .Values.backup.retentionPolicy }} | ||
| target: {{ .Values.backup.target }} | ||
| barmanObjectStore: | ||
yannick-roeder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| serverName: {{ .Values.backup.name | default (include "cnpg-database.fullname" .) | quote }} | ||
| data: | ||
| compression: {{ .Values.backup.data.compression }} | ||
| destinationPath: {{ .Values.backup.s3.destinationPath }} | ||
| endpointURL: {{ .Values.backup.s3.endpointURL }} | ||
| {{- if and .Values.backup.trustBundleName .Values.backup.trustBundleKey }} | ||
| endpointCA: | ||
| name: {{ .Values.backup.trustBundleName }} | ||
| key: {{ .Values.backup.trustBundleKey }} | ||
| {{- end }} | ||
| s3Credentials: | ||
| accessKeyId: | ||
| key: S3_ACCESS_KEY | ||
| name: {{ include "cnpg-database.fullname" . }}-s3 | ||
| secretAccessKey: | ||
| key: S3_SECRET_KEY | ||
| name: {{ include "cnpg-database.fullname" . }}-s3 | ||
| wal: | ||
| compression: {{ .Values.backup.wal.compression }} | ||
| {{- with .Values.backup.wal.maxParallel }} | ||
| maxParallel: {{ . }} | ||
| {{- end }} | ||
| {{- with .Values.backup.wal.encryption }} | ||
| encryption: {{ . }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if or .Values.postgres.serverCASecret .Values.postgres.serverTLSSecret }} | ||
| certificates: | ||
| {{- with .Values.postgres.serverCASecret }} | ||
| serverCASecret: {{ . }} | ||
| {{- end }} | ||
| {{- with .Values.postgres.serverTLSSecret }} | ||
| serverTLSSecret: {{ . }} | ||
| {{- 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 |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| {{- if .Values.podMonitor.enabled }} | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/datreeio/CRDs-catalog/refs/heads/main/monitoring.coreos.com/podmonitor_v1.json | ||
| apiVersion: monitoring.coreos.com/v1 | ||
| kind: PodMonitor | ||
| metadata: | ||
| name: {{ include "cnpg-database.fullname" . }} | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| cnpg.io/cluster: {{ include "cnpg-database.fullname" . }} | ||
| podMetricsEndpoints: | ||
| - port: metrics | ||
| {{- 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 |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| {{- if .Values.backup.enabled }} | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/datreeio/CRDs-catalog/refs/heads/main/postgresql.cnpg.io/scheduledbackup_v1.json | ||
| apiVersion: postgresql.cnpg.io/v1 | ||
| kind: ScheduledBackup | ||
| metadata: | ||
| name: {{ include "cnpg-database.fullname" . }} | ||
| {{- with .Values.backup.annotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| suspend: {{.Values.backup.suspend }} | ||
| schedule: {{ .Values.backup.schedule | quote }} | ||
| immediate: {{ .Values.backup.immediate }} | ||
| backupOwnerReference: self | ||
| cluster: | ||
| name: {{ include "cnpg-database.fullname" . }} | ||
| {{- 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 |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| {{- if .Values.backup.enabled }} | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/datreeio/CRDs-catalog/refs/heads/main/bitnami.com/sealedsecret_v1alpha1.json | ||
| apiVersion: bitnami.com/v1alpha1 | ||
| kind: SealedSecret | ||
| metadata: | ||
| name: {{ include "cnpg-database.fullname" . }}-s3 | ||
| annotations: | ||
| sealedsecrets.bitnami.com/namespace-wide: "true" | ||
| labels: | ||
| {{- include "cnpg-database.labels" . | nindent 4 }} | ||
| spec: | ||
| encryptedData: | ||
| S3_ACCESS_KEY: {{.Values.backup.s3.accessKey }} | ||
| S3_SECRET_KEY: {{.Values.backup.s3.secretKey }} | ||
| template: | ||
| metadata: | ||
| annotations: | ||
| cnpg.io/reload: "true" | ||
| {{- 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 |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| {{- with .Values.postgres.users }} | ||
| {{- range . }} | ||
| --- | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/datreeio/CRDs-catalog/refs/heads/main/bitnami.com/sealedsecret_v1alpha1.json | ||
| apiVersion: bitnami.com/v1alpha1 | ||
| kind: SealedSecret | ||
| metadata: | ||
| name: {{ printf "%s-creds-%s" (include "cnpg-database.fullname" $) .username | replace "." "-" | trunc 63 | quote }} | ||
| annotations: | ||
| sealedsecrets.bitnami.com/namespace-wide: "true" | ||
| spec: | ||
| encryptedData: | ||
| password: {{ .password | quote }} | ||
| template: | ||
| metadata: | ||
yannick-roeder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| annotations: | ||
| cnpg.io/reload: "true" | ||
| type: kubernetes.io/basic-auth | ||
| data: | ||
| username: {{ .username | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
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.