-
Notifications
You must be signed in to change notification settings - Fork 202
K8SPXC-1071: Add Percona scheduler for ProxySQL #1436
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
… proxysql K8SPXC-1071 - Make percona-scheduler-admin usage optional Fix bundle and crd Add validation Error fixes fix build errors K8SPXC-1071 - Add SCHEDULER environment var for proxysql container K8SPXC-1071 - Set default value for proxysql scheduler K8SPXC-1071 - Fix validation for proxysql scheduler field Fix tests Remove different writer hostgroup for percona scheduler Remove scheduler as parameter for PrimaryHost function Revert proxysql hostgroup to the old one in e2e-tests/functions Leverage k8s API validation for Scheduler field Check mysql_galera_hostgroups only if proxysql-admin scheduler used Update tests Return writeID to original position and type Remove empty line Switch default scheduler in code to proxysql-admin Update tests Rename proxysql scheduler to pxchandler Fix validation for pxchandler for new variabe names Update manifest Fix review comment
pkg/apis/pxc/v1/pxc_types.go
Outdated
| c.ProxySQL.ImagePullPolicy = corev1.PullAlways | ||
| } | ||
|
|
||
| if cr.CompareVersionWith("1.12.0") >= 0 && len(c.ProxySQL.PXCHandler) == 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.
| if cr.CompareVersionWith("1.12.0") >= 0 && len(c.ProxySQL.PXCHandler) == 0 { | |
| if cr.CompareVersionWith("1.13.0") >= 0 && len(c.ProxySQL.PXCHandler) == 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.
pkg/pxc/app/statefulset/proxysql.go
Outdated
| } | ||
| } | ||
|
|
||
| if cr.CompareVersionWith("1.12.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.
| if cr.CompareVersionWith("1.12.0") >= 0 { | |
| if cr.CompareVersionWith("1.13.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.
pkg/pxc/app/statefulset/proxysql.go
Outdated
| }, | ||
| } | ||
|
|
||
| if cr.CompareVersionWith("1.12.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.
| if cr.CompareVersionWith("1.12.0") >= 0 { | |
| if cr.CompareVersionWith("1.13.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.
pkg/apis/pxc/v1/pxc_types.go
Outdated
| } | ||
|
|
||
| if cr.CompareVersionWith("1.12.0") >= 0 && len(c.ProxySQL.PXCHandler) == 0 { | ||
| c.ProxySQL.PXCHandler = "internal" |
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.
Maybe have "internal" and "scheduler" as consts, and like that, you can briefly describe them, like what "internal" refers to.
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.
| // Foo foo = ...; | ||
| // Any any; | ||
| // any.PackFrom(foo); | ||
| // ... | ||
| // if (any.UnpackTo(&foo)) { | ||
| // ... | ||
| // } |
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.
[gofmt] reported by reviewdog 🐶
| // Foo foo = ...; | |
| // Any any; | |
| // any.PackFrom(foo); | |
| // ... | |
| // if (any.UnpackTo(&foo)) { | |
| // ... | |
| // } | |
| // Foo foo = ...; | |
| // Any any; | |
| // any.PackFrom(foo); | |
| // ... | |
| // if (any.UnpackTo(&foo)) { | |
| // ... | |
| // } |
| // Foo foo = ...; | ||
| // Any any = Any.pack(foo); | ||
| // ... | ||
| // if (any.is(Foo.class)) { | ||
| // foo = any.unpack(Foo.class); | ||
| // } | ||
| // | ||
| // Example 3: Pack and unpack a message in Python. | ||
| // | ||
| // foo = Foo(...) | ||
| // any = Any() | ||
| // any.Pack(foo) | ||
| // ... | ||
| // if any.Is(Foo.DESCRIPTOR): | ||
| // any.Unpack(foo) | ||
| // ... | ||
| // | ||
| // Example 4: Pack and unpack a message in Go | ||
| // | ||
| // foo := &pb.Foo{...} | ||
| // any, err := ptypes.MarshalAny(foo) | ||
| // ... | ||
| // foo := &pb.Foo{} | ||
| // if err := ptypes.UnmarshalAny(any, foo); err != nil { | ||
| // ... | ||
| // } |
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.
[gofmt] reported by reviewdog 🐶
| // Foo foo = ...; | |
| // Any any = Any.pack(foo); | |
| // ... | |
| // if (any.is(Foo.class)) { | |
| // foo = any.unpack(Foo.class); | |
| // } | |
| // | |
| // Example 3: Pack and unpack a message in Python. | |
| // | |
| // foo = Foo(...) | |
| // any = Any() | |
| // any.Pack(foo) | |
| // ... | |
| // if any.Is(Foo.DESCRIPTOR): | |
| // any.Unpack(foo) | |
| // ... | |
| // | |
| // Example 4: Pack and unpack a message in Go | |
| // | |
| // foo := &pb.Foo{...} | |
| // any, err := ptypes.MarshalAny(foo) | |
| // ... | |
| // foo := &pb.Foo{} | |
| // if err := ptypes.UnmarshalAny(any, foo); err != nil { | |
| // ... | |
| // } | |
| // Foo foo = ...; | |
| // Any any = Any.pack(foo); | |
| // ... | |
| // if (any.is(Foo.class)) { | |
| // foo = any.unpack(Foo.class); | |
| // } | |
| // | |
| // Example 3: Pack and unpack a message in Python. | |
| // | |
| // foo = Foo(...) | |
| // any = Any() | |
| // any.Pack(foo) | |
| // ... | |
| // if any.Is(Foo.DESCRIPTOR): | |
| // any.Unpack(foo) | |
| // ... | |
| // | |
| // Example 4: Pack and unpack a message in Go | |
| // | |
| // foo := &pb.Foo{...} | |
| // any, err := ptypes.MarshalAny(foo) | |
| // ... | |
| // foo := &pb.Foo{} | |
| // if err := ptypes.UnmarshalAny(any, foo); err != nil { | |
| // ... | |
| // } |
| // in the type URL, for example "foo.bar.com/x/y.z" will yield type | ||
| // name "y.z". | ||
| // | ||
| // |
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.
[gofmt] reported by reviewdog 🐶
| // |
| // package google.profile; | ||
| // message Person { | ||
| // string first_name = 1; | ||
| // string last_name = 2; | ||
| // } |
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.
[gofmt] reported by reviewdog 🐶
| // package google.profile; | |
| // message Person { | |
| // string first_name = 1; | |
| // string last_name = 2; | |
| // } | |
| // package google.profile; | |
| // message Person { | |
| // string first_name = 1; | |
| // string last_name = 2; | |
| // } |
| // { | ||
| // "@type": "type.googleapis.com/google.profile.Person", | ||
| // "firstName": <string>, | ||
| // "lastName": <string> | ||
| // } |
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.
[gofmt] reported by reviewdog 🐶
| // { | |
| // "@type": "type.googleapis.com/google.profile.Person", | |
| // "firstName": <string>, | |
| // "lastName": <string> | |
| // } | |
| // { | |
| // "@type": "type.googleapis.com/google.profile.Person", | |
| // "firstName": <string>, | |
| // "lastName": <string> | |
| // } |
|
|
||
| /* | ||
| VersionServiceOperatorOK describes a response with status code 200, with default header values. | ||
| /*VersionServiceOperatorOK handles this case with default header values. |
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.
[gofmt] reported by reviewdog 🐶
| /*VersionServiceOperatorOK handles this case with default header values. | |
| /* | |
| VersionServiceOperatorOK handles this case with default header values. |
|
|
||
| /* | ||
| VersionServiceOperatorDefault describes a response with status code -1, with default header values. | ||
| /*VersionServiceOperatorDefault handles this case with default header values. |
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.
[gofmt] reported by reviewdog 🐶
| /*VersionServiceOperatorDefault handles this case with default header values. | |
| /* | |
| VersionServiceOperatorDefault handles this case with default header values. |
| for the version service product operation. | ||
| Typically these are written to a http.Request. | ||
| /*VersionServiceProductParams contains all the parameters to send to the API endpoint |
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.
[gofmt] reported by reviewdog 🐶
| /*VersionServiceProductParams contains all the parameters to send to the API endpoint | |
| /* | |
| VersionServiceProductParams contains all the parameters to send to the API endpoint |
|
|
||
| /* | ||
| VersionServiceProductOK describes a response with status code 200, with default header values. | ||
| /*VersionServiceProductOK handles this case with default header values. |
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.
[gofmt] reported by reviewdog 🐶
| /*VersionServiceProductOK handles this case with default header values. | |
| /* | |
| VersionServiceProductOK handles this case with default header values. |
|
|
||
| /* | ||
| VersionServiceProductDefault describes a response with status code -1, with default header values. | ||
| /*VersionServiceProductDefault handles this case with default header values. |
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.
[gofmt] reported by reviewdog 🐶
| /*VersionServiceProductDefault handles this case with default header values. | |
| /* | |
| VersionServiceProductDefault handles this case with default header values. |
commit: 1de6526 |
|
Closing until further notice. |
CHANGE DESCRIPTION
PXC Scheduler Handler is an application that can run as standalone or invoked from ProxySQL scheduler. Its function is to manage integration between ProxySQL and Galera (from Codership), including its different implementations like PXC. The scope of PXC Scheduler Handler is to maintain the ProxySQL mysql_server table, in a way that the PXC cluster managed will suffer of minimal negative effects due to possible data node: failures, service degradation and maintenance.
Connected PR for ProxySQL docker image: percona/percona-docker#647
This PR adds a new option in CR under
.spec.proxysqlsection calledpxchandler.Values are:
internal- old scheduling managed by a shell script (https://github.com/percona/proxysql-admin-tool/blob/v2/proxysql-admin)scheduler- new scheduler written in golang which runs from inside proxysql and is installed inschedulertable in proxysql (https://github.com/percona/pxc_scheduler_handler)Entrypoint in proxysql image prepares all config files at the same time so it is possible to switch between old and new scheduler. If we need to enable new scheduler we first check if the old one is installed and then remove it and install the new one.
Config file for new scheduler is located in:
/etc/config.tomland it is enabled frompxc-monitsidecar.Scheduler is enabled/disabled by
percona-scheduler-adminscript located here: https://github.com/percona/proxysql-admin-tool/blob/v2/percona-scheduler-adminCHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability