From 048c372ce5273e1c826543e3b832b7474f7bc08a Mon Sep 17 00:00:00 2001 From: Tomislav Plavcic Date: Mon, 17 Oct 2022 12:44:00 +0200 Subject: [PATCH] Leverage k8s API validation for Scheduler field --- pkg/apis/pxc/v1/pxc_types.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/apis/pxc/v1/pxc_types.go b/pkg/apis/pxc/v1/pxc_types.go index 0834d16f9c..17abc5995c 100644 --- a/pkg/apis/pxc/v1/pxc_types.go +++ b/pkg/apis/pxc/v1/pxc_types.go @@ -289,10 +289,6 @@ func (cr *PerconaXtraDBCluster) Validate() error { if err := c.ProxySQL.VolumeSpec.validate(); err != nil { return errors.Wrap(err, "ProxySQL: validate volume spec") } - - if len(c.ProxySQL.Scheduler) > 0 && c.ProxySQL.Scheduler != "percona" && c.ProxySQL.Scheduler != "proxysql-admin" { - return errors.New("proxysql.scheduler valid values are percona or proxysql-admin") - } } if c.Backup != nil { @@ -406,7 +402,8 @@ type HAProxySpec struct { } type ProxySQLSpec struct { - PodSpec `json:",inline"` + PodSpec `json:",inline"` + // +kubebuilder:validation:Enum={percona,proxysql-admin} Scheduler string `json:"scheduler,omitempty"` }