Skip to content

Commit b1e94c4

Browse files
drivebyercndoit18
authored andcommitted
add sidecar image
1 parent 657127c commit b1e94c4

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pkg/apis/mysql/v1alpha1/mysqlcluster_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ type MysqlClusterSpec struct {
5757
// +optional
5858
Image string `json:"image,omitempty"`
5959

60+
// To specify the image that will be used for sidecar container.
61+
// It will override --sidecar-image or --sidecar-mysql8-image flags.
62+
// +optional
63+
SidecarImage string `json:"sidecarImage,omitempty"`
64+
6065
// A bucket URL that contains a xtrabackup to initialize the mysql database.
6166
// +optional
6267
InitBucketURL string `json:"initBucketURL,omitempty"`

pkg/internal/mysqlcluster/mysqlcluster.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,14 @@ func (c *MysqlCluster) GetNamespacedName() types.NamespacedName {
268268

269269
// GetSidecarImage selects the sidecar docker image based on mysql version
270270
func (c *MysqlCluster) GetSidecarImage() string {
271+
if c.Spec.SidecarImage != "" {
272+
return c.Spec.SidecarImage
273+
}
271274
// decide the sidecar image based on mysql version
272-
sidecarImage := options.GetOptions().SidecarMysql57Image
273275
if c.GetMySQLSemVer().Major == 8 {
274-
sidecarImage = options.GetOptions().SidecarMysql8Image
276+
return options.GetOptions().SidecarMysql8Image
275277
}
276-
277-
return sidecarImage
278+
return options.GetOptions().SidecarMysql57Image
278279
}
279280

280281
// IsClusterReady checks if the cluster is ready or not.

0 commit comments

Comments
 (0)