mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
Increase the client-specified timeout for service create/update/delete.
This is only temporary until external load balancer creation is changed to be asynchronous.
This commit is contained in:
parent
df672504c2
commit
ab67cba7fb
@ -19,6 +19,7 @@ package client
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
|
||||||
@ -26,6 +27,10 @@ import (
|
|||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TODO(a-robinson): Remove this explicit timeout and the calls to
|
||||||
|
// request.Timeout() that use it once #5180 is in.
|
||||||
|
const extendedTimeout = 4 * time.Minute
|
||||||
|
|
||||||
// ServicesNamespacer has methods to work with Service resources in a namespace
|
// ServicesNamespacer has methods to work with Service resources in a namespace
|
||||||
type ServicesNamespacer interface {
|
type ServicesNamespacer interface {
|
||||||
Services(namespace string) ServiceInterface
|
Services(namespace string) ServiceInterface
|
||||||
@ -84,7 +89,9 @@ func (c *services) Create(svc *api.Service) (result *api.Service, err error) {
|
|||||||
if needNamespace && len(namespace) == 0 {
|
if needNamespace && len(namespace) == 0 {
|
||||||
namespace = api.NamespaceDefault
|
namespace = api.NamespaceDefault
|
||||||
}
|
}
|
||||||
err = c.r.Post().Namespace(namespace).Resource("services").Body(svc).Do().Into(result)
|
request := c.r.Post()
|
||||||
|
request.Timeout(extendedTimeout)
|
||||||
|
err = request.Namespace(namespace).Resource("services").Body(svc).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +108,9 @@ func (c *services) Update(svc *api.Service) (result *api.Service, err error) {
|
|||||||
if needNamespace && len(namespace) == 0 {
|
if needNamespace && len(namespace) == 0 {
|
||||||
namespace = api.NamespaceDefault
|
namespace = api.NamespaceDefault
|
||||||
}
|
}
|
||||||
err = c.r.Put().Namespace(namespace).Resource("services").Name(svc.Name).Body(svc).Do().Into(result)
|
request := c.r.Put()
|
||||||
|
request.Timeout(extendedTimeout)
|
||||||
|
err = request.Namespace(namespace).Resource("services").Name(svc.Name).Body(svc).Do().Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +122,9 @@ func (c *services) Delete(name string) error {
|
|||||||
if needNamespace && len(namespace) == 0 {
|
if needNamespace && len(namespace) == 0 {
|
||||||
namespace = api.NamespaceDefault
|
namespace = api.NamespaceDefault
|
||||||
}
|
}
|
||||||
return c.r.Delete().Namespace(c.ns).Resource("services").Name(name).Do().Error()
|
request := c.r.Delete()
|
||||||
|
request.Timeout(extendedTimeout)
|
||||||
|
return request.Namespace(c.ns).Resource("services").Name(name).Do().Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested services.
|
// Watch returns a watch.Interface that watches the requested services.
|
||||||
|
Loading…
Reference in New Issue
Block a user