Skip to content

Commit 1bc8687

Browse files
committed
K8SPXC-1071 - Set default value for proxysql scheduler
1 parent e77f84d commit 1bc8687

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pkg/apis/pxc/v1/pxc_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,10 @@ func (cr *PerconaXtraDBCluster) CheckNSetDefaults(serverVersion *version.ServerV
737737
c.ProxySQL.ImagePullPolicy = corev1.PullAlways
738738
}
739739

740+
if len(c.ProxySQL.Scheduler) == 0 {
741+
c.ProxySQL.Scheduler = "percona"
742+
}
743+
740744
c.ProxySQL.VolumeSpec.reconcileOpts()
741745

742746
if len(c.SSLSecretName) > 0 {

pkg/pxc/queries/queries.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,12 @@ func (p *Database) PresentInHostgroups(host string) (bool, error) {
313313

314314
func (p *Database) PrimaryHost(scheduler string) (string, error) {
315315
var host string
316-
var writerID int
316+
317+
// value of writer group is hardcoded in ProxySQL config inside docker image
318+
// https://github.com/percona/percona-docker/blob/pxc-operator-1.3.0/proxysql/dockerdir/etc/proxysql-admin.cnf#L23
319+
var writerID = 11
317320
if scheduler == "percona" {
318321
writerID = 100
319-
} else {
320-
// value of writer group is hardcoded in ProxySQL config inside docker image
321-
// https://github.com/percona/percona-docker/blob/pxc-operator-1.3.0/proxysql/dockerdir/etc/proxysql-admin.cnf#L23
322-
writerID = 11
323322
}
324323

325324
err := p.db.QueryRow("SELECT hostname FROM runtime_mysql_servers WHERE hostgroup_id = ?", writerID).Scan(&host)

0 commit comments

Comments
 (0)