mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
[gce provider] Wrapper for beta backend servvice create/update
This commit is contained in:
parent
23b4690d00
commit
c516a35d4d
@ -115,6 +115,7 @@ var AllServices = []*ServiceInfo{
|
|||||||
keyType: Global,
|
keyType: Global,
|
||||||
serviceType: reflect.TypeOf(&beta.BackendServicesService{}),
|
serviceType: reflect.TypeOf(&beta.BackendServicesService{}),
|
||||||
additionalMethods: []string{
|
additionalMethods: []string{
|
||||||
|
"Update",
|
||||||
"SetSecurityPolicy",
|
"SetSecurityPolicy",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -74,13 +74,23 @@ func (gce *GCECloud) UpdateGlobalBackendService(bg *compute.BackendService) erro
|
|||||||
return mc.Observe(gce.c.BackendServices().Update(ctx, meta.GlobalKey(bg.Name), bg))
|
return mc.Observe(gce.c.BackendServices().Update(ctx, meta.GlobalKey(bg.Name), bg))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateBetaGlobalBackendService applies the given beta BackendService as an
|
||||||
|
// update to an existing service.
|
||||||
|
func (gce *GCECloud) UpdateBetaGlobalBackendService(bg *computebeta.BackendService) error {
|
||||||
|
ctx, cancel := cloud.ContextWithCallTimeout()
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
mc := newBackendServiceMetricContextWithVersion("update", "", computeBetaVersion)
|
||||||
|
return mc.Observe(gce.c.BetaBackendServices().Update(ctx, meta.GlobalKey(bg.Name), bg))
|
||||||
|
}
|
||||||
|
|
||||||
// UpdateAlphaGlobalBackendService applies the given alpha BackendService as an
|
// UpdateAlphaGlobalBackendService applies the given alpha BackendService as an
|
||||||
// update to an existing service.
|
// update to an existing service.
|
||||||
func (gce *GCECloud) UpdateAlphaGlobalBackendService(bg *computealpha.BackendService) error {
|
func (gce *GCECloud) UpdateAlphaGlobalBackendService(bg *computealpha.BackendService) error {
|
||||||
ctx, cancel := cloud.ContextWithCallTimeout()
|
ctx, cancel := cloud.ContextWithCallTimeout()
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
mc := newBackendServiceMetricContext("update", "")
|
mc := newBackendServiceMetricContextWithVersion("update", "", computeAlphaVersion)
|
||||||
return mc.Observe(gce.c.AlphaBackendServices().Update(ctx, meta.GlobalKey(bg.Name), bg))
|
return mc.Observe(gce.c.AlphaBackendServices().Update(ctx, meta.GlobalKey(bg.Name), bg))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,12 +112,21 @@ func (gce *GCECloud) CreateGlobalBackendService(bg *compute.BackendService) erro
|
|||||||
return mc.Observe(gce.c.BackendServices().Insert(ctx, meta.GlobalKey(bg.Name), bg))
|
return mc.Observe(gce.c.BackendServices().Insert(ctx, meta.GlobalKey(bg.Name), bg))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateBetaGlobalBackendService creates the given beta BackendService.
|
||||||
|
func (gce *GCECloud) CreateBetaGlobalBackendService(bg *computebeta.BackendService) error {
|
||||||
|
ctx, cancel := cloud.ContextWithCallTimeout()
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
mc := newBackendServiceMetricContextWithVersion("create", "", computeBetaVersion)
|
||||||
|
return mc.Observe(gce.c.BetaBackendServices().Insert(ctx, meta.GlobalKey(bg.Name), bg))
|
||||||
|
}
|
||||||
|
|
||||||
// CreateAlphaGlobalBackendService creates the given alpha BackendService.
|
// CreateAlphaGlobalBackendService creates the given alpha BackendService.
|
||||||
func (gce *GCECloud) CreateAlphaGlobalBackendService(bg *computealpha.BackendService) error {
|
func (gce *GCECloud) CreateAlphaGlobalBackendService(bg *computealpha.BackendService) error {
|
||||||
ctx, cancel := cloud.ContextWithCallTimeout()
|
ctx, cancel := cloud.ContextWithCallTimeout()
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
mc := newBackendServiceMetricContext("create", "")
|
mc := newBackendServiceMetricContextWithVersion("create", "", computeAlphaVersion)
|
||||||
return mc.Observe(gce.c.AlphaBackendServices().Insert(ctx, meta.GlobalKey(bg.Name), bg))
|
return mc.Observe(gce.c.AlphaBackendServices().Insert(ctx, meta.GlobalKey(bg.Name), bg))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user