Skip to content

Commit a20277b

Browse files
feat: add barman plugin and fix CI
1 parent a3338c1 commit a20277b

File tree

21 files changed

+199
-58
lines changed

21 files changed

+199
-58
lines changed

.github/workflows/test-deployment.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ jobs:
4949
conda create -y -n rspy python=3.11
5050
5151
# Install Ansible, Terraform, Openstackclient
52-
conda run -n rspy conda install -y -c conda-forge ansible terraform python-openstackclient passlib boto3 kubernetes-helm kubernetes-client python-kubernetes
52+
conda run -n rspy conda install -y -c conda-forge "ansible<12" terraform python-openstackclient passlib boto3 kubernetes-helm kubernetes-client python-kubernetes
53+
54+
conda run -n rspy ansible-galaxy collection install openstack.cloud amazon.aws kubernetes.core community.general
5355
54-
conda run -n rspy ansible-galaxy collection install openstack.cloud amazon.aws kubernetes.core
5556
ln -s /usr/share/miniconda/envs/rspy/bin/kubectl /usr/local/bin/kubectl
5657
shell: bash
5758
- name: Start minikube
@@ -81,7 +82,15 @@ jobs:
8182
run: |
8283
sed -i 's!debug: false!debug: true!g' roles/app-installer/tasks/install_app.yaml
8384
sed -i 's!cinder.csi.openstack.org!k8s.io/minikube-hostpath!g' apps/00-storage-class/sc-retain.yaml
84-
sed -i 's!instances: 3!instances: 2!g' apps/01-cloudnative-pg/cluster.yaml
85+
sed -i 's!instances: 3!instances: 1!g' apps/03-cloudnative-pg/cluster.yaml
8586
sed -i -e 's!https://iam.{{ platform_domain_name }}!http://keycloak-service.iam.svc.cluster.local:8080!g' -e 's!insecure_oidc_skip_issuer_verification="false"!insecure_oidc_skip_issuer_verification="true"!g' apps/oauth2-proxy/values.yaml
87+
88+
# Minio for cloudnative pg
89+
sed -i -e 's!{{ s3.access_key }}!access_key!' -e 's!{{ s3.secret_key }}!secret_key!' apps/03-cloudnative-pg/secrets.yaml
90+
sed -i -e 's!{{ postgresql.bucket }}!bucket!' -e 's!{{ s3.endpoint }}!http://minio.minio.svc.cluster.local:9000!' apps/03-cloudnative-pg/objectstore.yaml
91+
helm repo add minio https://charts.min.io/
92+
helm repo update minio
93+
helm install minio minio/minio --namespace minio --set mode=standalone --set persistence.enabled=false --set resources.requests.memory=1Gi --set rootUser=access_key --set rootPassword=secret_key --set buckets[0].name=bucket --create-namespace --wait
94+
8695
conda run -n rspy --no-capture-output env PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=1 ansible-playbook apps.yaml -i inventory/mycluster/hosts.yaml
8796
shell: bash

apps/00-crds-cloudnative-pg/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ resources:
2424
- https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/refs/tags/v1.27.0/config/crd/bases/postgresql.cnpg.io_publications.yaml
2525
- https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/refs/tags/v1.27.0/config/crd/bases/postgresql.cnpg.io_subscriptions.yaml
2626
- https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/refs/tags/v1.27.0/config/crd/bases/postgresql.cnpg.io_failoverquorums.yaml
27+
- https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/tags/v0.6.0/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml
2728
apiVersion: kustomize.config.k8s.io/v1beta1
2829
kind: Kustomization
2930
labels:

apps/01-cert-manager/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ cainjector:
4141
- key: "node-role.kubernetes.io/infra"
4242
operator: Exists
4343

44-
4544
affinity:
4645
nodeAffinity:
4746
requiredDuringSchedulingIgnoredDuringExecution:
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2024 CS Group
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
namespace: database
16+
17+
apiVersion: kustomize.config.k8s.io/v1beta1
18+
kind: Kustomization
19+
labels:
20+
- includeSelectors: true
21+
includeTemplates: true
22+
pairs:
23+
app.kubernetes.io/instance: '{{ app_name }}'
24+
wait-for-deployment: Ready
25+
resources:
26+
- https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v0.6.0/manifest.yaml

apps/01-cloudnative-pg/cluster.yaml renamed to apps/03-cloudnative-pg/cluster.yaml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,11 @@ spec:
2424

2525
enableSuperuserAccess: true
2626

27-
backup:
28-
barmanObjectStore:
29-
destinationPath: s3://{{ postgresql.bucket }}/postgresql-cluster/
30-
endpointURL: {{ s3.endpoint }}
31-
s3Credentials:
32-
accessKeyId:
33-
key: AK
34-
name: psql-backup-obs
35-
secretAccessKey:
36-
key: SK
37-
name: psql-backup-obs
38-
retentionPolicy: "10d"
27+
plugins:
28+
- name: barman-cloud.cloudnative-pg.io
29+
isWALArchiver: true
30+
parameters:
31+
barmanObjectName: ovh-gra
3932

4033
postgresql:
4134
parameters:

apps/01-cloudnative-pg/kustomization.yaml renamed to apps/03-cloudnative-pg/kustomization.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
1615
namespace: database
1716

1817
helmCharts:
@@ -26,8 +25,11 @@ helmCharts:
2625
resources:
2726
- cluster.yaml
2827
- configmap-create-database.yaml
29-
- secrets.yaml
28+
- objectstore.yaml
3029
- scheduled-backup.yaml
30+
- secrets.yaml
31+
- servicemonitor.yaml
32+
3133
apiVersion: kustomize.config.k8s.io/v1beta1
3234
kind: Kustomization
3335
labels:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2024 CS Group
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: barmancloud.cnpg.io/v1
16+
kind: ObjectStore
17+
metadata:
18+
name: ovh-gra
19+
spec:
20+
configuration:
21+
destinationPath: s3://{{ postgresql.bucket }}/postgresql-cluster/
22+
endpointURL: {{ s3.endpoint }}
23+
s3Credentials:
24+
accessKeyId:
25+
key: AK
26+
name: psql-backup-obs
27+
secretAccessKey:
28+
key: SK
29+
name: psql-backup-obs
30+
retentionPolicy: "10d"

apps/01-cloudnative-pg/scheduled-backup.yaml renamed to apps/03-cloudnative-pg/scheduled-backup.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@ apiVersion: postgresql.cnpg.io/v1
1616
kind: ScheduledBackup
1717
metadata:
1818
name: backup-postgresql-cluster
19+
labels:
20+
wait-for-deployment: Ready
1921
spec:
22+
immediate: true
2023
schedule: "0 0 11 * * *"
2124
backupOwnerReference: self
2225
cluster:
2326
name: postgresql-cluster
27+
method: plugin
28+
pluginConfiguration:
29+
name: barman-cloud.cloudnative-pg.io
File renamed without changes.

0 commit comments

Comments
 (0)