File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
pkg/internal/mysqlcluster Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ package mysqlcluster
1919import (
2020 "fmt"
2121 "math"
22- "regexp"
2322
2423 core "k8s.io/api/core/v1"
2524 "k8s.io/apimachinery/pkg/api/resource"
@@ -106,7 +105,7 @@ func (cluster *MysqlCluster) SetDefaults(opt *options.Options) {
106105 maxBinlogSize = min (binlogSpaceLimit / 3 , 1 * gb )
107106 }
108107
109- if matched , err := regexp . MatchString ( "([a-z.]+/)*percona(:.+)?" , cluster . Spec . Image ); err != nil && matched {
108+ if cluster . IsPerconaImage () {
110109 // binlog-space-limit = totalSpace / 2
111110 setConfigIfNotSet (cluster .Spec .MysqlConf , "binlog-space-limit" , humanizeSize (binlogSpaceLimit ))
112111 }
Original file line number Diff line number Diff line change @@ -220,11 +220,16 @@ func (c *MysqlCluster) UpdateSpec() {
220220 }
221221}
222222
223+ // IsPerconaImage checks the MySQL image is percona or not
224+ func (c * MysqlCluster ) IsPerconaImage () bool {
225+ return strings .Contains (c .GetMysqlImage (), "percona" )
226+ }
227+
223228// ShouldHaveInitContainerForMysql checks the MySQL version and returns true or false if the docker image supports or not init only
224229func (c * MysqlCluster ) ShouldHaveInitContainerForMysql () bool {
225230 expectedRange := semver .MustParseRange (">=5.7.26 <8.0.0 || >=8.0.15" )
226231
227- return strings . Contains ( c . GetMysqlImage (), "percona" ) && expectedRange (c .GetMySQLSemVer ())
232+ return c . IsPerconaImage ( ) && expectedRange (c .GetMySQLSemVer ())
228233}
229234
230235// String returns the cluster name and namespace
You can’t perform that action at this time.
0 commit comments