Files
patroni/kubernetes/openshift-example
Alexander Kukushkin b470ade20e Change master->primary, take two (#3127)
This commit is a breaking change:
1. `role` in DCS is written as "primary" instead of "master".
2. `role` in REST API responses is also written as "primary".
3. REST API no longer accepts role=master in requests (for example switchover/failover/restart endpoints).
4. `/metrics` REST API endpoint will no longer report `patroni_master`.
5. `patronictl` no longer accepts `--master` argument.
6. `no_master` option in declarative configuration of custom replica creation methods is no longer treated as a special option, please use `no_leader` instead.
7. `patroni_wale_restore` doesn't accept `--no_master` anymore.
8. `patroni_barman` doesn't accept `--role=master` anymore.
9. callback scripts will be executed with role=primary instead of role=master
10. On Kubernetes Patroni by default will set role label to primary. In case if you want to keep old behavior and avoid downtime or lengthy complex migrations you can configure `kubernetes.leader_label_value` and `kubernetes.standby_leader_label_value` to `master`.

However, a few exceptions regarding master are still in place:
1. `GET /master` REST API endpoint will continue to work.
2. `master_start_timeout` and `master_stop_timeout` in global configuration are still accepted.
3. `master` tag is still preserved in Consul services in addition to `primary`.

Rationale for these exceptions: DBA doesn't always 100% control the infrastructure and can't adjust the configuration.
2024-08-28 17:19:00 +02:00
..

Patroni OpenShift Configuration

Patroni can be run in OpenShift. Based on the kubernetes configuration, the Dockerfile and Entrypoint has been modified to support the dynamic UID/GID configuration that is applied in OpenShift. This can be run under the standard restricted SCC.

Examples

Create test project

oc new-project patroni-test

Build the image

Note: Update the references when merged upstream. Note: If deploying as a template for multiple users, the following commands should be performed in a shared namespace like openshift.

oc import-image postgres:10 --confirm -n openshift
oc new-build https://github.com/patroni/patroni --context-dir=kubernetes -n openshift

Deploy the Image

Two configuration templates exist in templates directory:

  • Patroni Ephemeral
  • Patroni Persistent

The only difference is whether or not the statefulset requests persistent storage.

Create the Template

Install the template into the openshift namespace if this should be shared across projects:

oc create -f templates/template_patroni_ephemeral.yml -n openshift

Then, from your own project:

oc new-app patroni-pgsql-ephemeral

Once the pods are running, two configmaps should be available:

$ oc get configmap
NAME                DATA      AGE
patroniocp-config   0         1m
patroniocp-leader   0         1m