Documentation ¶
Overview ¶
Package client contains an enhanced client.
Index ¶
- Constants
- func ConflictCreateAlreadyExists(err error, resource client.Object) status.Error
- func ConflictUpdateDoesNotExist(err error, resource client.Object) status.Error
- func ConflictUpdateOldVersion(err error, resource client.Object) status.Error
- func NoUpdateNeeded() error
- type Client
- func (c *Client) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) status.Error
- func (c *Client) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) status.Error
- func (c *Client) Update(ctx context.Context, obj client.Object, updateFn update) (client.Object, status.Error)
- func (c *Client) UpdateStatus(ctx context.Context, obj client.Object, updateFn update) (client.Object, status.Error)
- func (c *Client) Upsert(ctx context.Context, obj client.Object) status.Error
Constants ¶
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 ¶
ConflictCreateAlreadyExists means we tried to create an object which already exists.
func ConflictUpdateDoesNotExist ¶
ConflictUpdateDoesNotExist means we tried to update an object which does not exist.
func ConflictUpdateOldVersion ¶
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 ¶
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.