mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-28 00:20:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1e5c8e1cb | ||
|
|
4202ad853a | ||
|
|
93ac309b38 |
+1
-1
@@ -12,7 +12,7 @@ Patroni is a template for you to create your own customized, high-availability s
|
||||
|
||||
We call Patroni a "template" because it is far from being a one-size-fits-all or plug-and-play replication system. It will have its own caveats. Use wisely.
|
||||
|
||||
**Note to Kubernetes users**: Patroni can run natively on top of Kubernetes. Take a look at the `Kubernetes <https://github.com/zalando/patroni/blog/master/docs/kubernetes.rst>`__ chapter of the Patroni documentation.
|
||||
**Note to Kubernetes users**: Patroni can run natively on top of Kubernetes. Take a look at the `Kubernetes <https://github.com/zalando/patroni/blob/master/docs/kubernetes.rst>`__ chapter of the Patroni documentation.
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
@@ -55,7 +55,7 @@ Exhibitor
|
||||
|
||||
Kubernetes
|
||||
----------
|
||||
- **PATRONI\_KUBERNETES\_NAMESPACE**: (optional) Kubernetes namespace where the operator is running. Default value is `default`.
|
||||
- **PATRONI\_KUBERNETES\_NAMESPACE**: (optional) Kubernetes namespace where the Patroni pod is running. Default value is `default`.
|
||||
- **PATRONI\_KUBERNETES\_LABELS**: Labels in format ``{label1: value1, label2: value2}``. These labels will be used to find existing objects (Pods and either Endpoints or ConfigMaps) associated with the current cluster. Also Patroni will set them on every object (Endpoint or ConfigMap) it creates.
|
||||
- **PATRONI\_KUBERNETES\_SCOPE\_LABEL**: (optional) name of the label containing cluster name. Default value is `cluster-name`.
|
||||
- **PATRONI\_KUBERNETES\_ROLE\_LABEL**: (optional) name of the label containing Postgres role (`master` or `replica`). Patroni will set this label on the pod it is running in. Default value is `role`.
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ Exhibitor
|
||||
|
||||
Kubernetes
|
||||
----------
|
||||
- **namespace**: (optional) Kubernetes namespace where we are running. Default value is `default`.
|
||||
- **namespace**: (optional) Kubernetes namespace where Patroni pod is running. Default value is `default`.
|
||||
- **labels**: Labels in format ``{label1: value1, label2: value2}``. These labels will be used to find existing objects (Pods and either Endpoints or ConfigMaps) associated with the current cluster. Also Patroni will set them on every object (Endpoint or ConfigMap) it creates.
|
||||
- **scope\_label**: (optional) name of the label containing cluster name. Default value is `cluster-name`.
|
||||
- **role\_label**: (optional) name of the label containing role (master or replica). Patroni will set this label on the pod it runs in. Default value is ``role``.
|
||||
|
||||
@@ -3,6 +3,20 @@
|
||||
Release notes
|
||||
=============
|
||||
|
||||
Version 1.4.1
|
||||
-------------
|
||||
|
||||
**Fixes in patronictl**
|
||||
|
||||
- Don't show current leader in suggested list of members to failover to. (Alexander Kukushkin)
|
||||
|
||||
patronictl failover could still work when there is leader in the cluster and it should be excluded from the list of member where it is possible to failover to.
|
||||
|
||||
- Make patronictl switchover compatible with the old Patroni api (Alexander)
|
||||
|
||||
In case if POST /switchover REST API call has failed with status code 501 it will do it once again, but to /failover endpoint.
|
||||
|
||||
|
||||
Version 1.4
|
||||
-----------
|
||||
|
||||
|
||||
+12
-8
@@ -546,15 +546,14 @@ def _do_failover_or_switchover(obj, action, cluster_name, master, candidate, for
|
||||
dcs = get_dcs(obj, cluster_name)
|
||||
cluster = dcs.get_cluster()
|
||||
|
||||
if action == 'switchover':
|
||||
if cluster.leader is None:
|
||||
raise PatroniCtlException('This cluster has no master')
|
||||
if action == 'switchover' and cluster.leader is None:
|
||||
raise PatroniCtlException('This cluster has no master')
|
||||
|
||||
if master is None:
|
||||
if force:
|
||||
master = cluster.leader.member.name
|
||||
else:
|
||||
master = click.prompt('Master', type=str, default=cluster.leader.member.name)
|
||||
if master is None:
|
||||
if force or action == 'failover':
|
||||
master = cluster.leader and cluster.leader.name
|
||||
else:
|
||||
master = click.prompt('Master', type=str, default=cluster.leader.member.name)
|
||||
|
||||
if master is not None and cluster.leader and cluster.leader.member.name != master:
|
||||
raise PatroniCtlException('Member {0} is not the leader of cluster {1}'.format(master, cluster_name))
|
||||
@@ -610,6 +609,11 @@ def _do_failover_or_switchover(obj, action, cluster_name, master, candidate, for
|
||||
member = cluster.leader.member if cluster.leader else cluster.get_member(candidate, False)
|
||||
|
||||
r = request_patroni(member, 'post', action, failover_value, auth_header(obj))
|
||||
|
||||
# probably old patroni, which doesn't support switchover yet
|
||||
if r.status_code == 501 and action == 'switchover' and 'Server does not support this operation' in r.text:
|
||||
r = request_patroni(member, 'post', 'failover', failover_value, auth_header(obj))
|
||||
|
||||
if r.status_code in (200, 202):
|
||||
logging.debug(r)
|
||||
cluster = dcs.get_cluster()
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
__version__ = '1.4'
|
||||
__version__ = '1.4.1'
|
||||
|
||||
@@ -129,6 +129,11 @@ class TestCtl(unittest.TestCase):
|
||||
result = self.runner.invoke(ctl, ['switchover', 'dummy'], input='leader\nother\n\ny')
|
||||
assert 'Switchover failed' in result.output
|
||||
|
||||
mocked.return_value.status_code = 501
|
||||
mocked.return_value.text = 'Server does not support this operation'
|
||||
result = self.runner.invoke(ctl, ['switchover', 'dummy'], input='leader\nother\n\ny')
|
||||
assert 'Switchover failed' in result.output
|
||||
|
||||
# No members available
|
||||
mock_get_dcs.return_value.get_cluster = get_cluster_initialized_with_only_leader
|
||||
result = self.runner.invoke(ctl, ['switchover', 'dummy'], input='leader\nother\n\ny')
|
||||
|
||||
Reference in New Issue
Block a user