client

package
v1.13.0-rc.7 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package client contains an enhanced client.

Index

Constants

View Source
const ResourceConflictCode = "2008"

ResourceConflictCode is the code for API Server errors resulting from a mismatch between our cached set of objects and the cluster's..

Variables

This section is empty.

Functions

func ConflictCreateAlreadyExists

func ConflictCreateAlreadyExists(err error, resource client.Object) status.Error

ConflictCreateAlreadyExists means we tried to create an object which already exists.

func ConflictUpdateDoesNotExist

func ConflictUpdateDoesNotExist(err error, resource client.Object) status.Error

ConflictUpdateDoesNotExist means we tried to update an object which does not exist.

func ConflictUpdateOldVersion

func ConflictUpdateOldVersion(err error, resource client.Object) status.Error

ConflictUpdateOldVersion means we tried to update an object using an old version of the object.

func NoUpdateNeeded

func NoUpdateNeeded() error

NoUpdateNeeded returns an error code for update not required.

Types

type Client

type Client struct {
	client.Client

	MaxTries int
	// contains filtered or unexported fields
}

Client extends the controller-runtime client by exporting prometheus metrics and retrying updates.

func New

func New(client client.Client, latencyMetric *prometheus.HistogramVec) *Client

New returns a new Client.

func (*Client) Create

func (c *Client) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) status.Error

Create saves the object obj in the Kubernetes cluster and records prometheus metrics.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) status.Error

Delete deletes the given obj from Kubernetes cluster and records prometheus metrics. This automatically sets the propagation policy to always be "Background".

func (*Client) Update

func (c *Client) Update(ctx context.Context, obj client.Object, updateFn update) (client.Object, status.Error)

Update updates the given obj in the Kubernetes cluster.

func (*Client) UpdateStatus

func (c *Client) UpdateStatus(ctx context.Context, obj client.Object, updateFn update) (client.Object, status.Error)

UpdateStatus updates the given obj's status in the Kubernetes cluster.

func (*Client) Upsert

func (c *Client) Upsert(ctx context.Context, obj client.Object) status.Error

Upsert creates or updates the given obj in the Kubernetes cluster and records prometheus metrics. This operation always involves retrieving the resource from API Server before actually creating or updating it.

Jump to

Keyboard shortcuts

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