Skip to content

Commit

Permalink
Fix tkctl version does not work when the release name is un-wan… (#1065)
Browse files Browse the repository at this point in the history
Signed-off-by: Aylei <rayingecho@gmail.com>
  • Loading branch information
aylei authored and tennix committed Oct 29, 2019
1 parent 624e55a commit cd96a78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ vendor
tests/e2e/e2e.test
.orig
tkc
/tkctl
8 changes: 4 additions & 4 deletions pkg/tkctl/cmd/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ 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
}
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
Expand All @@ -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 {
Expand All @@ -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)
}
Expand Down

0 comments on commit cd96a78

Please sign in to comment.