Skip to content

Commit

Permalink
add new function to get image for init container
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielZhangQD committed Nov 7, 2019
1 parent 063d760 commit eb6b0b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions pkg/controller/controller_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ func TiKVCapacity(limits *v1alpha1.ResourceRequirement) string {
return fmt.Sprintf("%dMB", i/humanize.MiByte)
}

// Reuse the SlowLogTailer image for TiDB
func GetUtilImage(cluster *v1alpha1.TidbCluster) string {
if img := cluster.Spec.TiDB.SlowLogTailer.Image; img != "" {
return img
}
return defaultTiDBLogTailerImage
}

func GetSlowLogTailerImage(cluster *v1alpha1.TidbCluster) string {
if img := cluster.Spec.TiDB.SlowLogTailer.Image; img != "" {
return img
Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/member/tidb_member_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func getNewTiDBSetForTidbCluster(tc *v1alpha1.TidbCluster) *apps.StatefulSet {
privileged := true
initContainers = append(initContainers, corev1.Container{
Name: "init",
Image: controller.GetSlowLogTailerImage(tc),
Image: controller.GetUtilImage(tc),
Command: []string{
"sh",
"-c",
Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/member/tikv_member_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func getNewTiKVSetForTidbCluster(tc *v1alpha1.TidbCluster) (*apps.StatefulSet, e
privileged := true
initContainers = append(initContainers, corev1.Container{
Name: "init",
Image: controller.GetSlowLogTailerImage(tc),
Image: controller.GetUtilImage(tc),
Command: []string{
"sh",
"-c",
Expand Down

0 comments on commit eb6b0b2

Please sign in to comment.