Skip to content

Commit

Permalink
don't set readonly node priority at update config.
Browse files Browse the repository at this point in the history
correct_password dont exit.
  • Loading branch information
zlianzhuang committed Dec 2, 2022
1 parent 66a0533 commit 68dbb06
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions platforms/kubernetes/postgres-operator/postgres/handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2860,8 +2860,11 @@ def correct_postgresql_password(
readwrite_conns = connections(spec, meta, patch,
get_field(POSTGRESQL, READWRITEINSTANCE),
False, None, logger, None, status, False)
conn = get_primary_conn(readwrite_conns, 0, logger)
correct_user_password(meta, spec, patch, status, logger, conn)
conn = get_primary_conn(readwrite_conns, 0, logger, interrupt = False)
if conn == None:
logger.error(f"can't correct readwrite password. because get primary conn failed")
else:
correct_user_password(meta, spec, patch, status, logger, conn)
readwrite_conns.free_conns()


Expand Down Expand Up @@ -2967,8 +2970,8 @@ def timer_cluster(
) -> None:

correct_postgresql_role(meta, spec, patch, status, logger)
correct_postgresql_password(meta, spec, patch, status, logger)
correct_keepalived(meta, spec, patch, status, logger)
correct_postgresql_password(meta, spec, patch, status, logger)

def update_number_sync_standbys(
meta: kopf.Meta,
Expand Down Expand Up @@ -3530,7 +3533,7 @@ def update_configs_utile(
# pg_autoctl set node candidate-priority 0 --pgdata=s

if autofailover == False and restart == True:
update_node_priority(meta, spec, patch, status, logger, conns, NODE_PRIORITY_NEVER, primary_host)
update_node_priority(meta, spec, patch, status, logger, readwrite_conns.get_conns(), NODE_PRIORITY_NEVER, primary_host)

# first update primary node
checkpoint_cmd = ["pgtools", "-w", "0", "-q", "'checkpoint'"]
Expand Down Expand Up @@ -3583,7 +3586,7 @@ def update_configs_utile(
waiting_postgresql_ready(readonly_conns, logger)
waiting_cluster_final_status(meta, spec, patch, status, logger)
if autofailover == False and restart == True:
update_node_priority(meta, spec, patch, status, logger, conns, NODE_PRIORITY_DEFAULT, primary_host)
update_node_priority(meta, spec, patch, status, logger, readwrite_conns.get_conns(), NODE_PRIORITY_DEFAULT, primary_host)
waiting_cluster_final_status(meta, spec, patch, status, logger)

def update_configs_port(
Expand Down

0 comments on commit 68dbb06

Please sign in to comment.