diff --git a/postgres-appliance/scripts/callback_aws.py b/postgres-appliance/scripts/callback_aws.py index 971ac768..6032fbaa 100755 --- a/postgres-appliance/scripts/callback_aws.py +++ b/postgres-appliance/scripts/callback_aws.py @@ -65,7 +65,7 @@ def main(): ec2 = boto.ec2.connect_to_region(metadata['region']) - if argc == 5 and role in ('master', 'standby_leader') and action in ('on_start', 'on_role_change'): + if argc == 5 and role in ('primary', 'standby_leader') and action in ('on_start', 'on_role_change'): associate_address(ec2, sys.argv[1], instance_id) instance = get_instance(ec2, instance_id) diff --git a/postgres-appliance/scripts/callback_role.py b/postgres-appliance/scripts/callback_role.py index 393b069c..b0d48283 100755 --- a/postgres-appliance/scripts/callback_role.py +++ b/postgres-appliance/scripts/callback_role.py @@ -19,6 +19,7 @@ logger = logging.getLogger(__name__) LABEL = os.environ.get("KUBERNETES_ROLE_LABEL", 'spilo-role') +LEADER_LABEL_VALUE = os.environ.get("KUBERNETES_LEADER_LABEL_VALUE", 'master') def read_first_line(filename): @@ -78,7 +79,7 @@ def record_role_change(action, new_role, cluster): new_role = None if action == 'on_stop' else new_role logger.debug("Changing the pod's role to %s", new_role) pod_namespace = os.environ.get('POD_NAMESPACE', read_first_line(KUBE_NAMESPACE_FILENAME)) or 'default' - if new_role == 'master': + if new_role == LEADER_LABEL_VALUE: change_endpoints(pod_namespace, cluster) change_pod_role_label(pod_namespace, new_role)