-
Notifications
You must be signed in to change notification settings - Fork 67
K8SPG-648 add PG17 support #921
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
Conversation
| // +kubebuilder:rbac:groups=apps,resources=replicasets,verbs=create;delete;get;list;patch;watch | ||
| // +kubebuilder:rbac:groups=pgv2.percona.com,resources=perconapgclusters/finalizers,verbs=update | ||
| // +kubebuilder:rbac:groups=batch,resources=jobs,verbs=create;list;update | ||
| // +kubebuilder:rbac:groups=pgv2.percona.com,resources=pods,verbs=create;delete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have pods resource in this api group?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | ||
|
|
||
| if err := r.Client.Create(ctx, p); err != nil { | ||
| return errors.Wrap(err, "failed to create pod to check patrni version") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return errors.Wrap(err, "failed to create pod to check patrni version") | |
| return errors.Wrap(err, "failed to create pod to check patroni version") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
internal/patroni/api.go
Outdated
| // next cannot be blank. Similar to the "POST /switchover" REST endpoint. | ||
| func (exec Executor) ChangePrimaryAndWait( | ||
| ctx context.Context, current, next string, | ||
| ctx context.Context, current, next string, ver4 bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would name this patroniVer4 to be more clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inelpandzic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| patroniVerStr, ok := cluster.Annotations[pNaming.ToCrunchyAnnotation(pNaming.AnnotationPatroniVersion)] | ||
| if !ok { | ||
| return errors.New("patroni version annotation was not found") | ||
| } | ||
| patroniVer, err := gover.NewVersion(patroniVerStr) | ||
| if err != nil { | ||
| return errors.Wrap(err, "failed to get patroni ver") | ||
| } | ||
| patroniVer4 := patroniVer.Compare(gover.Must(gover.NewVersion("4.0.0"))) >= 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see we do this in multiple places, can we move this logic to a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also i don't think we should use gover.Must since it'll panic if it can't parse the version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
internal/patroni/api.go
Outdated
| // We should use "primary" instead | ||
| cmd := []string{"patronictl", "switchover", "--scheduled=now", "--force", "--primary=" + current, "--candidate=" + next} | ||
| if !patroniVer4 { | ||
| cmd = []string{"patronictl", "switchover", "--scheduled=now", "--force", "--master=" + current, "--candidate=" + next} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than duplicating the slice, can we do smth like cmd[4] = "--master=" + current?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commit: 9fc8f82 |
CHANGE DESCRIPTION
Problem:
Short explanation of the problem.
Cause:
Short explanation of the root cause of the issue if applicable.
Solution:
Short explanation of the solution we are providing with this PR.
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability