Skip to content

Commit

Permalink
update callback files
Browse files Browse the repository at this point in the history
  • Loading branch information
idanovinda committed Dec 13, 2024
1 parent 287baef commit eb51b6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion postgres-appliance/scripts/callback_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion postgres-appliance/scripts/callback_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit eb51b6c

Please sign in to comment.