Skip to content

Add basic auth settings for patroni rest api

DJ Mountney requested to merge patroni-rest-auth into master

What does this MR do?

Allows users to set the username/password for the patroni rest api.

This auth is required for using write commands to the patroni rest api, but is not required when doing get requests.

Related issues

Part of #6179 (closed)

Updates to our Patroni setup docs coming in a separate MR.

Test plan

  • Setup a 3 db node patroni cluster
    • Provide username password in two of the nodes including the leader
    • leave no basic auth config on the the 3rd node which is a replica
  • Confirm setup/replication works
  • Confirm writes to the api require basic auth on the nodes that have the basic auth config
    • curl -s -XPATCH -d '{"ttl":20}' 127.0.0.1:8008/config should fail unless you specify -u username:password
    • Note the above will pass without basic auth on the node that doesn't have config
  • Confirm patroni ctl write command still work on nodes with basic auth
    • gitlab-ctl patroni pause and gitlab-ctl patroni resume work on the repica
  • Confirm patroni ctl write commands fail on the node without basic auth
    • gitlab-ctl patroni pause should fail

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

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Tests added
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for the GitLab Chart opened
Edited by DJ Mountney

Merge request reports