@@ -33,6 +33,8 @@ import (
33
33
operatoropts "github.com/oracle/mysql-operator/pkg/options/operator"
34
34
"github.com/oracle/mysql-operator/pkg/resources/secrets"
35
35
"github.com/oracle/mysql-operator/pkg/version"
36
+
37
+ goverion "github.com/hashicorp/go-version"
36
38
)
37
39
38
40
const (
@@ -48,6 +50,8 @@ const (
48
50
mySQLSSLVolumeName = "mysqlsslvolume"
49
51
50
52
replicationGroupPort = 13306
53
+
54
+ minMysqlVersionWithGroupExitStateArgs = "8.0.12"
51
55
)
52
56
53
57
func volumeMounts (cluster * v1alpha1.Cluster ) []v1.VolumeMount {
@@ -155,6 +159,24 @@ func getReplicationGroupSeeds(name string, members int) string {
155
159
return strings .Join (seeds , "," )
156
160
}
157
161
162
+ func checkSupportGroupExitStateArgs (deployingVersion string ) bool {
163
+ ver , err := goverion .NewVersion (deployingVersion )
164
+ if err != nil {
165
+ return false
166
+ }
167
+
168
+ minVer , err := goverion .NewVersion (minMysqlVersionWithGroupExitStateArgs )
169
+ if err != nil {
170
+ return false
171
+ }
172
+
173
+ if ver .GreaterThan (minVer ) || ver .Equal (minVer ) {
174
+ return true
175
+ }
176
+
177
+ return false
178
+ }
179
+
158
180
// Builds the MySQL operator container for a cluster.
159
181
// The 'mysqlImage' parameter is the image name of the mysql server to use with
160
182
// no version information.. e.g. 'mysql/mysql-server'
@@ -172,7 +194,6 @@ func mysqlServerContainer(cluster *v1alpha1.Cluster, mysqlServerImage string, ro
172
194
"--master-info-repository=TABLE" ,
173
195
"--relay-log-info-repository=TABLE" ,
174
196
"--transaction-write-set-extraction=XXHASH64" ,
175
- "--group-replication-exit-state-action=READ_ONLY" ,
176
197
fmt .Sprintf ("--relay-log=%s-${index}-relay-bin" , cluster .Name ),
177
198
fmt .Sprintf ("--report-host=\" %[1]s-${index}.%[1]s\" " , cluster .Name ),
178
199
"--log-error-verbosity=3" ,
@@ -185,6 +206,10 @@ func mysqlServerContainer(cluster *v1alpha1.Cluster, mysqlServerImage string, ro
185
206
"--ssl-key=/etc/ssl/mysql/tls.key" )
186
207
}
187
208
209
+ if checkSupportGroupExitStateArgs (cluster .Spec .Version ) {
210
+ args = append (args , "--group-replication-exit-state-action=READ_ONLY" )
211
+ }
212
+
188
213
entryPointArgs := strings .Join (args , " " )
189
214
190
215
cmd := fmt .Sprintf (`
0 commit comments