-
Notifications
You must be signed in to change notification settings - Fork 190
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
K8SPXC-1071: Add Percona scheduler for ProxySQL #1436
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
@@ -813,6 +819,10 @@ func (cr *PerconaXtraDBCluster) CheckNSetDefaults(serverVersion *version.ServerV | |||
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
@@ -147,6 +147,13 @@ func (c *Proxy) AppContainer(spec *api.PodSpec, secrets string, cr *api.PerconaX | |||
} | |||
} | |||
|
|||
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
@@ -236,6 +243,30 @@ func (c *Proxy) SidecarContainers(spec *api.PodSpec, secrets string, cr *api.Per | |||
}, | |||
}, | |||
} | |||
|
|||
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
@@ -813,6 +819,10 @@ func (cr *PerconaXtraDBCluster) CheckNSetDefaults(serverVersion *version.ServerV | |||
c.ProxySQL.ImagePullPolicy = corev1.PullAlways | |||
} | |||
|
|||
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 { | |
// ... | |
// } |
// | ||
// The pack methods provided by protobuf library will by default use | ||
// 'type.googleapis.com/full.type.name' as the type URL and the unpack | ||
// methods only use the fully qualified type name after the last '/' | ||
// 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> | |
// } |
@@ -46,8 +46,7 @@ func NewVersionServiceOperatorOK() *VersionServiceOperatorOK { | |||
return &VersionServiceOperatorOK{} | |||
} | |||
|
|||
/* | |||
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. |
@@ -81,8 +81,7 @@ func NewVersionServiceOperatorDefault(code int) *VersionServiceOperatorDefault { | |||
} | |||
} | |||
|
|||
/* | |||
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 |
@@ -46,8 +46,7 @@ func NewVersionServiceProductOK() *VersionServiceProductOK { | |||
return &VersionServiceProductOK{} | |||
} | |||
|
|||
/* | |||
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. |
@@ -81,8 +81,7 @@ func NewVersionServiceProductDefault(code int) *VersionServiceProductDefault { | |||
} | |||
} | |||
|
|||
/* | |||
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.proxysql
section 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 inscheduler
table 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.toml
and it is enabled frompxc-monit
sidecar.Scheduler is enabled/disabled by
percona-scheduler-admin
script 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