Skip to content

Commit

Permalink
Leverage k8s API validation for Scheduler field
Browse files Browse the repository at this point in the history
  • Loading branch information
tplavcic committed Oct 17, 2022
1 parent b7d00a7 commit 048c372
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/apis/pxc/v1/pxc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"`
}

Expand Down

0 comments on commit 048c372

Please sign in to comment.