Skip to content

Commit

Permalink
feat(cnpg): backup + default prod +improve debug (#379)
Browse files Browse the repository at this point in the history
Co-authored-by: Julien Bouquillon <julien.bouquillon@sg.social.gouv.fr>
  • Loading branch information
devthejo and Julien Bouquillon authored Jul 31, 2023
1 parent e019db2 commit a05cb2e
Show file tree
Hide file tree
Showing 18 changed files with 566 additions and 583 deletions.
2 changes: 1 addition & 1 deletion packages/kontinuous/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"node": "^16.17 || ^18 || ^20"
},
"scripts": {
"test": "NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest tests",
"test": "NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest tests --detectOpenHandles --forceExit",
"test:debug": "DEBUG=1 yarn test",
"test:update-snapshots": "yarn test -u",
"postinstall": "link-module-alias",
Expand Down
20 changes: 11 additions & 9 deletions packages/kontinuous/tests/__snapshots__/extends-ovh.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ spec:
- app
topologyKey: kubernetes.io/hostname
containers:
- image: harbor.fabrique.social.gouv.fr/test-extends-ovh/app:sha-ffac537e6cbbf934b08745a378932722df287a53
- image: harbor.fabrique.social.gouv.fr/fabrique/test-extends-ovh/app:sha-ffac537e6cbbf934b08745a378932722df287a53
name: app
ports:
- containerPort: 3000
Expand Down Expand Up @@ -557,10 +557,10 @@ kind: Cluster
metadata:
name: pg-hasura
labels:
helm.sh/chart: cnpg-cluster-1.8.0
helm.sh/chart: cnpg-cluster-1.9.1
app.kubernetes.io/name: pg-hasura
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: 14.5-6
app.kubernetes.io/version: \\"15\\"
app.kubernetes.io/managed-by: Helm
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
kontinuous/deployment.env: test-extends-ovh-feature-branch-1
Expand All @@ -571,6 +571,7 @@ metadata:
app.kubernetes.io/manifest-managed-by: kontinuous
app.kubernetes.io/manifest-created-by: kontinuous
annotations:
app.kubernetes.io/managed-by: Helm
kontinuous/chartPath: project.fabrique.pg-hasura.cnpg-cluster
kontinuous/source: project/charts/fabrique/charts/pg-hasura/charts/cnpg-cluster/templates/cluster.cnpg.yaml
kontinuous/plugin.needs: |
Expand Down Expand Up @@ -619,10 +620,10 @@ kind: Cluster
metadata:
name: pg-keycloak
labels:
helm.sh/chart: cnpg-cluster-1.8.0
helm.sh/chart: cnpg-cluster-1.9.1
app.kubernetes.io/name: pg-keycloak
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: 14.5-6
app.kubernetes.io/version: \\"15\\"
app.kubernetes.io/managed-by: Helm
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
kontinuous/deployment.env: test-extends-ovh-feature-branch-1
Expand All @@ -633,6 +634,7 @@ metadata:
app.kubernetes.io/manifest-managed-by: kontinuous
app.kubernetes.io/manifest-created-by: kontinuous
annotations:
app.kubernetes.io/managed-by: Helm
kontinuous/chartPath: project.fabrique.pg-keycloak.cnpg-cluster
kontinuous/source: project/charts/fabrique/charts/pg-keycloak/charts/cnpg-cluster/templates/cluster.cnpg.yaml
kontinuous/plugin.needs: |
Expand Down Expand Up @@ -681,10 +683,10 @@ kind: Pooler
metadata:
name: pg-hasura-rw
labels:
helm.sh/chart: cnpg-cluster-1.8.0
helm.sh/chart: cnpg-cluster-1.9.1
app.kubernetes.io/name: pg-hasura
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: 14.5-6
app.kubernetes.io/version: \\"15\\"
app.kubernetes.io/managed-by: Helm
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
kontinuous/deployment.env: test-extends-ovh-feature-branch-1
Expand Down Expand Up @@ -716,10 +718,10 @@ kind: Pooler
metadata:
name: pg-keycloak-rw
labels:
helm.sh/chart: cnpg-cluster-1.8.0
helm.sh/chart: cnpg-cluster-1.9.1
app.kubernetes.io/name: pg-keycloak
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: 14.5-6
app.kubernetes.io/version: \\"15\\"
app.kubernetes.io/managed-by: Helm
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
kontinuous/deployment.env: test-extends-ovh-feature-branch-1
Expand Down
116 changes: 105 additions & 11 deletions packages/kontinuous/tests/__snapshots__/extends-ovh.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ spec:
- app
topologyKey: kubernetes.io/hostname
containers:
- image: harbor.fabrique.social.gouv.fr/test-extends-ovh/app:prod
- image: harbor.fabrique.social.gouv.fr/fabrique/test-extends-ovh/app:prod
name: app
ports:
- containerPort: 3000
Expand Down Expand Up @@ -558,10 +558,10 @@ kind: Cluster
metadata:
name: pg-hasura
labels:
helm.sh/chart: cnpg-cluster-1.8.0
helm.sh/chart: cnpg-cluster-1.9.1
app.kubernetes.io/name: pg-hasura
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: 14.5-6
app.kubernetes.io/version: \\"15\\"
app.kubernetes.io/managed-by: Helm
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
kontinuous/deployment.env: test-extends-ovh-prod
Expand All @@ -572,6 +572,7 @@ metadata:
app.kubernetes.io/manifest-managed-by: kontinuous
app.kubernetes.io/manifest-created-by: kontinuous
annotations:
app.kubernetes.io/managed-by: Helm
kontinuous/chartPath: project.fabrique.pg-hasura.cnpg-cluster
kontinuous/source: project/charts/fabrique/charts/pg-hasura/charts/cnpg-cluster/templates/cluster.cnpg.yaml
kontinuous/plugin.needs: |
Expand All @@ -588,12 +589,27 @@ metadata:
kontinuous/plugin.log: \\"false\\"
namespace: test-extends-ovh
spec:
instances: 1
instances: 3
imageName: ghcr.io/cloudnative-pg/postgis:14
imagePullPolicy: IfNotPresent
storage:
size: 8Gi
storageClass: managed-csi
backup:
retentionPolicy: 60d
barmanObjectStore:
destinationPath: s3://fabrique-prod/test-extends-ovh
endpointURL: https://s3.gra.io.cloud.ovh.net
s3Credentials:
accessKeyId:
key: bucket_access_key
name: fabrique-prod-backups-access-key
region:
key: bucket_region
name: fabrique-prod-backups-access-key
secretAccessKey:
key: bucket_secret_key
name: fabrique-prod-backups-access-key
minSyncReplicas: 0
maxSyncReplicas: 0
postgresql: {}
Expand All @@ -620,10 +636,10 @@ kind: Cluster
metadata:
name: pg-keycloak
labels:
helm.sh/chart: cnpg-cluster-1.8.0
helm.sh/chart: cnpg-cluster-1.9.1
app.kubernetes.io/name: pg-keycloak
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: 14.5-6
app.kubernetes.io/version: \\"15\\"
app.kubernetes.io/managed-by: Helm
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
kontinuous/deployment.env: test-extends-ovh-prod
Expand All @@ -634,6 +650,7 @@ metadata:
app.kubernetes.io/manifest-managed-by: kontinuous
app.kubernetes.io/manifest-created-by: kontinuous
annotations:
app.kubernetes.io/managed-by: Helm
kontinuous/chartPath: project.fabrique.pg-keycloak.cnpg-cluster
kontinuous/source: project/charts/fabrique/charts/pg-keycloak/charts/cnpg-cluster/templates/cluster.cnpg.yaml
kontinuous/plugin.needs: |
Expand All @@ -650,12 +667,27 @@ metadata:
kontinuous/plugin.log: \\"false\\"
namespace: test-extends-ovh
spec:
instances: 1
instances: 3
imageName: ghcr.io/cloudnative-pg/postgis:14
imagePullPolicy: IfNotPresent
storage:
size: 8Gi
storageClass: managed-csi
backup:
retentionPolicy: 60d
barmanObjectStore:
destinationPath: s3://fabrique-prod/test-extends-ovh
endpointURL: https://s3.gra.io.cloud.ovh.net
s3Credentials:
accessKeyId:
key: bucket_access_key
name: fabrique-prod-backups-access-key
region:
key: bucket_region
name: fabrique-prod-backups-access-key
secretAccessKey:
key: bucket_secret_key
name: fabrique-prod-backups-access-key
minSyncReplicas: 0
maxSyncReplicas: 0
postgresql: {}
Expand Down Expand Up @@ -736,10 +768,10 @@ kind: Pooler
metadata:
name: pg-hasura-rw
labels:
helm.sh/chart: cnpg-cluster-1.8.0
helm.sh/chart: cnpg-cluster-1.9.1
app.kubernetes.io/name: pg-hasura
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: 14.5-6
app.kubernetes.io/version: \\"15\\"
app.kubernetes.io/managed-by: Helm
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
kontinuous/deployment.env: test-extends-ovh-prod
Expand Down Expand Up @@ -771,10 +803,10 @@ kind: Pooler
metadata:
name: pg-keycloak-rw
labels:
helm.sh/chart: cnpg-cluster-1.8.0
helm.sh/chart: cnpg-cluster-1.9.1
app.kubernetes.io/name: pg-keycloak
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: 14.5-6
app.kubernetes.io/version: \\"15\\"
app.kubernetes.io/managed-by: Helm
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
kontinuous/deployment.env: test-extends-ovh-prod
Expand All @@ -800,5 +832,67 @@ spec:
max_client_conn: \\"1000\\"
poolMode: session
type: rw
---
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: pg-hasura-scheduledbackup
labels:
helm.sh/chart: cnpg-cluster-1.9.1
app.kubernetes.io/name: pg-hasura
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
app.kubernetes.io/managed-by: Helm
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
kontinuous/deployment.env: test-extends-ovh-prod
kontinuous/ref: feature-branch-1
kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53
kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53
kontinuous/resourceName: scheduledbackup-pg-hasura-scheduledbackup-1vyq5go6
app.kubernetes.io/manifest-managed-by: kontinuous
app.kubernetes.io/manifest-created-by: kontinuous
annotations:
kontinuous/chartPath: project.fabrique.pg-hasura.cnpg-cluster
kontinuous/source: project/charts/fabrique/charts/pg-hasura/charts/cnpg-cluster/templates/scheduledbackup.cnpg.yaml
kontinuous/plugin.needs: |
- project.fabrique.pg-hasura.jobs-pg
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
namespace: test-extends-ovh
spec:
backupOwnerReference: self
cluster:
name: pg-hasura
schedule: 0 0 0 * * *
---
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: pg-keycloak-scheduledbackup
labels:
helm.sh/chart: cnpg-cluster-1.9.1
app.kubernetes.io/name: pg-keycloak
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
app.kubernetes.io/managed-by: Helm
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
kontinuous/deployment.env: test-extends-ovh-prod
kontinuous/ref: feature-branch-1
kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53
kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53
kontinuous/resourceName: scheduledbackup-pg-keycloak-scheduledbackup-3iywftai
app.kubernetes.io/manifest-managed-by: kontinuous
app.kubernetes.io/manifest-created-by: kontinuous
annotations:
kontinuous/chartPath: project.fabrique.pg-keycloak.cnpg-cluster
kontinuous/source: project/charts/fabrique/charts/pg-keycloak/charts/cnpg-cluster/templates/scheduledbackup.cnpg.yaml
kontinuous/plugin.needs: |
- project.fabrique.pg-keycloak.jobs-pg
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
namespace: test-extends-ovh
spec:
backupOwnerReference: self
cluster:
name: pg-keycloak
schedule: 0 0 0 * * *
"
`;
Loading

0 comments on commit a05cb2e

Please sign in to comment.