Use formatLabel instead of label.Set

This commit is contained in:
Deyuan Deng 2014-11-24 18:41:11 -05:00
parent 610ab9a0db
commit ec7d544194
2 changed files with 11 additions and 12 deletions

View File

@ -80,9 +80,9 @@ $ export KUBERNETES_PROVIDER=vagrant
$ ./cluster/kubecfg.sh list /minions $ ./cluster/kubecfg.sh list /minions
Minion identifier Labels Minion identifier Labels
---------- ---------- ---------- ----------
10.245.2.4 10.245.2.4 <none>
10.245.2.3 10.245.2.3 <none>
10.245.2.2 10.245.2.2 <none>
``` ```
### Interacting with your Kubernetes cluster with the `kube-*` scripts. ### Interacting with your Kubernetes cluster with the `kube-*` scripts.
@ -143,9 +143,9 @@ Your cluster is running, you can list the minions in your cluster:
$ cluster/kubecfg.sh list /minions $ cluster/kubecfg.sh list /minions
Minion identifier Labels Minion identifier Labels
---------- ---------- ---------- ----------
10.245.2.4 10.245.2.4 <none>
10.245.2.3 10.245.2.3 <none>
10.245.2.2 10.245.2.2 <none>
``` ```
Now start running some containers! Now start running some containers!

View File

@ -28,7 +28,6 @@ import (
"text/template" "text/template"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" "github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/golang/glog" "github.com/golang/glog"
"gopkg.in/v1/yaml" "gopkg.in/v1/yaml"
@ -243,7 +242,7 @@ func printPod(pod *api.Pod, w io.Writer) error {
_, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n",
pod.Name, firstImage, pod.Name, firstImage,
podHostString(pod.Status.Host, pod.Status.HostIP), podHostString(pod.Status.Host, pod.Status.HostIP),
labels.Set(pod.Labels), pod.Status.Phase) formatLabels(pod.Labels), pod.Status.Phase)
if err != nil { if err != nil {
return err return err
} }
@ -269,7 +268,7 @@ func printPodList(podList *api.PodList, w io.Writer) error {
func printReplicationController(controller *api.ReplicationController, w io.Writer) error { func printReplicationController(controller *api.ReplicationController, w io.Writer) error {
_, err := fmt.Fprintf(w, "%s\t%s\t%s\t%d\n", _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%d\n",
controller.Name, makeImageList(&controller.Spec.Template.Spec), controller.Name, makeImageList(&controller.Spec.Template.Spec),
labels.Set(controller.Spec.Selector), controller.Spec.Replicas) formatLabels(controller.Spec.Selector), controller.Spec.Replicas)
return err return err
} }
@ -283,8 +282,8 @@ func printReplicationControllerList(list *api.ReplicationControllerList, w io.Wr
} }
func printService(svc *api.Service, w io.Writer) error { func printService(svc *api.Service, w io.Writer) error {
_, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\n", svc.Name, labels.Set(svc.Labels), _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\n", svc.Name, formatLabels(svc.Labels),
labels.Set(svc.Spec.Selector), svc.Spec.PortalIP, svc.Spec.Port) formatLabels(svc.Spec.Selector), svc.Spec.PortalIP, svc.Spec.Port)
return err return err
} }
@ -298,7 +297,7 @@ func printServiceList(list *api.ServiceList, w io.Writer) error {
} }
func printMinion(minion *api.Minion, w io.Writer) error { func printMinion(minion *api.Minion, w io.Writer) error {
_, err := fmt.Fprintf(w, "%s\t%s\n", minion.Name, labels.Set(minion.Labels)) _, err := fmt.Fprintf(w, "%s\t%s\n", minion.Name, formatLabels(minion.Labels))
return err return err
} }