Skip to content

Commit 6c1bf16

Browse files
committed
Merge branch 'master' into trigger-sync
2 parents a45f038 + 4b3d1c6 commit 6c1bf16

11 files changed

+32
-23
lines changed

.github/workflows/publish-ghcr-container.yaml

+12-12
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111
jobs:
1212
publish:
1313
name: Build and push Spilo multiarch images
14-
runs-on: ubuntu-latest
14+
runs-on: ubuntu-22.04
1515
permissions:
1616
contents: 'read'
1717
packages: 'write'
@@ -20,15 +20,15 @@ jobs:
2020
shell: bash
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
24+
25+
- name: Set up packages
26+
run: sudo apt-get install -y docker-compose
2427

2528
- name: Set up Python
26-
uses: actions/setup-python@v4
29+
uses: actions/setup-python@v5
2730
with:
28-
python-version: 3.7
29-
30-
- name: Install flake8 and docker-compose
31-
run: python -m pip install flake8 docker-compose==1.17.1
31+
python-version: '3.10'
3232

3333
- name: Derive spilo image name
3434
id: image
@@ -39,20 +39,20 @@ jobs:
3939
echo "NAME=$IMAGE" >> $GITHUB_OUTPUT
4040
4141
- name: Set up QEMU
42-
uses: docker/setup-qemu-action@v2
42+
uses: docker/setup-qemu-action@v3
4343

4444
- name: Set up Docker Buildx
45-
uses: docker/setup-buildx-action@v2
45+
uses: docker/setup-buildx-action@v3
4646

4747
- name: Login to GHCR
48-
uses: docker/login-action@v2
48+
uses: docker/login-action@v3
4949
with:
5050
registry: ${{ env.REGISTRY }}
5151
username: ${{ github.actor }}
5252
password: ${{ secrets.GITHUB_TOKEN }}
5353

5454
- name: Build and export to local docker for testing
55-
uses: docker/build-push-action@v3
55+
uses: docker/build-push-action@v6
5656
with:
5757
context: "postgres-appliance/"
5858
load: true
@@ -65,7 +65,7 @@ jobs:
6565
bash postgres-appliance/tests/test_spilo.sh
6666
6767
- name: Build arm64 additionaly and push multiarch image to ghcr
68-
uses: docker/build-push-action@v3
68+
uses: docker/build-push-action@v6
6969
with:
7070
context: "postgres-appliance/"
7171
push: true

ENVIRONMENT.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ Environment Configuration Settings
101101
- **LOG_GROUP_BY_DATE**: (optional) enable grouping log by date. Default is False - group the log files based on the instance ID.
102102
- **DCS_ENABLE_KUBERNETES_API**: a non-empty value forces Patroni to use Kubernetes as a DCS. Default is empty.
103103
- **KUBERNETES_USE_CONFIGMAPS**: a non-empty value makes Patroni store its metadata in ConfigMaps instead of Endpoints when running on Kubernetes. Default is empty.
104-
- **KUBERNETES_ROLE_LABEL**: name of the label containing Postgres role when running on Kubernetens. Default is 'spilo-role'.
104+
- **KUBERNETES_ROLE_LABEL**: name of the label containing Postgres role when running on Kubernetes. Default is 'spilo-role'.
105+
- **KUBERNETES_LEADER_LABEL_VALUE**: value of the pod label if Postgres role is primary when running on Kubernetes. Default is 'master'.
106+
- **KUBERNETES_STANDBY_LEADER_LABEL_VALUE**: value of the pod label if Postgres role is standby_leader when running on Kubernetes. Default is 'master'.
105107
- **KUBERNETES_SCOPE_LABEL**: name of the label containing cluster name. Default is 'version'.
106108
- **KUBERNETES_LABELS**: a JSON describing names and values of other labels used by Patroni on Kubernetes to locate its metadata. Default is '{"application": "spilo"}'.
107109
- **INITDB_LOCALE**: database cluster's default UTF-8 locale (en_US by default)

kubernetes/spilo_kubernetes.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ spec:
7979
value: spilo-cluster
8080
- name: KUBERNETES_ROLE_LABEL
8181
value: role
82+
- name: KUBERNETES_LEADER_LABEL_VALUE
83+
value: master
84+
- name: KUBERNETES_STANDBY_LEADER_LABEL_VALUE
85+
value: master
8286
- name: SPILO_CONFIGURATION
8387
value: | ## https://github.com/zalando/patroni#yaml-configuration
8488
bootstrap:

postgres-appliance/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ COPY --from=dependencies-builder /builddeps/wal-g /usr/local/bin/
7474
COPY build_scripts/patroni_wale.sh build_scripts/compress_build.sh /builddeps/
7575

7676
# Install patroni and wal-e
77-
ENV PATRONIVERSION=3.3.5
77+
ENV PATRONIVERSION=4.0.4
7878
ENV WALE_VERSION=1.1.1
7979

8080
WORKDIR /

postgres-appliance/runit/pgqd/run

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ if ! $CHPST true 2> /dev/null; then
66
fi
77

88
exec 2>&1
9-
exec $CHPST env -i PGAPPNAME="pgq ticker" /scripts/patroni_wait.sh --role master -- /usr/bin/pgqd /home/postgres/pgq_ticker.ini
9+
exec $CHPST env -i PGAPPNAME="pgq ticker" /scripts/patroni_wait.sh --role primary -- /usr/bin/pgqd /home/postgres/pgq_ticker.ini

postgres-appliance/scripts/callback_aws.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def main():
6565

6666
ec2 = boto.ec2.connect_to_region(metadata['region'])
6767

68-
if argc == 5 and role in ('master', 'standby_leader') and action in ('on_start', 'on_role_change'):
68+
if argc == 5 and role in ('primary', 'standby_leader') and action in ('on_start', 'on_role_change'):
6969
associate_address(ec2, sys.argv[1], instance_id)
7070

7171
instance = get_instance(ec2, instance_id)

postgres-appliance/scripts/callback_role.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
logger = logging.getLogger(__name__)
2020

2121
LABEL = os.environ.get("KUBERNETES_ROLE_LABEL", 'spilo-role')
22+
LEADER_LABEL_VALUE = os.environ.get("KUBERNETES_LEADER_LABEL_VALUE", 'master')
2223

2324

2425
def read_first_line(filename):
@@ -78,7 +79,7 @@ def record_role_change(action, new_role, cluster):
7879
new_role = None if action == 'on_stop' else new_role
7980
logger.debug("Changing the pod's role to %s", new_role)
8081
pod_namespace = os.environ.get('POD_NAMESPACE', read_first_line(KUBE_NAMESPACE_FILENAME)) or 'default'
81-
if new_role == 'master':
82+
if new_role == LEADER_LABEL_VALUE:
8283
change_endpoints(pod_namespace, cluster)
8384
change_pod_role_label(pod_namespace, new_role)
8485

postgres-appliance/scripts/configure_spilo.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def deep_update(a, b):
379379
threshold_megabytes: {{WALE_BACKUP_THRESHOLD_MEGABYTES}}
380380
threshold_backup_size_percentage: {{WALE_BACKUP_THRESHOLD_PERCENTAGE}}
381381
retries: 2
382-
no_master: 1
382+
no_leader: 1
383383
{{/USE_WALE}}
384384
basebackup_fast_xlog:
385385
command: /scripts/basebackup.sh
@@ -390,7 +390,7 @@ def deep_update(a, b):
390390
threshold_megabytes: {{WALE_BACKUP_THRESHOLD_MEGABYTES}}
391391
threshold_backup_size_percentage: {{WALE_BACKUP_THRESHOLD_PERCENTAGE}}
392392
retries: 2
393-
no_master: 1
393+
no_leader: 1
394394
{{/STANDBY_WITH_WALE}}
395395
'''
396396

@@ -578,6 +578,8 @@ def get_placeholders(provider):
578578
placeholders.setdefault('CALLBACK_SCRIPT', '')
579579
placeholders.setdefault('DCS_ENABLE_KUBERNETES_API', '')
580580
placeholders.setdefault('KUBERNETES_ROLE_LABEL', 'spilo-role')
581+
placeholders.setdefault('KUBERNETES_LEADER_LABEL_VALUE', 'master')
582+
placeholders.setdefault('KUBERNETES_STANDBY_LEADER_LABEL_VALUE', 'master')
581583
placeholders.setdefault('KUBERNETES_SCOPE_LABEL', 'version')
582584
placeholders.setdefault('KUBERNETES_LABELS', KUBERNETES_DEFAULT_LABELS)
583585
placeholders.setdefault('KUBERNETES_USE_CONFIGMAPS', '')

postgres-appliance/scripts/on_role_change.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ shift
77

88

99
readonly dbname=postgres
10-
if [[ "${*: -3:1}" == "on_role_change" && "${*: -2:1}" == "master" ]]; then
10+
if [[ "${*: -3:1}" == "on_role_change" && "${*: -2:1}" == "primary" ]]; then
1111
num=30 # wait 30 seconds for end of recovery
1212
while [[ $((num--)) -gt 0 ]]; do
1313
if [[ "$(psql -d $dbname -tAc 'SELECT pg_catalog.pg_is_in_recovery()')" == "f" ]]; then

postgres-appliance/scripts/patroni_wait.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
ROLE=master
3+
ROLE=primary
44
INTERVAL=60
55
TIMEOUT=""
66

@@ -17,7 +17,7 @@ Options:
1717
1818
-t, --timeout Fail after TIMEOUT seconds (default: no timeout)
1919
20-
Waits for ROLE (master or replica). It will check every INTERVAL seconds ($INTERVAL).
20+
Waits for ROLE (primary or replica). It will check every INTERVAL seconds ($INTERVAL).
2121
If TIMEOUT is specified, it will stop trying after TIMEOUT seconds.
2222
2323
Executes COMMAND after ROLE has become available. (Default: exit 0)

postgres-appliance/scripts/wale_restore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ while getopts ":-:" optchar; do
2424
threshold_megabytes=*|threshold-megabytes=* )
2525
THRESHOLD_MEGABYTES=${OPTARG#*=}
2626
;;
27-
no_master=*|no-master=* )
27+
no_leader=*|no-master=* )
2828
NO_MASTER=${OPTARG#*=}
2929
;;
3030
esac

0 commit comments

Comments
 (0)