Merge pull request #65838 from WanLinghao/clusterinfo_fix

Automatic merge from submit-queue (batch tested with PRs 65838, 65837). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix kubectl cluster-info bug

**What this PR does / why we need it**:
   When api-server is not avaiable,` kubectl cluster-info `still prints information like: the cluster is running at ...
    This patch fixes this bug

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes: #65817 

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
pull/8/head
Kubernetes Submit Queue 2018-07-06 11:03:01 -07:00 committed by GitHub
commit b6c52143be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -92,8 +92,6 @@ func (o *ClusterInfoOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) err
}
func (o *ClusterInfoOptions) Run() error {
printService(o.Out, "Kubernetes master", o.Client.Host)
// TODO use generalized labels once they are implemented (#341)
b := o.Builder.
WithScheme(legacyscheme.Scheme).
@ -105,6 +103,8 @@ func (o *ClusterInfoOptions) Run() error {
if err != nil {
return err
}
printService(o.Out, "Kubernetes master", o.Client.Host)
services := r.Object.(*api.ServiceList).Items
for _, service := range services {
var link string