mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-31 16:46:54 +00:00
Expose all GCE cloud proivder services versions, not just the GA API
This commit is contained in:
@@ -211,9 +211,17 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
// Raw access to the underlying GCE service, probably should only be used for e2e tests
|
||||
func (g *GCECloud) GetComputeService() *compute.Service {
|
||||
return g.service
|
||||
// Services is the set of all versions of the compute service.
|
||||
type Services struct {
|
||||
// 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.
|
||||
|
@@ -100,7 +100,7 @@ func ConstructHealthCheckFirewallForLBService(clusterID string, svc *v1.Service,
|
||||
// GetInstanceTags gets tags from GCE instance with given name.
|
||||
func GetInstanceTags(cloudConfig CloudConfig, instanceName string) *compute.Tags {
|
||||
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()
|
||||
if err != nil {
|
||||
Failf("Failed to get instance tags for %v: %v", instanceName, err)
|
||||
@@ -113,7 +113,7 @@ func SetInstanceTags(cloudConfig CloudConfig, instanceName, zone string, tags []
|
||||
gceCloud := cloudConfig.Provider.(*gcecloud.GCECloud)
|
||||
// Re-get instance everytime because we need the latest fingerprint for updating metadata
|
||||
resTags := GetInstanceTags(cloudConfig, instanceName)
|
||||
_, err := gceCloud.GetComputeService().Instances.SetTags(
|
||||
_, err := gceCloud.ComputeServices().GA.Instances.SetTags(
|
||||
cloudConfig.ProjectID, zone, instanceName,
|
||||
&compute.Tags{Fingerprint: resTags.Fingerprint, Items: tags}).Do()
|
||||
if err != nil {
|
||||
|
@@ -4335,7 +4335,7 @@ func ensureGCELoadBalancerResourcesDeleted(ip, portRange string) 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()
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
@@ -501,7 +501,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
// 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())
|
||||
for _, z := range zones.Items {
|
||||
allZones.Insert(z.Name)
|
||||
|
Reference in New Issue
Block a user