Skip to content

Commit

Permalink
use utils
Browse files Browse the repository at this point in the history
  • Loading branch information
zetaab committed Feb 27, 2019
1 parent ea40009 commit ab21a63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions pkg/model/openstackmodel/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ go_library(
"//upup/pkg/fi/cloudup/openstack:go_default_library",
"//upup/pkg/fi/cloudup/openstacktasks:go_default_library",
"//upup/pkg/fi/fitasks:go_default_library",
"//util/pkg/slice:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
],
)
11 changes: 5 additions & 6 deletions pkg/model/openstackmodel/servergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"k8s.io/kops/upup/pkg/fi/cloudup/openstack"
"k8s.io/kops/upup/pkg/fi/cloudup/openstacktasks"
"k8s.io/kops/upup/pkg/fi/fitasks"
"k8s.io/kops/util/pkg/slice"
)

// ServerGroupModelBuilder configures server group objects
Expand Down Expand Up @@ -73,13 +74,11 @@ func (b *ServerGroupModelBuilder) buildInstances(c *fi.ModelBuilderContext, sg *
igUserData = fi.String(startupStr)
}

uniqueZones := make(map[string]string)
for _, subnet := range b.Cluster.Spec.Subnets {
uniqueZones[subnet.Zone] = ""
}
var zones []string
for k := range uniqueZones {
zones = append(zones, k)
for _, subnet := range b.Cluster.Spec.Subnets {
if !slice.Contains(zones, subnet.Zone) {
zones = append(zones, subnet.Zone)
}
}

// In the future, OpenStack will use Machine API to manage groups,
Expand Down

0 comments on commit ab21a63

Please sign in to comment.