resources

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: Apache-2.0 Imports: 4 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package resources contains a set of Kubernetes generic utilities that are used by the operator

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateIfNotFound

func CreateIfNotFound[T client.Object](ctx context.Context, c client.Client, obj T) error

CreateIfNotFound creates the given object if it doesn't already exist

func RetryAlways added in v1.17.3

func RetryAlways(err error) bool

RetryAlways is a function that always returns true on any error encountered

Types

type PatchType

type PatchType string

PatchType is the patch type to be used for patch requests

const (
	// PatchTypeStrategicMerge means use the strategic merge patch type, passing
	// just the diff to the API server
	PatchTypeStrategicMerge PatchType = "StrategicMerge"

	// PatchTypeMerge means use the merge strategy
	PatchTypeMerge PatchType = "Merge"
)

func (PatchType) BuildPatch

func (p PatchType) BuildPatch(current client.Object) client.Patch

BuildPatch creates a client.patch for the passed object

type Request

type Request[T client.Object] struct {
	// contains filtered or unexported fields
}

Request is a client request that adheres to the client.Client interface

func NewRequest

func NewRequest[T client.Object](c client.Client) *Request[T]

NewRequest instantiate a new request with the passed client

func (*Request[T]) CreateIfNotFound

func (r *Request[T]) CreateIfNotFound() *Request[T]

CreateIfNotFound will attempt to create the resource if it receives IsNotFound error

func (*Request[T]) Execute

func (r *Request[T]) Execute(
	ctx context.Context,
	proposed T,
) error

Execute will execute the request with the given instructions

func (*Request[T]) PatchAlways

func (r *Request[T]) PatchAlways() *Request[T]

PatchAlways will always try to attempt the patch of the retrieved resource with the proposed one

func (*Request[T]) WithCustomPatchConditions

func (r *Request[T]) WithCustomPatchConditions(conditions ...patchCondition[T]) *Request[T]

WithCustomPatchConditions will evaluate custom patch conditions

Jump to

Keyboard shortcuts

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