Skip to content

Commit 2b6058e

Browse files
authored
Merge branch 'main' into feature/add-replication-slots-conf
Signed-off-by: Itay Grudev <itay@verito.digital>
2 parents 4a2487e + dad28f5 commit 2b6058e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2182
-876
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Deploy a CNPG Cluster
2+
description: Deploys a CNPG Cluster
3+
inputs:
4+
namespace:
5+
description: 'The name of the namespace where the Cluster will be deployed'
6+
required: false
7+
default: 'default'
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Deploy a cluster
12+
shell: bash
13+
env:
14+
NAMESPACE: ${{ inputs.namespace }}
15+
run: |
16+
cat <<EOF | kubectl apply -f -
17+
# Example of PostgreSQL cluster
18+
apiVersion: postgresql.cnpg.io/v1
19+
kind: Cluster
20+
metadata:
21+
name: cluster-example
22+
namespace: $NAMESPACE
23+
spec:
24+
instances: 3
25+
storage:
26+
size: 1Gi
27+
EOF
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
name: Deploy the CNPG Operator
22
description: Deploys the CNPG Operator to a Kubernetes cluster
3+
inputs:
4+
namespace:
5+
description: 'The name of the namespace where the operator will be deployed'
6+
required: false
7+
default: 'cnpg-system'
8+
cluster-wide:
9+
description: 'If the operator should be deployed cluster-wide or in single-namespace mode'
10+
required: false
11+
default: 'true'
312
runs:
413
using: composite
514
steps:
615
- name: Deploy the operator
716
shell: bash
17+
env:
18+
NAMESPACE: ${{ inputs.namespace }}
19+
CLUSTER_WIDE: ${{ inputs.cluster-wide }}
820
run:
921
helm dependency update charts/cloudnative-pg
1022

1123
helm upgrade
1224
--install
13-
--namespace cnpg-system
25+
--namespace $NAMESPACE
1426
--create-namespace
27+
--set config.clusterWide=$CLUSTER_WIDE
1528
--wait
1629
cnpg charts/cloudnative-pg

.github/actions/setup-kind/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ runs:
1212
steps:
1313
- id: helm
1414
name: Set up Helm
15-
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
15+
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
1616
with:
17-
version: v3.6.2
17+
version: v3.16.2
1818

1919
- id: kubectl
2020
name: Install kubectl

.github/actions/verify-cluster-ready/action.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ inputs:
55
description: The name of the cluster to verify
66
required: true
77
default: database-cluster
8+
namespace:
9+
description: 'The name of the namespace where the Cluster is deployed'
10+
required: false
11+
default: 'default'
812
ready-instances:
913
description: The amount of ready instances to wait for
1014
required: true
@@ -15,15 +19,19 @@ runs:
1519
steps:
1620
- name: Wait for the cluster to become ready
1721
shell: bash
22+
env:
23+
CLUSTER_NAME: ${{ inputs.cluster-name }}
24+
NAMESPACE: ${{ inputs.namespace }}
25+
EXPECTED_READY_INSTANCES: ${{ inputs.ready-instances }}
1826
run: |
1927
ITER=0
2028
while true; do
2129
if [[ $ITER -ge 300 ]]; then
2230
echo "Cluster not ready"
2331
exit 1
2432
fi
25-
READY_INSTANCES=$(kubectl get clusters.postgresql.cnpg.io ${INPUT_CLUSTER_NAME} -o jsonpath='{.status.readyInstances}')
26-
if [[ "$READY_INSTANCES" == ${INPUT_READY_INSTANCES} ]]; then
33+
READY_INSTANCES=$(kubectl get clusters.postgresql.cnpg.io $CLUSTER_NAME -n $NAMESPACE -o jsonpath='{.status.readyInstances}')
34+
if [[ "$READY_INSTANCES" == "$EXPECTED_READY_INSTANCES" ]]; then
2735
echo "Cluster up and running"
2836
break
2937
fi

.github/workflows/lint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ jobs:
1414
runs-on: ubuntu-24.04
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1818
with:
1919
fetch-depth: 0
2020

2121
- name: Set up Helm
22-
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
22+
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
2323
with:
24-
version: v3.4.0
24+
version: v3.16.2
2525

26-
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
26+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
2727
with:
2828
python-version: 3.12
2929

3030
- name: Set up chart-testing
31-
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
31+
uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b # v2.7.0
3232

3333
- name: Run chart-testing (list-changed)
3434
id: list-changed

.github/workflows/release-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-24.04
1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2020
- name: Create Pull Request
2121
id: create-pr
2222
env:

.github/workflows/release-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-24.04
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919
with:
2020
fetch-depth: 0 # important for fetching all history to run comparison against
2121

@@ -35,14 +35,14 @@ jobs:
3535
- name: Set up Helm
3636
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
3737
with:
38-
version: v3.14.1
38+
version: v3.16.2
3939

4040
- name: Add chart dependencies
4141
run: |
4242
helm repo add cnpg-grafana-dashboard https://cloudnative-pg.github.io/grafana-dashboards
4343
4444
- name: Run chart-releaser
45-
uses: helm/chart-releaser-action@a917fd15b20e8b64b94d9158ad54cd6345335584 # v1.6.0
45+
uses: helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1.7.0
4646
env:
4747
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
4848
CR_KEY: helm-charts+no-reply@cloudnative-pg.io

.github/workflows/tests-cluster-chainsaw.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-24.04
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1414
with:
1515
fetch-depth: 0
1616

@@ -29,7 +29,7 @@ jobs:
2929
helm install prometheus-crds prometheus-community/prometheus-operator-crds
3030
3131
- name: Install Chainsaw
32-
uses: kyverno/action-install-chainsaw@d311eacde764f806c9658574ff64c9c3b21f8397 # v0.2.11
32+
uses: kyverno/action-install-chainsaw@f2b47b97dc889c12702113753d713f01ec268de5 # v0.2.12
3333
with:
3434
verify: true
3535

.github/workflows/tests-operator.yml

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ on:
77

88
jobs:
99
deploy_operator:
10+
name: Deploy the operator in cluster-wide mode
1011
runs-on: ubuntu-24.04
1112
steps:
1213
- name: Checkout
13-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
14+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1415
with:
1516
fetch-depth: 0
1617

@@ -21,21 +22,52 @@ jobs:
2122
uses: ./.github/actions/deploy-operator
2223

2324
- name: Deploy a cluster
24-
run: |
25-
cat <<EOF | kubectl apply -f -
26-
# Example of PostgreSQL cluster
27-
apiVersion: postgresql.cnpg.io/v1
28-
kind: Cluster
29-
metadata:
30-
name: cluster-example
31-
spec:
32-
instances: 3
33-
storage:
34-
size: 1Gi
35-
EOF
25+
uses: ./.github/actions/deploy-cluster
3626

3727
- name: Verify that the cluster is ready
3828
uses: ./.github/actions/verify-cluster-ready
3929
with:
4030
cluster-name: cluster-example
41-
ready-instances: 3
31+
ready-instances: '3'
32+
33+
deploy_operator_single_namespace:
34+
name: Deploy the operator in single-namespace mode
35+
runs-on: ubuntu-24.04
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
with:
40+
fetch-depth: 0
41+
42+
- name: Setup kind
43+
uses: ./.github/actions/setup-kind
44+
45+
- name: Deploy the operator
46+
uses: ./.github/actions/deploy-operator
47+
with:
48+
namespace: 'single-install'
49+
cluster-wide: 'false'
50+
51+
- name: Deploy a cluster
52+
uses: ./.github/actions/deploy-cluster
53+
with:
54+
namespace: 'single-install'
55+
56+
- name: Verify that the cluster is ready
57+
uses: ./.github/actions/verify-cluster-ready
58+
with:
59+
namespace: 'single-install'
60+
cluster-name: 'cluster-example'
61+
ready-instances: '3'
62+
63+
- name: Create a separate namespace
64+
run: kubectl create ns test-ignore
65+
66+
- name: Deploy a cluster in 'test-ignore'
67+
uses: ./.github/actions/deploy-cluster
68+
with:
69+
namespace: 'test-ignore'
70+
71+
- name: Verify the cluster in 'test-ignore' is being ignored
72+
run: |
73+
kubectl -n test-ignore get pods 2>&1 >/dev/null | grep 'No resources found'

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# responsible for code in a repository. For details, please refer to
33
# https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/about-code-owners
44

5-
* @fcanovai @gbartolini @leonardoce @mnencia @phisco @sxd
5+
* @fcanovai @gbartolini @leonardoce @mnencia @phisco @sxd @itay-grudev
66
/.github @fcanovai @gbartolini @leonardoce @mnencia @phisco @sxd @itay-grudev
77
/charts/cluster @itay-grudev

0 commit comments

Comments
 (0)