From cd96a781d9aa321cdce14741317a1a33750537e3 Mon Sep 17 00:00:00 2001 From: Aylei Date: Tue, 29 Oct 2019 17:53:14 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20tkctl=20version=20does=20not=20work=20whe?= =?UTF-8?q?n=20the=20release=20name=20is=20un-wan=E2=80=A6=20(#1065)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aylei --- .gitignore | 1 + pkg/tkctl/cmd/version/version.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index aa7503d9b2..ebadaf5e82 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ vendor tests/e2e/e2e.test .orig tkc +/tkctl diff --git a/pkg/tkctl/cmd/version/version.go b/pkg/tkctl/cmd/version/version.go index 1ae0cf44eb..3dc00007cc 100644 --- a/pkg/tkctl/cmd/version/version.go +++ b/pkg/tkctl/cmd/version/version.go @@ -80,7 +80,7 @@ func (o *VersionOptions) runVersion(tkcContext *config.TkcContext) error { controllers, err := kubeCli.AppsV1(). Deployments(core.NamespaceAll). List(v1.ListOptions{ - LabelSelector: fmt.Sprintf("%s=%s,%s=%s", label.ComponentLabelKey, "controller-manager", label.InstanceLabelKey, "operator"), + LabelSelector: fmt.Sprintf("%s=%s,%s=%s", label.ComponentLabelKey, "controller-manager", label.NameLabelKey, "tidb-operator"), }) if err != nil { return err @@ -88,7 +88,7 @@ func (o *VersionOptions) runVersion(tkcContext *config.TkcContext) error { schedulers, err := kubeCli.AppsV1(). Deployments(core.NamespaceAll). List(v1.ListOptions{ - LabelSelector: fmt.Sprintf("%s=%s,%s=%s", label.ComponentLabelKey, "scheduler", label.InstanceLabelKey, "operator"), + LabelSelector: fmt.Sprintf("%s=%s,%s=%s", label.ComponentLabelKey, "scheduler", label.NameLabelKey, "tidb-operator"), }) if err != nil { return nil @@ -103,7 +103,7 @@ func (o *VersionOptions) runVersion(tkcContext *config.TkcContext) error { } else { fmt.Fprintf(o, "TiDB Controller Manager Versions:\n") for _, item := range controllers.Items { - fmt.Fprintf(o, "\t%s: %s\n", item.Name, item.Spec.Template.Spec.Containers[0].Image) + fmt.Fprintf(o, "\t%s/%s: %s\n", item.Namespace, item.Name, item.Spec.Template.Spec.Containers[0].Image) } } if len(schedulers.Items) == 0 { @@ -115,7 +115,7 @@ func (o *VersionOptions) runVersion(tkcContext *config.TkcContext) error { } } else { // warn for multiple scheduler - fmt.Fprintf(o, "WARN: more than one TiDB Scheduler instance found, this is un-supported and may lead to un-expected behavior:\n") + fmt.Fprintf(o, "WARN: more than one TiDB Scheduler deployment found, this is un-supported and may lead to un-expected behavior:\n") for _, item := range schedulers.Items { fmt.Fprintf(o, "\t%s\n", item.Name) }