Update gce cloud calls after api changes
This commit is contained in:
parent
9b22796383
commit
8dc3d4764f
6 changed files with 76 additions and 53 deletions
|
|
@ -81,10 +81,11 @@ func (f *FakeInstanceGroups) GetInstanceGroup(name, zone string) (*compute.Insta
|
|||
}
|
||||
|
||||
// CreateInstanceGroup fakes instance group creation.
|
||||
func (f *FakeInstanceGroups) CreateInstanceGroup(name, zone string) (*compute.InstanceGroup, error) {
|
||||
newGroup := &compute.InstanceGroup{Name: name, SelfLink: name, Zone: zone}
|
||||
f.instanceGroups = append(f.instanceGroups, newGroup)
|
||||
return newGroup, nil
|
||||
func (f *FakeInstanceGroups) CreateInstanceGroup(ig *compute.InstanceGroup, zone string) error {
|
||||
ig.SelfLink = ig.Name
|
||||
ig.Zone = zone
|
||||
f.instanceGroups = append(f.instanceGroups, ig)
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteInstanceGroup fakes instance group deletion.
|
||||
|
|
|
|||
|
|
@ -77,7 +77,10 @@ func (i *Instances) AddInstanceGroup(name string, port int64) ([]*compute.Instan
|
|||
var err error
|
||||
if ig == nil {
|
||||
glog.Infof("Creating instance group %v in zone %v", name, zone)
|
||||
ig, err = i.cloud.CreateInstanceGroup(name, zone)
|
||||
if err = i.cloud.CreateInstanceGroup(&compute.InstanceGroup{Name: name}, zone); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
ig, err = i.cloud.GetInstanceGroup(name, zone)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ type NodePool interface {
|
|||
// InstanceGroups is an interface for managing gce instances groups, and the instances therein.
|
||||
type InstanceGroups interface {
|
||||
GetInstanceGroup(name, zone string) (*compute.InstanceGroup, error)
|
||||
CreateInstanceGroup(name, zone string) (*compute.InstanceGroup, error)
|
||||
CreateInstanceGroup(ig *compute.InstanceGroup, zone string) error
|
||||
DeleteInstanceGroup(name, zone string) error
|
||||
|
||||
// TODO: Refactor for modulatiry.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue