Documentation
¶
Index ¶
- type Client
- func (rc *Client) BackoffMultiplier() float64
- func (rc *Client) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) (err error)
- func (rc *Client) CreateOrPatch(ctx context.Context, obj client.Object, f controllerutil.MutateFn) (res controllerutil.OperationResult, err error)
- func (rc *Client) CreateOrUpdate(ctx context.Context, obj client.Object, f controllerutil.MutateFn) (res controllerutil.OperationResult, err error)
- func (rc *Client) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) (err error)
- func (rc *Client) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) (err error)
- func (rc *Client) Get(ctx context.Context, key client.ObjectKey, obj client.Object, ...) (err error)
- func (rc *Client) GroupVersionKindFor(obj runtime.Object) (gvk schema.GroupVersionKind, err error)
- func (rc *Client) Interval() time.Duration
- func (rc *Client) IsObjectNamespaced(obj runtime.Object) (namespaced bool, err error)
- func (rc *Client) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) (err error)
- func (rc *Client) MaxAttempts() int
- func (rc *Client) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) (err error)
- func (rc *Client) RESTMapper() meta.RESTMapper
- func (rc *Client) Scheme() *runtime.Scheme
- func (rc *Client) Status() client.SubResourceWriter
- func (rc *Client) SubResource(subResource string) client.SubResourceClient
- func (rc *Client) Timeout() time.Duration
- func (rc *Client) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) (err error)
- func (rc *Client) WithBackoffMultiplier(multiplier float64) *Client
- func (rc *Client) WithContext(ctx context.Context) *Client
- func (rc *Client) WithInterval(interval time.Duration) *Client
- func (rc *Client) WithMaxAttempts(maxAttempts int) *Client
- func (rc *Client) WithTimeout(timeout time.Duration) *Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewRetryingClient ¶
NewRetryingClient returns a retry.Client that implements client.Client, but retries each operation that can fail with the specified parameters. Returns nil if the provided client is nil. The default parameters are: - interval: 100 milliseconds - backoffMultiplier: 1.0 (no backoff) - maxAttempts: 0 (no limit on attempts) - timeout: 1 second (timeout for retries) Use the builder-style With... methods to adapt the parameters.
func (*Client) BackoffMultiplier ¶
BackoffMultiplier returns the configured backoff multiplier for retries.
func (*Client) Create ¶
func (rc *Client) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) (err error)
Create wraps the client's Create method and retries it on failure.
func (*Client) CreateOrPatch ¶
func (rc *Client) CreateOrPatch(ctx context.Context, obj client.Object, f controllerutil.MutateFn) (res controllerutil.OperationResult, err error)
CreateOrPatch wraps the controllerutil.CreateOrPatch function and retries it on failure.
func (*Client) CreateOrUpdate ¶
func (rc *Client) CreateOrUpdate(ctx context.Context, obj client.Object, f controllerutil.MutateFn) (res controllerutil.OperationResult, err error)
CreateOrUpdate wraps the controllerutil.CreateOrUpdate function and retries it on failure.
func (*Client) Delete ¶
func (rc *Client) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) (err error)
Delete wraps the client's Delete method and retries it on failure.
func (*Client) DeleteAllOf ¶
func (rc *Client) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) (err error)
DeleteAllOf wraps the client's DeleteAllOf method and retries it on failure.
func (*Client) Get ¶
func (rc *Client) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) (err error)
Get wraps the client's Get method and retries it on failure.
func (*Client) GroupVersionKindFor ¶
GroupVersionKindFor wraps the client's GroupVersionKindFor method and retries it on failure.
func (*Client) IsObjectNamespaced ¶
IsObjectNamespaced wraps the client's IsObjectNamespaced method and retries it on failure.
func (*Client) List ¶
func (rc *Client) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) (err error)
List wraps the client's List method and retries it on failure.
func (*Client) MaxAttempts ¶
MaxAttempts returns the configured maximum number of retries.
func (*Client) Patch ¶
func (rc *Client) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) (err error)
Patch wraps the client's Patch method and retries it on failure.
func (*Client) RESTMapper ¶
func (rc *Client) RESTMapper() meta.RESTMapper
RESTMapper calls the internal client's RESTMapper method.
func (*Client) Status ¶
func (rc *Client) Status() client.SubResourceWriter
Status calls the internal client's Status method.
func (*Client) SubResource ¶
func (rc *Client) SubResource(subResource string) client.SubResourceClient
SubResource calls the internal client's SubResource method.
func (*Client) Update ¶
func (rc *Client) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) (err error)
Update wraps the client's Update method and retries it on failure.
func (*Client) WithBackoffMultiplier ¶
WithBackoffMultiplier sets the backoff multiplier for the Client. After each retry, the configured interval is multiplied by this factor. Setting it to a value less than 1 will default it to 1. Default is 1.0, meaning no backoff. Noop if the multiplier is less than 1. It returns the Client for chaining.
func (*Client) WithContext ¶
WithContext sets the context for the next call of either GroupVersionKindFor or IsObjectNamespaced. Since the signature of these methods does not allow passing a context, and the retrying can not be cancelled without one, this method is required to inject the context to be used for the aforementioned methods. Note that any function of this Client that actually retries an operation will reset this context, but only for GroupVersionKindFor and IsObjectNamespaced it will actually be used. The intended use of this method is something like this:
c.WithContext(ctx).GroupVersionKindFor(obj) c.WithContext(ctx).IsObjectNamespaced(obj)
If no context is injected via this method, both GroupVersionKindFor and IsObjectNamespaced will use the default context.Background(). It returns the Client for chaining.
func (*Client) WithInterval ¶
WithInterval sets the retry interval for the Client. Default is 100 milliseconds. Noop if the interval is less than or equal to 0. It returns the Client for chaining.
func (*Client) WithMaxAttempts ¶
WithMaxAttempts sets the maximum number of attempts for the Client. If set to 0, it will retry indefinitely until the timeout is reached. Default is 0, meaning no limit on attempts. Noop if the maxAttempts is less than 0. It returns the Client for chaining.
func (*Client) WithTimeout ¶
WithTimeout sets the timeout for retries in the Client. If set to 0, there is no timeout and it will retry until the maximum number of retries is reached. Default is 1 second. Noop if the timeout is less than 0. It returns the Client for chaining.