diff --git a/apps/infra/data/cloudnative-pg/barman-objectstore.yaml b/apps/infra/data/cloudnative-pg/barman-objectstore.yaml new file mode 100644 index 0000000..d92b4d5 --- /dev/null +++ b/apps/infra/data/cloudnative-pg/barman-objectstore.yaml @@ -0,0 +1,19 @@ +apiVersion: barmancloud.cnpg.io/v1 +kind: ObjectStore +metadata: + name: devcm-hw + namespace: infra-data +spec: + retentionPolicy: "7d" + configuration: + destinationPath: s3://devcm/cnpg/ + endpointURL: https://obs.cn-east-3.myhuaweicloud.com + s3Credentials: + accessKeyId: + name: s3-devcm-hw + key: ACCESS_KEY_ID + secretAccessKey: + name: s3-devcm-hw + key: ACCESS_SECRET_KEY + wal: + compression: gzip \ No newline at end of file diff --git a/apps/infra/data/cloudnative-pg/cnpg17-cluster-hk.yaml b/apps/infra/data/cloudnative-pg/cnpg17-cluster-hk.yaml index 1f97070..fca3b7c 100644 --- a/apps/infra/data/cloudnative-pg/cnpg17-cluster-hk.yaml +++ b/apps/infra/data/cloudnative-pg/cnpg17-cluster-hk.yaml @@ -6,14 +6,21 @@ metadata: spec: affinity: nodeAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - preference: - matchExpressions: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: - key: topology.kubernetes.io/region operator: In values: - - cn-hk - weight: 1 + - "cn-hk" + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - clawhk instances: 1 imageName: ghcr.io/cloudnative-pg/postgresql:17.4 enableSuperuserAccess: true @@ -22,30 +29,3 @@ spec: postgresql: parameters: archive_timeout: 30min - backup: - retentionPolicy: "7d" - barmanObjectStore: - destinationPath: s3://devcm/cnpg/ - endpointURL: https://obs.cn-east-3.myhuaweicloud.com - s3Credentials: - accessKeyId: - name: s3-devcm-hw - key: ACCESS_KEY_ID - secretAccessKey: - name: s3-devcm-hw - key: ACCESS_SECRET_KEY - wal: - compression: gzip - ---- -apiVersion: postgresql.cnpg.io/v1 -kind: ScheduledBackup -metadata: - name: cnpg17-cluster-hk-backups - namespace: infra-data -spec: - schedule: "0 0 0 * * *" - immediate: true - backupOwnerReference: self - cluster: - name: cnpg17-cluster-hk diff --git a/apps/infra/data/cloudnative-pg/cnpg17-cluster-sh.yaml b/apps/infra/data/cloudnative-pg/cnpg17-cluster-sh.yaml index a1ac1da..542fa0f 100644 --- a/apps/infra/data/cloudnative-pg/cnpg17-cluster-sh.yaml +++ b/apps/infra/data/cloudnative-pg/cnpg17-cluster-sh.yaml @@ -6,14 +6,21 @@ metadata: spec: affinity: nodeAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - preference: - matchExpressions: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: - key: topology.kubernetes.io/region operator: In values: - - cn-sh - weight: 1 + - "cn-sh" + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - homea instances: 1 imageName: ghcr.io/cloudnative-pg/postgresql:17.4 enableSuperuserAccess: true @@ -21,31 +28,4 @@ spec: size: 10Gi postgresql: parameters: - archive_timeout: 30min - backup: - retentionPolicy: "7d" - barmanObjectStore: - destinationPath: s3://devcm/cnpg/ - endpointURL: https://obs.cn-east-3.myhuaweicloud.com - s3Credentials: - accessKeyId: - name: s3-devcm-hw - key: ACCESS_KEY_ID - secretAccessKey: - name: s3-devcm-hw - key: ACCESS_SECRET_KEY - wal: - compression: gzip - ---- -apiVersion: postgresql.cnpg.io/v1 -kind: ScheduledBackup -metadata: - name: cnpg17-cluster-sh-backups - namespace: infra-data -spec: - schedule: "0 0 0 * * *" - immediate: true - backupOwnerReference: self - cluster: - name: cnpg17-cluster-sh + archive_timeout: 30min \ No newline at end of file diff --git a/apps/infra/data/cloudnative-pg/helmchart-plugin-barman.yaml b/apps/infra/data/cloudnative-pg/helmchart-plugin-barman.yaml new file mode 100644 index 0000000..8998909 --- /dev/null +++ b/apps/infra/data/cloudnative-pg/helmchart-plugin-barman.yaml @@ -0,0 +1,25 @@ +apiVersion: helm.cattle.io/v1 +kind: HelmChart +metadata: + name: cloudnative-pg-plugin-barman + namespace: infra-data +spec: + repo: https://cloudnative-pg.github.io/charts + chart: plugin-barman-cloud + targetNamespace: infra-data + version: 0.5.0 + valuesContent: |- + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: topology.kubernetes.io/region + operator: In + values: + - "cn-sh" + tolerations: + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + diff --git a/apps/infra/data/cloudnative-pg/helmchart.yaml b/apps/infra/data/cloudnative-pg/helmchart.yaml index cdf1865..1c8a2ce 100644 --- a/apps/infra/data/cloudnative-pg/helmchart.yaml +++ b/apps/infra/data/cloudnative-pg/helmchart.yaml @@ -7,7 +7,7 @@ spec: repo: https://cloudnative-pg.github.io/charts chart: cloudnative-pg targetNamespace: infra-data - version: 0.25.0 + version: 0.27.1 valuesContent: |- affinity: nodeAffinity: @@ -22,6 +22,4 @@ spec: - key: "node-role.kubernetes.io/control-plane" operator: "Exists" effect: "NoSchedule" - image: - tag: "1.25.3" diff --git a/apps/infra/data/cloudnative-pg/loadbalancer-sh.yaml b/apps/infra/data/cloudnative-pg/loadbalancer-sh.yaml index 7b17866..04ef4dc 100644 --- a/apps/infra/data/cloudnative-pg/loadbalancer-sh.yaml +++ b/apps/infra/data/cloudnative-pg/loadbalancer-sh.yaml @@ -9,6 +9,6 @@ spec: role: primary ports: - protocol: TCP - port: 65432 + port: 65431 targetPort: 5432 type: LoadBalancer