-
Notifications
You must be signed in to change notification settings - Fork 80
K8SPG-1057: Allow using etcd as patroni DCS #1647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yoav-katz
wants to merge
38
commits into
percona:main
Choose a base branch
from
yoav-katz:etcd-dcs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
d3ec2fd
feat(etcd)
yoav-katz a07a883
fix
yoav-katz 3d26af1
Merge branch 'main' into etcd-dcs
yoav-katz e5ecd24
Self Code Review
yoav-katz fa46761
Merge branch 'etcd-dcs' of github.com:yoav-katz/percona-postgresql-op…
yoav-katz 241cf08
feat(e2e_tests)
yoav-katz d34a071
Update run-pr.csv
yoav-katz f12b817
Update run-release.csv
yoav-katz 3f1de89
fix(crd)
yoav-katz 36094e3
Merge branch 'etcd-dcs' of github.com:yoav-katz/percona-postgresql-op…
yoav-katz 2b0ac02
fix(bug)
yoav-katz 48082f5
regenerate-crds
yoav-katz 70d51b5
feat(e2e_tests): added check for immutable dcs after creation
yoav-katz 05c0042
fix(tag)
yoav-katz 8f26d3c
feat(patroni-role-change)
yoav-katz 4168133
fix(patroni callbacks)
yoav-katz 2466216
fix(patroni-role-change callback): added status too
yoav-katz 4f19784
fix(service): using lables with role=primary instead of Endpoint
yoav-katz 89e82d0
fix(cert-manager): fixed cert-manager tests
yoav-katz 692e3e3
fix(tests)
yoav-katz 67363a8
fix(MR comments)
yoav-katz 92d684a
fix(pgcluster): added DCSType(): returns the type of the DCS
yoav-katz 4bbcf67
Merge branch 'main' into etcd-dcs
yoav-katz 6cb833e
Potential fix for pull request finding
yoav-katz 9737acb
fix(lint errors)
yoav-katz e70a13c
fix(patroni_types)
yoav-katz 08bb54c
fix(SystemIdentifier): added SystemIdentifier via api when not using …
yoav-katz cb68c63
feat(patroni-role-change.sh): added retries
yoav-katz f0d82ef
fix(duplicate validation)
yoav-katz 689850f
fix(pgbackrest): clean Patroni DCS state via patronictl remove before…
yoav-katz f9e02f9
Merge branch 'main' into etcd-dcs
yoav-katz 973f408
fix(bug): reach to patroni api requires full fqdn
yoav-katz c6620af
Merge branch 'etcd-dcs' of github.com:yoav-katz/percona-postgresql-op…
yoav-katz 35ef794
fix(postgrescluster/cluster.go): use function cluster.UsesExternalDCS
yoav-katz 3e8c575
fix(typo)
yoav-katz ee72659
Merge branch 'main' into etcd-dcs
yoav-katz 2f836f1
Merge branch 'main' into etcd-dcs
yoav-katz e84a9b1
Merge branch 'percona:main' into etcd-dcs
yoav-katz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/bin/bash | ||
| # Patroni on_role_change / on_start callback. | ||
| # Called by Patroni as: <script> <event> <role> <scope> | ||
| # With etcd DCS, Patroni does not update pod labels or annotations. | ||
| # This script patches both so that: | ||
| # - Service selectors work (role label) | ||
| # - IsWritable() works (status annotation read by the operator) | ||
|
|
||
| ROLE=${2} | ||
|
|
||
| NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace) | ||
| TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) | ||
| CA=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt | ||
| POD=${HOSTNAME} | ||
|
|
||
| case "${ROLE}" in | ||
| master|primary) LABEL="primary" ;; | ||
| replica) LABEL="replica" ;; | ||
| *) LABEL="${ROLE}" ;; | ||
| esac | ||
|
|
||
| PATCH_BODY="{\"metadata\":{\"labels\":{\"postgres-operator.crunchydata.com/role\":\"${LABEL}\"},\"annotations\":{\"status\":\"{\\\"role\\\":\\\"${LABEL}\\\"}\"}}}" | ||
|
|
||
| curl -sf -X PATCH \ | ||
|
yoav-katz marked this conversation as resolved.
|
||
| --retry 3 --retry-delay 1 --retry-connrefused \ | ||
| --cacert "${CA}" \ | ||
| -H "Authorization: Bearer ${TOKEN}" \ | ||
| -H "Content-Type: application/strategic-merge-patch+json" \ | ||
| "https://kubernetes.default.svc/api/v1/namespaces/${NAMESPACE}/pods/${POD}" \ | ||
| -d "${PATCH_BODY}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.