client

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ControllerClientRequestLatencyKey metrics key for recording time cost
	// of controller client requests
	ControllerClientRequestLatencyKey = "controller_client_request_time_seconds"
)

Variables

View Source
var (
	// CachedGVKs identifies the GVKs of resources to be cached during dispatching
	CachedGVKs = ""
)
View Source
var DefaultTimeoutClientOptions = &TimeoutOptions{
	RequestTimeout:            10 * time.Second,
	LongRunningRequestTimeout: 30 * time.Second,
	MutatingRequestTimeout:    15 * time.Second,
}

DefaultTimeoutClientOptions options for default timeout

Functions

func AddFlags

func AddFlags(set *pflag.FlagSet)

AddFlags add flags for default controller client

func AddTimeoutControllerClientFlags

func AddTimeoutControllerClientFlags(set *pflag.FlagSet)

AddTimeoutControllerClientFlags add flags for default timeout controller client

func DefaultNewControllerClient

func DefaultNewControllerClient(cache cache.Cache, config *rest.Config, options client.Options, uncachedObjects ...client.Object) (c client.Client, err error)

DefaultNewControllerClient function for creating controller client

func WrapDefaultTimeoutClient

func WrapDefaultTimeoutClient(c client.Client) client.Client

WrapDefaultTimeoutClient wrap client with DefaultTimeoutClientOptions

Types

type DelegatingHandlerClient

type DelegatingHandlerClient struct {
	client.Client
	Getter func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
	Lister func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
}

DelegatingHandlerClient override the original client's function

func (DelegatingHandlerClient) Get

Get resource by overridden getter

func (DelegatingHandlerClient) List

List resource by overridden lister

type TimeoutClient

type TimeoutClient struct {
	client.Client
	TimeoutOptions
}

TimeoutClient add timeout limit for requests

func (*TimeoutClient) Create

func (in *TimeoutClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

Create .

func (*TimeoutClient) Delete

func (in *TimeoutClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

Delete .

func (*TimeoutClient) DeleteAllOf

func (in *TimeoutClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

DeleteAllOf .

func (*TimeoutClient) Get

func (in *TimeoutClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error

Get .

func (*TimeoutClient) List

func (in *TimeoutClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

List .

func (*TimeoutClient) Patch

func (in *TimeoutClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

Patch .

func (*TimeoutClient) Status

func (in *TimeoutClient) Status() client.StatusWriter

Status .

func (*TimeoutClient) SubResource

func (in *TimeoutClient) SubResource(subResource string) client.SubResourceClient

SubResource .

func (*TimeoutClient) Update

func (in *TimeoutClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

Update .

type TimeoutOptions

type TimeoutOptions struct {
	RequestTimeout            time.Duration
	LongRunningRequestTimeout time.Duration
	MutatingRequestTimeout    time.Duration
}

TimeoutOptions timeout options for controller client

func (*TimeoutOptions) WithLongRunningTimeout

func (in *TimeoutOptions) WithLongRunningTimeout(ctx context.Context) (context.Context, context.CancelFunc)

WithLongRunningTimeout return timout context if LongRunningRequestTimeout is greater than 0

func (*TimeoutOptions) WithMutatingTimeout

func (in *TimeoutOptions) WithMutatingTimeout(ctx context.Context) (context.Context, context.CancelFunc)

WithMutatingTimeout return timout context if WithMutatingTimeout is greater than 0

func (*TimeoutOptions) WithTimeout

WithTimeout return timeout context if RequestTimeout is greater than 0

type TimeoutStatusWriter

type TimeoutStatusWriter struct {
	client.StatusWriter
	TimeoutOptions
}

TimeoutStatusWriter add timeout limit for requests

func (*TimeoutStatusWriter) Patch

Patch .

func (*TimeoutStatusWriter) Update

Update .

type TimeoutSubResourceClient

type TimeoutSubResourceClient struct {
	client.SubResourceClient
	TimeoutOptions
}

TimeoutSubResourceClient add timeout limit for requests

func (*TimeoutSubResourceClient) Create

Create .

func (*TimeoutSubResourceClient) Get

Get .

func (*TimeoutSubResourceClient) Patch

Patch .

func (*TimeoutSubResourceClient) Update

Update .

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL