Documentation ¶
Index ¶
- func Always(_ unstructured.Unstructured) bool
- func NewDefaultBackoff() wait.Backoff
- func NewRetryingClient(c client.WithWatch, predicate func(error) bool, backoff wait.Backoff) client.WithWatch
- func Patch[T any, PT ObjectWithDeepCopy[T]](ctx context.Context, k8sClient client.Client, obj PT, modify func()) error
- func PatchResource[T any, PT ObjectWithDeepCopy[T]](ctx context.Context, k8sClient client.Client, obj PT, modify func()) error
- type FinalizerDescriptor
- type FinalizerWebhook
- type NotReadyError
- func (e NotReadyError) Error() string
- func (e NotReadyError) WithCause(cause error) NotReadyError
- func (e NotReadyError) WithMessage(message string) NotReadyError
- func (e NotReadyError) WithNoRequeue() NotReadyError
- func (e NotReadyError) WithReason(reason string) NotReadyError
- func (e NotReadyError) WithRequeue() NotReadyError
- func (e NotReadyError) WithRequeueAfter(duration time.Duration) NotReadyError
- type ObjectReconciler
- type ObjectWithDeepCopy
- type PatchingReconciler
- type ReadyConditionBuilder
- func (b *ReadyConditionBuilder) Build() metav1.Condition
- func (b *ReadyConditionBuilder) Ready() *ReadyConditionBuilder
- func (b *ReadyConditionBuilder) WithError(err error) *ReadyConditionBuilder
- func (b *ReadyConditionBuilder) WithMessage(message string) *ReadyConditionBuilder
- func (b *ReadyConditionBuilder) WithReason(reason string) *ReadyConditionBuilder
- func (b *ReadyConditionBuilder) WithStatus(status metav1.ConditionStatus) *ReadyConditionBuilder
- type RetryingClient
- func (a RetryingClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (a RetryingClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
- func (a RetryingClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
- func (a RetryingClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, ...) error
- func (a RetryingClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
- func (a RetryingClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) error
- func (a RetryingClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
- type RuntimeObjectWithStatusConditions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Always ¶ added in v0.8.0
func Always(_ unstructured.Unstructured) bool
func NewDefaultBackoff ¶ added in v0.8.0
func NewRetryingClient ¶ added in v0.8.0
func Patch ¶
func Patch[T any, PT ObjectWithDeepCopy[T]]( ctx context.Context, k8sClient client.Client, obj PT, modify func(), ) error
Patch updates k8s objects by subsequently calling k8s client `Patch()` and `Status().Patch()` The `modify` lambda is expected to mutate the `obj` but does not take the object as an argument as the object should be visible in the parent scope Example:
var pod *corev1.Pod patchErr = k8s.Patch(ctx, fakeClient, pod, func() { pod.Spec.RestartPolicy = corev1.RestartPolicyOnFailure pod.Status.Message = "hello" })
Note that this function should be used when current user has permissions to patch both object's spec and status, e.g. in controllers context
func PatchResource ¶ added in v0.4.0
func PatchResource[T any, PT ObjectWithDeepCopy[T]]( ctx context.Context, k8sClient client.Client, obj PT, modify func(), ) error
PatchResource updates k8s objects by calling k8s client `Patch`. It does not patch the object status which makes it convenient to use in contexts where the current user is not permitted to patch the status, such as within the api repositories. The `modify` lambda is expected to mutate the `obj` but does not take the object as an argument as the object should be visible in the parent scope Example:
var pod *corev1.Pod patchErr = k8s.PatchResource(ctx, fakeClient, pod, func() { pod.Spec.RestartPolicy = corev1.RestartPolicyOnFailure })
Note that this function should be used when current user has permissions to patch both object's spec and status, e.g. in controllers context
Types ¶
type FinalizerDescriptor ¶ added in v0.8.0
type FinalizerDescriptor struct { FinalizerName string SetPolicy func(unstructured.Unstructured) bool }
type FinalizerWebhook ¶ added in v0.8.0
type FinalizerWebhook struct {
// contains filtered or unexported fields
}
func NewFinalizerWebhook ¶ added in v0.8.0
func NewFinalizerWebhook(resourceTypeToFinalizerNameRegistry map[string]FinalizerDescriptor) *FinalizerWebhook
func (*FinalizerWebhook) SetupWebhookWithManager ¶ added in v0.8.0
func (r *FinalizerWebhook) SetupWebhookWithManager(mgr ctrl.Manager)
type NotReadyError ¶ added in v0.13.0
type NotReadyError struct {
// contains filtered or unexported fields
}
func NewNotReadyError ¶ added in v0.13.0
func NewNotReadyError() NotReadyError
func (NotReadyError) Error ¶ added in v0.13.0
func (e NotReadyError) Error() string
func (NotReadyError) WithCause ¶ added in v0.13.0
func (e NotReadyError) WithCause(cause error) NotReadyError
func (NotReadyError) WithMessage ¶ added in v0.13.0
func (e NotReadyError) WithMessage(message string) NotReadyError
func (NotReadyError) WithNoRequeue ¶ added in v0.13.0
func (e NotReadyError) WithNoRequeue() NotReadyError
func (NotReadyError) WithReason ¶ added in v0.13.0
func (e NotReadyError) WithReason(reason string) NotReadyError
func (NotReadyError) WithRequeue ¶ added in v0.13.0
func (e NotReadyError) WithRequeue() NotReadyError
func (NotReadyError) WithRequeueAfter ¶ added in v0.13.0
func (e NotReadyError) WithRequeueAfter(duration time.Duration) NotReadyError
type ObjectReconciler ¶
type ObjectWithDeepCopy ¶
type PatchingReconciler ¶
type PatchingReconciler[T any, PT RuntimeObjectWithStatusConditions[T]] struct { // contains filtered or unexported fields }
func NewPatchingReconciler ¶
func NewPatchingReconciler[T any, PT RuntimeObjectWithStatusConditions[T]](log logr.Logger, k8sClient client.Client, objectReconciler ObjectReconciler[T, PT]) *PatchingReconciler[T, PT]
func (*PatchingReconciler[T, PT]) SetupWithManager ¶
func (r *PatchingReconciler[T, PT]) SetupWithManager(mgr ctrl.Manager) error
type ReadyConditionBuilder ¶ added in v0.12.0
type ReadyConditionBuilder struct {
// contains filtered or unexported fields
}
func NewReadyConditionBuilder ¶ added in v0.12.0
func NewReadyConditionBuilder(obj client.Object) *ReadyConditionBuilder
func (*ReadyConditionBuilder) Build ¶ added in v0.12.0
func (b *ReadyConditionBuilder) Build() metav1.Condition
func (*ReadyConditionBuilder) Ready ¶ added in v0.12.0
func (b *ReadyConditionBuilder) Ready() *ReadyConditionBuilder
func (*ReadyConditionBuilder) WithError ¶ added in v0.12.0
func (b *ReadyConditionBuilder) WithError(err error) *ReadyConditionBuilder
func (*ReadyConditionBuilder) WithMessage ¶ added in v0.12.0
func (b *ReadyConditionBuilder) WithMessage(message string) *ReadyConditionBuilder
func (*ReadyConditionBuilder) WithReason ¶ added in v0.12.0
func (b *ReadyConditionBuilder) WithReason(reason string) *ReadyConditionBuilder
func (*ReadyConditionBuilder) WithStatus ¶ added in v0.12.0
func (b *ReadyConditionBuilder) WithStatus(status metav1.ConditionStatus) *ReadyConditionBuilder
type RetryingClient ¶ added in v0.8.0
func (RetryingClient) Create ¶ added in v0.8.0
func (a RetryingClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
func (RetryingClient) Delete ¶ added in v0.8.0
func (a RetryingClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
func (RetryingClient) DeleteAllOf ¶ added in v0.8.0
func (a RetryingClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
func (RetryingClient) List ¶ added in v0.8.0
func (a RetryingClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
func (RetryingClient) Patch ¶ added in v0.8.0
func (a RetryingClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error
func (RetryingClient) Update ¶ added in v0.8.0
func (a RetryingClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
type RuntimeObjectWithStatusConditions ¶ added in v0.13.0
type RuntimeObjectWithStatusConditions[T any] interface { ObjectWithDeepCopy[T] StatusConditions() *[]metav1.Condition }