Skip to content

Update consul lookup in get-postgresql-primary to use correct domain after upgrade

Grant Young requested to merge gy-fix-get-postgresql-primary into master

What does this MR do?

Update the gitlab-ctl get-postgresql-primary to use the correct domain for the DNS request to consul to retrieve the PostgreSQL primary node.

With the recent upgrade to Consul it appears that requests now require .consul at the end. The command only looked for "master.#{postgresql_service_name}.service", which now returns blank. Changing this to "master.#{postgresql_service_name}.service.consul" fixes the problem and the command works again.

MR also adds in some hardening and will now report a clear error when the request to Consul returns blank.

Related issues

Closes #6203 (closed)

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • Pipeline is green on dev.gitlab.org if the change is touching anything besides documentation or internal cookbooks
  • trigger-package has a green pipeline running against latest commit

Merge request reports