Skip to content

Commit b571bbb

Browse files
pooknullhors
andauthored
K8SPS-392: add validation for BOOTSTRAP_READ_TIMEOUT in reconciler (#914)
https://perconadev.atlassian.net/browse/K8SPS-392 Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
1 parent 0d8ec9d commit b571bbb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

api/v1alpha1/perconaservermysql_types.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"hash/fnv"
2323
"path"
2424
"regexp"
25+
"strconv"
2526
"strings"
2627

2728
cmmeta "github.com/cert-manager/cert-manager/pkg/apis/meta/v1"
@@ -803,6 +804,19 @@ func (cr *PerconaServerMySQL) CheckNSetDefaults(_ context.Context, serverVersion
803804
if cr.RouterEnabled() {
804805
return errors.New("MySQL Router can't be enabled for asynchronous replication")
805806
}
807+
808+
for _, env := range cr.Spec.MySQL.Env {
809+
if env.Name != naming.EnvBootstrapReadTimeout {
810+
continue
811+
}
812+
readTimeout, err := strconv.Atoi(env.Value)
813+
if err != nil {
814+
return errors.Wrap(err, "failed to parse BOOTSTRAP_READ_TIMEOUT")
815+
}
816+
if readTimeout < 0 {
817+
return errors.New("BOOTSTRAP_READ_TIMEOUT should be a positive value")
818+
}
819+
}
806820
}
807821

808822
if cr.RouterEnabled() && cr.HAProxyEnabled() {

0 commit comments

Comments
 (0)