mirror of https://github.com/kubernetes/kops.git
Merge pull request #1405 from justinsb/get_clusters_should_print_zones
kops get clusters should print zones
This commit is contained in:
commit
9382ede351
|
@ -27,6 +27,7 @@ import (
|
|||
"k8s.io/kops/pkg/apis/kops/registry"
|
||||
"k8s.io/kops/util/pkg/tables"
|
||||
k8sapi "k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/util/sets"
|
||||
)
|
||||
|
||||
type GetClusterOptions struct {
|
||||
|
@ -126,14 +127,14 @@ func RunGetClusters(context Factory, out io.Writer, options *GetClusterOptions)
|
|||
t.AddColumn("CLOUD", func(c *api.Cluster) string {
|
||||
return c.Spec.CloudProvider
|
||||
})
|
||||
t.AddColumn("SUBNETS", func(c *api.Cluster) string {
|
||||
var subnetNames []string
|
||||
t.AddColumn("ZONES", func(c *api.Cluster) string {
|
||||
zones := sets.NewString()
|
||||
for _, s := range c.Spec.Subnets {
|
||||
subnetNames = append(subnetNames, s.Name)
|
||||
zones.Insert(s.Zone)
|
||||
}
|
||||
return strings.Join(subnetNames, ",")
|
||||
return strings.Join(zones.List(), ",")
|
||||
})
|
||||
return t.Render(clusters, out, "NAME", "CLOUD", "SUBNETS")
|
||||
return t.Render(clusters, out, "NAME", "CLOUD", "ZONES")
|
||||
|
||||
case OutputYaml:
|
||||
for i, cluster := range clusters {
|
||||
|
|
Loading…
Reference in New Issue