Remove multiple calls to CreateInstanceGroups by reusing results from a single call
This commit is contained in:
parent
0f4f5c97d4
commit
937cde666e
10 changed files with 68 additions and 75 deletions
|
|
@ -63,8 +63,7 @@ func (i *Instances) Init(zl zoneLister) {
|
|||
// all of which have the exact same named port.
|
||||
func (i *Instances) AddInstanceGroup(name string, port int64) ([]*compute.InstanceGroup, *compute.NamedPort, error) {
|
||||
igs := []*compute.InstanceGroup{}
|
||||
// TODO: move port naming to namer
|
||||
namedPort := &compute.NamedPort{Name: fmt.Sprintf("port%v", port), Port: port}
|
||||
namedPort := utils.GetNamedPort(port)
|
||||
|
||||
zones, err := i.ListZones()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ import (
|
|||
|
||||
// Helper method to create instance groups.
|
||||
// This method exists to ensure that we are using the same logic at all places.
|
||||
func CreateInstanceGroups(nodePool NodePool, namer *utils.Namer, port int64) ([]*compute.InstanceGroup, *compute.NamedPort, error) {
|
||||
func EnsureInstanceGroupsAndPorts(nodePool NodePool, namer *utils.Namer, port int64) ([]*compute.InstanceGroup, *compute.NamedPort, error) {
|
||||
return nodePool.AddInstanceGroup(namer.IGName(), port)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue