resource

package
v0.4.117 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ignore added in v0.3.4

func Ignore(is ErrorIs, err error) error

Ignore any errors that satisfy the supplied ErrorIs function by returning nil. Errors that do not satisfy the supplied function are returned unmodified.

func IgnoreAny added in v0.3.4

func IgnoreAny(err error, is ...ErrorIs) error

IgnoreAny ignores errors that satisfy any of the supplied ErrorIs functions by returning nil. Errors that do not satisfy any of the supplied functions are returned unmodified.

func IgnoreNotFound added in v0.3.4

func IgnoreNotFound(err error) error

IgnoreNotFound returns the supplied error, or nil if the error indicates a Kubernetes resource was not found.

func IgnoreUpdateWithoutGenerationChangePredicate added in v0.3.30

func IgnoreUpdateWithoutGenerationChangePredicate() predicate.Predicate

func IsAPIError added in v0.3.4

func IsAPIError(err error) bool

IsAPIError returns true if the given error's type is of Kubernetes API error.

func IsAPIErrorWrapped added in v0.3.4

func IsAPIErrorWrapped(err error) bool

IsAPIErrorWrapped returns true if err is a K8s API error, or recursively wraps a K8s API error

func IsNotAllowed added in v0.3.33

func IsNotAllowed(err error) bool

IsNotAllowed returns true if the supplied error indicates that an operation was not allowed.

func MustCreateObject added in v0.3.61

func MustCreateObject(kind schema.GroupVersionKind, oc runtime.ObjectCreater) runtime.Object

MustCreateObject returns a new Object of the supplied kind. It panics if the kind is unknown to the supplied ObjectCreator.

func NewPredicates added in v0.3.30

func NewPredicates(fn PredicateFn) predicate.Funcs

NewPredicates returns a set of Funcs that are all satisfied by the supplied PredicateFn. The PredicateFn is run against the new object during updates.

Types

type APIFinalizer added in v0.3.15

type APIFinalizer struct {
	// contains filtered or unexported fields
}

An APIFinalizer adds and removes finalizers to and from a resource.

func NewAPIFinalizer added in v0.3.17

func NewAPIFinalizer(c client.Client, finalizer string) *APIFinalizer

NewAPIFinalizer returns a new APIFinalizer.

func (*APIFinalizer) AddFinalizer added in v0.3.15

func (a *APIFinalizer) AddFinalizer(ctx context.Context, obj Object) error

AddFinalizer to the supplied Managed resource.

func (*APIFinalizer) AddFinalizerString added in v0.4.23

func (a *APIFinalizer) AddFinalizerString(ctx context.Context, obj Object, finalizerString string) error

AddFinalizer to the supplied Managed resource.

func (*APIFinalizer) HasOtherFinalizer added in v0.4.21

func (a *APIFinalizer) HasOtherFinalizer(ctx context.Context, obj Object) (bool, error)

func (*APIFinalizer) RemoveFinalizer added in v0.3.15

func (a *APIFinalizer) RemoveFinalizer(ctx context.Context, obj Object) error

RemoveFinalizer from the supplied Managed resource.

func (*APIFinalizer) RemoveFinalizerString added in v0.4.23

func (a *APIFinalizer) RemoveFinalizerString(ctx context.Context, obj Object, finalizerString string) error

RemoveFinalizer from the supplied Managed resource.

type APIPatchingApplicator added in v0.3.2

type APIPatchingApplicator struct {
	// contains filtered or unexported fields
}

An APIPatchingApplicator applies changes to an object by either creating or patching it in a Kubernetes API server.

func NewAPIPatchingApplicator added in v0.3.2

func NewAPIPatchingApplicator(c client.Client) *APIPatchingApplicator

NewAPIPatchingApplicator returns an Applicator that applies changes to an object by either creating or patching it in a Kubernetes API server.

func (*APIPatchingApplicator) Apply added in v0.3.3

Apply changes to the supplied object. The object will be created if it does not exist, or patched if it does. If the object does exist, it will only be patched if the passed object has the same or an empty resource version.

type APIUpdatingApplicator added in v0.3.32

type APIUpdatingApplicator struct {
	// contains filtered or unexported fields
}

An APIUpdatingApplicator applies changes to an object by either creating or updating it in a Kubernetes API server.

func NewAPIUpdatingApplicator added in v0.3.32

func NewAPIUpdatingApplicator(c client.Client) *APIUpdatingApplicator

NewAPIUpdatingApplicator returns an Applicator that applies changes to an object by either creating or updating it in a Kubernetes API server.

func (*APIUpdatingApplicator) Apply added in v0.3.32

Apply changes to the supplied object. The object will be created if it does not exist, or updated if it does.

type Active added in v0.3.57

type Active interface {
	SetActive(p bool)
	GetActive() bool
}

An Orphanable resource may specify a DeletionPolicy.

type Applicator added in v0.3.0

type Applicator interface {
	Apply(context.Context, client.Object, ...ApplyOption) error
}

An Applicator applies changes to an object.

type ApplyFn added in v0.3.0

type ApplyFn func(context.Context, client.Object, ...ApplyOption) error

An ApplyFn is a function that satisfies the Applicator interface.

func (ApplyFn) Apply added in v0.3.0

func (fn ApplyFn) Apply(ctx context.Context, o client.Object, ao ...ApplyOption) error

Apply changes to the supplied object.

type ApplyOption added in v0.3.0

type ApplyOption func(ctx context.Context, current, desired runtime.Object) error

An ApplyOption is called before patching the current object to match the desired object. ApplyOptions are not called if no current object exists.

func AllowUpdateIf added in v0.3.33

func AllowUpdateIf(fn func(current, desired runtime.Object) bool) ApplyOption

AllowUpdateIf will only update the current object if the supplied fn returns true. An error that satisfies IsNotAllowed will be returned if the supplied function returns false. Creation of a desired object that does not currently exist is always allowed.

func MustBeControllableBy added in v0.3.9

func MustBeControllableBy(u types.UID) ApplyOption

MustBeControllableBy requires that the current object is controllable by an object with the supplied UID. An object is controllable if its controller reference matches the supplied UID, or it has no controller reference. An error that satisfies IsNotControllable will be returned if the current object cannot be controlled by the supplied UID.

func UpdateFn added in v0.3.0

func UpdateFn(fn func(current, desired runtime.Object)) ApplyOption

UpdateFn returns an ApplyOption that is used to modify the current object to match fields of the desired.

type ClientApplicator added in v0.3.0

type ClientApplicator struct {
	client.Client
	Applicator
}

A ClientApplicator may be used to build a single 'client' that satisfies both client.Client and Applicator.

type Conditioned

type Conditioned interface {
	SetConditions(c ...nddv1.Condition)
	GetCondition(ck nddv1.ConditionKind) nddv1.Condition
}

A Conditioned may have conditions set or retrieved. Conditions are typically indicate the status of both a resource and its reconciliation process.

type EnqueueRequestForNetworkNode added in v0.3.68

type EnqueueRequestForNetworkNode struct{}

EnqueueRequestForNetworkNode enqueues a reconcile.Request for a referenced NetworkNode.

func (*EnqueueRequestForNetworkNode) Create added in v0.3.68

Create adds a NamespacedName for the supplied CreateEvent if its Object is a NetworkNodeReferencer.

func (*EnqueueRequestForNetworkNode) Delete added in v0.3.68

Delete adds a NamespacedName for the supplied DeleteEvent if its Object is a NetworkNodeReferencer.

func (*EnqueueRequestForNetworkNode) Generic added in v0.3.68

Generic adds a NamespacedName for the supplied GenericEvent if its Object is a NetworkNodeReferencer.

func (*EnqueueRequestForNetworkNode) Update added in v0.3.68

Update adds a NamespacedName for the supplied UpdateEvent if its Objects are a NetworkNodeReferencer.

type ErrorIs added in v0.3.4

type ErrorIs func(err error) bool

An ErrorIs function returns true if an error satisfies a particular condition.

type ExternalLeafRefs added in v0.4.86

type ExternalLeafRefs interface {
	SetExternalLeafRefs(externalResourceNames []string)
	GetExternalLeafRefs() []string
}

type Finalizer added in v0.3.16

type Finalizer interface {
	AddFinalizer(ctx context.Context, obj Object) error
	RemoveFinalizer(ctx context.Context, obj Object) error
	HasOtherFinalizer(ctx context.Context, obj Object) (bool, error)
	AddFinalizerString(ctx context.Context, obj Object, finalizerString string) error
	RemoveFinalizerString(ctx context.Context, obj Object, finalizerString string) error
}

A Finalizer manages the finalizers on the resource.

type FinalizerFns added in v0.3.51

type FinalizerFns struct {
	AddFinalizerFn          func(ctx context.Context, obj Object) error
	RemoveFinalizerFn       func(ctx context.Context, obj Object) error
	HasOtherFinalizerFn     func(ctx context.Context, obj Object) (bool, error)
	AddFinalizerStringFn    func(ctx context.Context, obj Object, finalizerString string) error
	RemoveFinalizerStringFn func(ctx context.Context, obj Object, finalizerString string) error
}

A FinalizerFns satisfy the Finalizer interface.

func (FinalizerFns) AddFinalizer added in v0.3.51

func (f FinalizerFns) AddFinalizer(ctx context.Context, obj Object) error

AddFinalizer to the supplied resource.

func (FinalizerFns) AddFinalizerString added in v0.4.23

func (f FinalizerFns) AddFinalizerString(ctx context.Context, obj Object, finalizerString string) error

AddFinalizer to the supplied resource.

func (FinalizerFns) HasOtherFinalizer added in v0.4.21

func (f FinalizerFns) HasOtherFinalizer(ctx context.Context, obj Object) (bool, error)

RemoveFinalizer from the supplied resource.

func (FinalizerFns) RemoveFinalizer added in v0.3.51

func (f FinalizerFns) RemoveFinalizer(ctx context.Context, obj Object) error

RemoveFinalizer from the supplied resource.

func (FinalizerFns) RemoveFinalizerString added in v0.4.23

func (f FinalizerFns) RemoveFinalizerString(ctx context.Context, obj Object, finalizerString string) error

RemoveFinalizer from the supplied resource.

type Managed added in v0.3.54

A Managed is a Kubernetes object representing a concrete managed resource (e.g. a CloudSQL instance).

type ManagedKind added in v0.3.64

type ManagedKind schema.GroupVersionKind

A ManagedKind contains the type metadata for a kind of managed resource.

type ManagedList added in v0.3.54

type ManagedList interface {
	client.ObjectList

	// GetItems returns the list of managed resources.
	GetItems() []Managed
}

A ManagedList is a list of managed resources.

type NetworkNode added in v0.3.68

type NetworkNode interface {
	Object

	UserCounter
	Conditioned
}

A NetworkNode configures a NetworkNode Device Driver.

type NetworkNodeKinds added in v0.3.68

type NetworkNodeKinds struct {
	Config    schema.GroupVersionKind
	Usage     schema.GroupVersionKind
	UsageList schema.GroupVersionKind
}

NetworkNodeKinds contains the type metadata for a kind of network node.

type NetworkNodeReferencer added in v0.3.68

type NetworkNodeReferencer interface {
	GetNetworkNodeReference() *nddv1.Reference
	SetNetworkNodeReference(p *nddv1.Reference)
}

A NetworkNodeReferencer may reference a Network Node resource.

type NetworkNodeUsage added in v0.3.68

A NetworkNodeUsage indicates a usage of a network node config.

type NetworkNodeUsageList added in v0.3.68

type NetworkNodeUsageList interface {
	client.ObjectList

	// GetItems returns the list of network node usages.
	GetItems() []NetworkNodeUsage
}

A NetworkNodeUsageList is a list of network node usages.

type NetworkNodeUsageTracker added in v0.3.68

type NetworkNodeUsageTracker struct {
	// contains filtered or unexported fields
}

A NetworkNodeUsageTracker tracks usages of a NetworkNode by creating or updating the appropriate NetworkNodeUsage.

func NewNetworkNodeUsageTracker added in v0.3.68

func NewNetworkNodeUsageTracker(c client.Client, of NetworkNodeUsage) *NetworkNodeUsageTracker

NewNetworkNodeUsageTracker creates a NetworkNodeUsageTracker.

func (*NetworkNodeUsageTracker) Track added in v0.3.68

Track that the supplied Managed resource is using the NetworkNode it references by creating or updating a NetworkNodeUsage. Track should be called _before_ attempting to use the NetworkNode. This ensures the managed resource's usage is updated if the managed resource is updated to reference a misconfigured NetworkNode.

type Object

type Object interface {
	metav1.Object
	runtime.Object
}

An Object is a Kubernetes object.

type Orphanable added in v0.3.54

type Orphanable interface {
	SetDeletionPolicy(p nddv1.DeletionPolicy)
	GetDeletionPolicy() nddv1.DeletionPolicy
}

An Orphanable resource may specify a DeletionPolicy.

type PredicateFn added in v0.3.30

type PredicateFn func(obj runtime.Object) bool

A PredicateFn returns true if the supplied object should be reconciled.

type RequiredNetworkNodeReferencer added in v0.3.68

type RequiredNetworkNodeReferencer interface {
	GetNetworkNodeReference() nddv1.Reference
	SetNetworkNodeReference(p nddv1.Reference)
}

A RequiredNetworkNodeReferencer may reference a network node config resource. Unlike NetworkNodeReferencer, the reference is required (i.e. not nil).

type RequiredTypedResourceReferencer added in v0.3.59

type RequiredTypedResourceReferencer interface {
	SetResourceReference(r nddv1.TypedReference)
	GetResourceReference() nddv1.TypedReference
}

A RequiredTypedResourceReferencer can reference a resource.

type ResourceIndexes added in v0.4.90

type ResourceIndexes interface {
	SetResourceIndexes(resourceIndexes map[string]string)
	GetResourceIndexes() map[string]string
}

type Target added in v0.3.76

type Target interface {
	SetTarget(target []string)
	GetTarget() []string
}

A Target may have targets

type Tracker added in v0.3.66

type Tracker interface {
	// Track the supplied managed resource.
	Track(ctx context.Context, mg Managed) error
}

A Tracker tracks managed resources.

type TrackerFn added in v0.3.66

type TrackerFn func(ctx context.Context, mg Managed) error

A TrackerFn is a function that tracks managed resources.

func (TrackerFn) Track added in v0.3.66

func (fn TrackerFn) Track(ctx context.Context, mg Managed) error

Track the supplied managed resource.

type UserCounter added in v0.3.61

type UserCounter interface {
	SetUsers(i int64)
	GetUsers() int64
}

A UserCounter can count how many users it has.

Jump to

Keyboard shortcuts

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