Documentation ¶
Index ¶
- func Ignore(is ErrorIs, err error) error
- func IgnoreAny(err error, is ...ErrorIs) error
- func IgnoreNotFound(err error) error
- func IgnoreUpdateWithoutGenerationChangePredicate() predicate.Predicate
- func IsAPIError(err error) bool
- func IsAPIErrorWrapped(err error) bool
- func IsNotAllowed(err error) bool
- func MustCreateObject(kind schema.GroupVersionKind, oc runtime.ObjectCreater) runtime.Object
- func NewPredicates(fn PredicateFn) predicate.Funcs
- type APIFinalizer
- func (a *APIFinalizer) AddFinalizer(ctx context.Context, obj Object) error
- func (a *APIFinalizer) AddFinalizerString(ctx context.Context, obj Object, finalizerString string) error
- func (a *APIFinalizer) HasOtherFinalizer(ctx context.Context, obj Object) (bool, error)
- func (a *APIFinalizer) RemoveFinalizer(ctx context.Context, obj Object) error
- func (a *APIFinalizer) RemoveFinalizerString(ctx context.Context, obj Object, finalizerString string) error
- type APIPatchingApplicator
- type APIUpdatingApplicator
- type Applicator
- type ApplyFn
- type ApplyOption
- type ClientApplicator
- type Conditioned
- type EnqueueRequestForTarget
- func (e *EnqueueRequestForTarget) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForTarget) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForTarget) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForTarget) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
- type ErrorIs
- type Finalizer
- type FinalizerFns
- func (f FinalizerFns) AddFinalizer(ctx context.Context, obj Object) error
- func (f FinalizerFns) AddFinalizerString(ctx context.Context, obj Object, finalizerString string) error
- func (f FinalizerFns) HasOtherFinalizer(ctx context.Context, obj Object) (bool, error)
- func (f FinalizerFns) RemoveFinalizer(ctx context.Context, obj Object) error
- func (f FinalizerFns) RemoveFinalizerString(ctx context.Context, obj Object, finalizerString string) error
- type HealthConditioned
- type Lifecycle
- type Managed
- type ManagedKind
- type ManagedList
- type Object
- type PredicateFn
- type RequiredTargetReferencer
- type RequiredTypedResourceReferencer
- type RootPaths
- type Target
- type TargetKinds
- type TargetReferencer
- type TargetUsage
- type TargetUsageList
- type TargetUsageTracker
- type Tracker
- type TrackerFn
- type UserCounter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ignore ¶
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 ¶
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 ¶
IgnoreNotFound returns the supplied error, or nil if the error indicates a Kubernetes resource was not found.
func IsAPIError ¶
IsAPIError returns true if the given error's type is of Kubernetes API error.
func IsAPIErrorWrapped ¶
IsAPIErrorWrapped returns true if err is a K8s API error, or recursively wraps a K8s API error
func IsNotAllowed ¶
IsNotAllowed returns true if the supplied error indicates that an operation was not allowed.
func MustCreateObject ¶
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 ¶
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 ¶
type APIFinalizer struct {
// contains filtered or unexported fields
}
An APIFinalizer adds and removes finalizers to and from a resource.
func NewAPIFinalizer ¶
func NewAPIFinalizer(c client.Client, finalizer string) *APIFinalizer
NewAPIFinalizer returns a new APIFinalizer.
func (*APIFinalizer) AddFinalizer ¶
func (a *APIFinalizer) AddFinalizer(ctx context.Context, obj Object) error
AddFinalizer to the supplied Managed resource.
func (*APIFinalizer) AddFinalizerString ¶
func (a *APIFinalizer) AddFinalizerString(ctx context.Context, obj Object, finalizerString string) error
AddFinalizer to the supplied Managed resource.
func (*APIFinalizer) HasOtherFinalizer ¶
func (*APIFinalizer) RemoveFinalizer ¶
func (a *APIFinalizer) RemoveFinalizer(ctx context.Context, obj Object) error
RemoveFinalizer from the supplied Managed resource.
func (*APIFinalizer) RemoveFinalizerString ¶
func (a *APIFinalizer) RemoveFinalizerString(ctx context.Context, obj Object, finalizerString string) error
RemoveFinalizer from the supplied Managed resource.
type APIPatchingApplicator ¶
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 ¶
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 ¶
func (a *APIPatchingApplicator) Apply(ctx context.Context, o client.Object, ao ...ApplyOption) error
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 ¶
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 ¶
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 ¶
func (a *APIUpdatingApplicator) Apply(ctx context.Context, o client.Object, ao ...ApplyOption) error
Apply changes to the supplied object. The object will be created if it does not exist, or updated if it does.
type Applicator ¶
An Applicator applies changes to an object.
type ApplyOption ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 EnqueueRequestForTarget ¶ added in v0.5.7
type EnqueueRequestForTarget struct{}
EnqueueRequestForTarget enqueues a reconcile.Request for a referenced Target.
func (*EnqueueRequestForTarget) Create ¶ added in v0.5.7
func (e *EnqueueRequestForTarget) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
Create adds a NamespacedName for the supplied CreateEvent if its Object is a TargetReferencer.
func (*EnqueueRequestForTarget) Delete ¶ added in v0.5.7
func (e *EnqueueRequestForTarget) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
Delete adds a NamespacedName for the supplied DeleteEvent if its Object is a TargetReferencer.
func (*EnqueueRequestForTarget) Generic ¶ added in v0.5.7
func (e *EnqueueRequestForTarget) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
Generic adds a NamespacedName for the supplied GenericEvent if its Object is a TargetReferencer.
func (*EnqueueRequestForTarget) Update ¶ added in v0.5.7
func (e *EnqueueRequestForTarget) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
Update adds a NamespacedName for the supplied UpdateEvent if its Objects are a TargetReferencer.
type Finalizer ¶
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 ¶
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 ¶
func (f FinalizerFns) AddFinalizer(ctx context.Context, obj Object) error
AddFinalizer to the supplied resource.
func (FinalizerFns) AddFinalizerString ¶
func (f FinalizerFns) AddFinalizerString(ctx context.Context, obj Object, finalizerString string) error
AddFinalizer to the supplied resource.
func (FinalizerFns) HasOtherFinalizer ¶
RemoveFinalizer from the supplied resource.
func (FinalizerFns) RemoveFinalizer ¶
func (f FinalizerFns) RemoveFinalizer(ctx context.Context, obj Object) error
RemoveFinalizer from the supplied resource.
func (FinalizerFns) RemoveFinalizerString ¶
func (f FinalizerFns) RemoveFinalizerString(ctx context.Context, obj Object, finalizerString string) error
RemoveFinalizer from the supplied resource.
type HealthConditioned ¶ added in v0.5.10
type HealthConditioned interface {
SetHealthConditions(c nddv1.HealthConditionedStatus)
}
type Lifecycle ¶ added in v0.5.10
type Lifecycle interface { GetDeletionPolicy() nddv1.DeletionPolicy SetDeletionPolicy(p nddv1.DeletionPolicy) GetDeploymentPolicy() nddv1.DeploymentPolicy SetDeploymentPolicy(p nddv1.DeploymentPolicy) }
An Lifecycle resource may specify a DeletionPolicy and/or DeploymentPolicy.
type Managed ¶
type Managed interface { Object TargetReferencer Lifecycle Conditioned HealthConditioned RootPaths }
A Managed is a Kubernetes object representing a concrete managed resource (e.g. a CloudSQL instance).
type ManagedKind ¶
type ManagedKind schema.GroupVersionKind
A ManagedKind contains the type metadata for a kind of managed resource.
type ManagedList ¶
type ManagedList interface { client.ObjectList // GetItems returns the list of managed resources. GetItems() []Managed }
A ManagedList is a list of managed resources.
type PredicateFn ¶
A PredicateFn returns true if the supplied object should be reconciled.
type RequiredTargetReferencer ¶ added in v0.5.7
type RequiredTargetReferencer interface { GetTargetReference() nddv1.Reference SetTargetReference(p nddv1.Reference) }
A RequiredTargetReferencer may reference a target config resource. Unlike TargetReferencer, the reference is required (i.e. not nil).
type RequiredTypedResourceReferencer ¶
type RequiredTypedResourceReferencer interface { SetResourceReference(r nddv1.TypedReference) GetResourceReference() nddv1.TypedReference }
A RequiredTypedResourceReferencer can reference a resource.
type Target ¶
type Target interface { Object UserCounter Conditioned }
A Target configures a Target Device Driver.
type TargetKinds ¶ added in v0.5.7
type TargetKinds struct { Config schema.GroupVersionKind Usage schema.GroupVersionKind UsageList schema.GroupVersionKind }
TargetKinds contains the type metadata for a kind of target.
type TargetReferencer ¶ added in v0.5.7
type TargetReferencer interface { GetTargetReference() *nddv1.Reference SetTargetReference(p *nddv1.Reference) }
A TargetReferencer may reference a target resource.
type TargetUsage ¶ added in v0.5.7
type TargetUsage interface { Object RequiredTargetReferencer RequiredTypedResourceReferencer }
A TargetUsage indicates a usage of a target config.
type TargetUsageList ¶ added in v0.5.7
type TargetUsageList interface { client.ObjectList // GetItems returns the list of target usages. GetItems() []TargetUsage }
A TargetUsageList is a list of targets usages.
type TargetUsageTracker ¶ added in v0.5.7
type TargetUsageTracker struct {
// contains filtered or unexported fields
}
A TargetUsageTracker tracks usages of a Target by creating or updating the appropriate TargetUsage.
func NewTargetUsageTracker ¶ added in v0.5.7
func NewTargetUsageTracker(c client.Client, of TargetUsage) *TargetUsageTracker
NewTargetUsageTracker creates a TargetUsageTracker.
func (*TargetUsageTracker) Track ¶ added in v0.5.7
func (u *TargetUsageTracker) Track(ctx context.Context, mg Managed) error
Track that the supplied Managed resource is using the Target it references by creating or updating a TargetUsage. Track should be called _before_ attempting to use the Target. This ensures the managed resource's usage is updated if the managed resource is updated to reference a misconfigured Target.
type Tracker ¶
type Tracker interface { // Track the supplied managed resource. Track(ctx context.Context, mg Managed) error }
A Tracker tracks managed resources.
type UserCounter ¶
A UserCounter can count how many users it has.