Commit 301488b2 authored by Bowei Du's avatar Bowei Du

Expose all GCE cloud proivder services versions, not just the GA API

parent 13c80a99
...@@ -211,9 +211,17 @@ func init() { ...@@ -211,9 +211,17 @@ func init() {
}) })
} }
// Raw access to the underlying GCE service, probably should only be used for e2e tests // Services is the set of all versions of the compute service.
func (g *GCECloud) GetComputeService() *compute.Service { type Services struct {
return g.service // GA, Alpha, Beta versions of the compute API.
GA *compute.Service
Alpha *computealpha.Service
Beta *computebeta.Service
}
// ComputeServices returns access to the internal compute services.
func (g *GCECloud) ComputeServices() *Services {
return &Services{g.service, g.serviceAlpha, g.serviceBeta}
} }
// newGCECloud creates a new instance of GCECloud. // newGCECloud creates a new instance of GCECloud.
......
...@@ -100,7 +100,7 @@ func ConstructHealthCheckFirewallForLBService(clusterID string, svc *v1.Service, ...@@ -100,7 +100,7 @@ func ConstructHealthCheckFirewallForLBService(clusterID string, svc *v1.Service,
// GetInstanceTags gets tags from GCE instance with given name. // GetInstanceTags gets tags from GCE instance with given name.
func GetInstanceTags(cloudConfig CloudConfig, instanceName string) *compute.Tags { func GetInstanceTags(cloudConfig CloudConfig, instanceName string) *compute.Tags {
gceCloud := cloudConfig.Provider.(*gcecloud.GCECloud) gceCloud := cloudConfig.Provider.(*gcecloud.GCECloud)
res, err := gceCloud.GetComputeService().Instances.Get(cloudConfig.ProjectID, cloudConfig.Zone, res, err := gceCloud.ComputeServices().GA.Instances.Get(cloudConfig.ProjectID, cloudConfig.Zone,
instanceName).Do() instanceName).Do()
if err != nil { if err != nil {
Failf("Failed to get instance tags for %v: %v", instanceName, err) Failf("Failed to get instance tags for %v: %v", instanceName, err)
...@@ -113,7 +113,7 @@ func SetInstanceTags(cloudConfig CloudConfig, instanceName, zone string, tags [] ...@@ -113,7 +113,7 @@ func SetInstanceTags(cloudConfig CloudConfig, instanceName, zone string, tags []
gceCloud := cloudConfig.Provider.(*gcecloud.GCECloud) gceCloud := cloudConfig.Provider.(*gcecloud.GCECloud)
// Re-get instance everytime because we need the latest fingerprint for updating metadata // Re-get instance everytime because we need the latest fingerprint for updating metadata
resTags := GetInstanceTags(cloudConfig, instanceName) resTags := GetInstanceTags(cloudConfig, instanceName)
_, err := gceCloud.GetComputeService().Instances.SetTags( _, err := gceCloud.ComputeServices().GA.Instances.SetTags(
cloudConfig.ProjectID, zone, instanceName, cloudConfig.ProjectID, zone, instanceName,
&compute.Tags{Fingerprint: resTags.Fingerprint, Items: tags}).Do() &compute.Tags{Fingerprint: resTags.Fingerprint, Items: tags}).Do()
if err != nil { if err != nil {
......
...@@ -4335,7 +4335,7 @@ func ensureGCELoadBalancerResourcesDeleted(ip, portRange string) error { ...@@ -4335,7 +4335,7 @@ func ensureGCELoadBalancerResourcesDeleted(ip, portRange string) error {
} }
return wait.Poll(10*time.Second, 5*time.Minute, func() (bool, error) { return wait.Poll(10*time.Second, 5*time.Minute, func() (bool, error) {
service := gceCloud.GetComputeService() service := gceCloud.ComputeServices().GA
list, err := service.ForwardingRules.List(project, region).Do() list, err := service.ForwardingRules.List(project, region).Do()
if err != nil { if err != nil {
return false, err return false, err
......
...@@ -501,7 +501,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { ...@@ -501,7 +501,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() {
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
// Get a list of all zones in the project // Get a list of all zones in the project
zones, err := gceCloud.GetComputeService().Zones.List(framework.TestContext.CloudConfig.ProjectID).Do() zones, err := gceCloud.ComputeServices().GA.Zones.List(framework.TestContext.CloudConfig.ProjectID).Do()
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
for _, z := range zones.Items { for _, z := range zones.Items {
allZones.Insert(z.Name) allZones.Insert(z.Name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment