util

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBackoff = wait.Backoff{
	Steps:    4,
	Duration: 10 * time.Millisecond,
	Factor:   5.0,
	Jitter:   0.1,
}

DefaultBackoff is the recommended backoff for a conflict where a client may be attempting to make an unrelated modification to a resource under active management by one or more controllers.

View Source
var DefaultRetry = wait.Backoff{
	Steps:    5,
	Duration: 10 * time.Millisecond,
	Factor:   1.0,
	Jitter:   0.1,
}

DefaultRetry is the recommended retry for a conflict where multiple clients are making changes to the same resource.

Functions

func IsIPv4 added in v1.21.0

func IsIPv4(str string) bool

IsIPv4 checks whether IP address is IPv4

func RetryOnError

func RetryOnError(backoff wait.Backoff, retriable func(error) bool, fn func() error) error

RetryOnError allows the caller to retry fn in case the error returned by fn is retriable according to the provided function. backoff defines the maximum retries and the wait interval between two retries.

Types

type FakeClientWrapper added in v1.21.0

type FakeClientWrapper struct {

	// Set these functions if you want to override the default fakeClient behavior
	GetFunc    func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
	CreateFunc func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
	UpdateFunc func(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
	DeleteFunc func(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
	ListFunc   func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
	// contains filtered or unexported fields
}

FakeClientWrapper allows functions to be replaced for fault injection

func NewFakeClientWrapper added in v1.21.0

func NewFakeClientWrapper(fakeClient client.Client) *FakeClientWrapper

NewFakeClientWrapper creates a FakeClientWrapper

func (*FakeClientWrapper) Create added in v1.21.0

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

Create saves the object obj in the Kubernetes cluster.

func (*FakeClientWrapper) Delete added in v1.21.0

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

Delete deletes the given obj from Kubernetes cluster.

func (*FakeClientWrapper) DeleteAllOf added in v1.21.0

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

DeleteAllOf deletes all objects of the given type matching the given options.

func (*FakeClientWrapper) Get added in v1.21.0

Get retrieves an obj for the given object key from the Kubernetes Cluster.

func (*FakeClientWrapper) List added in v1.21.0

List retrieves list of objects for a given namespace and list options.

func (*FakeClientWrapper) Patch added in v1.21.0

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

Patch patches the given obj in the Kubernetes cluster.

func (*FakeClientWrapper) RESTMapper added in v1.23.0

func (w *FakeClientWrapper) RESTMapper() meta.RESTMapper

RESTMapper invokes the fakeClient's RESTMapper

func (*FakeClientWrapper) Scheme added in v1.23.0

func (w *FakeClientWrapper) Scheme() *runtime.Scheme

Scheme invokes the fakeClient's Scheme

func (*FakeClientWrapper) Status added in v1.21.0

Status returns a StatusWriter which knows how to update status subresource of a Kubernetes object.

func (*FakeClientWrapper) SubResource added in v1.25.2

func (w *FakeClientWrapper) SubResource(subResource string) client.SubResourceClient

SubResource returns a SubResourceClient for the resource.

func (*FakeClientWrapper) Update added in v1.21.0

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

Update updates the given obj in the Kubernetes cluster.

type FakeRouteSetClientWrapper added in v1.21.0

type FakeRouteSetClientWrapper struct {

	// Set these functions if you want to override the default fakeClient behavior
	GetFunc    func(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RouteSet, err error)
	CreateFunc func(ctx context.Context, routeSet *v1alpha1.RouteSet, opts v1.CreateOptions) (result *v1alpha1.RouteSet, err error)
	DeleteFunc func(ctx context.Context, name string, opts v1.DeleteOptions) error
	ListFunc   func(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RouteSetList, err error)
	// contains filtered or unexported fields
}

FakeRouteSetClientWrapper allows functions to be replaced for fault injection

func NewFakeRouteSetClientWrapper added in v1.21.0

func NewFakeRouteSetClientWrapper(fakeClient *fake.Clientset) *FakeRouteSetClientWrapper

NewFakeRouteSetClientWrapper creates a FakeClientWrapper

func (*FakeRouteSetClientWrapper) Create added in v1.21.0

func (w *FakeRouteSetClientWrapper) Create(ctx context.Context, route *v1alpha1.RouteSet, options v1.CreateOptions) (result *v1alpha1.RouteSet, err error)

Create saves the object obj in the Kubernetes cluster.

func (*FakeRouteSetClientWrapper) Delete added in v1.21.0

func (w *FakeRouteSetClientWrapper) Delete(ctx context.Context, name string, options v1.DeleteOptions) error

Delete deletes the given obj from Kubernetes cluster.

func (*FakeRouteSetClientWrapper) Discovery added in v1.21.0

Discovery retrieves the DiscoveryClient

func (*FakeRouteSetClientWrapper) Get added in v1.21.0

func (w *FakeRouteSetClientWrapper) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RouteSet, err error)

Get retrieves an obj for the given object key from the Kubernetes Cluster.

func (*FakeRouteSetClientWrapper) List added in v1.21.0

func (w *FakeRouteSetClientWrapper) List(ctx context.Context, options v1.ListOptions) (result *v1alpha1.RouteSetList, err error)

List retrieves list of objects for a given namespace and list options.

func (*FakeRouteSetClientWrapper) NsxV1alpha1 added in v1.21.0

NsxV1alpha1 retrieves the NsxV1alpha1Client

Jump to

Keyboard shortcuts

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