Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #1065: Fix tkctl version does not work when the release name is #1073

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +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, "tidb-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, "tidb-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