reconcileutil

package
v1.10.9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineReconcileResults

func CombineReconcileResults(results ...reconcile.Result) reconcile.Result

Given a list of reconcile results, returns the one with the closest restart time.

func CreateOrUpdate added in v1.2.0

func CreateOrUpdate(ctx context.Context, kubeClient client.Client, scheme *runtime.Scheme, obj GCRuntimeObject, onPatchErr OnPatchError) (bool, error)

CreateOrUpdate reconciles a resource to be in line with the given resource spec.

`kubectl apply` for go. First, will try to create the resource. If it already exists, it will try to compute the changes based on the one previously applied and patch the resource.

func CreateOrUpdateWithOwner added in v1.2.0

func CreateOrUpdateWithOwner(ctx context.Context, kubeClient client.Client, scheme *runtime.Scheme, obj GCRuntimeObject, owner metav1.Object, onPatchErr OnPatchError) (bool, error)

CreateOrUpdateWithOwner reconciles a resource, ensuring the controller reference is set.

Sets the owner reference, ensuring that once the owning resource is cleaned up, the created items will be removed as well. Then calls CreateOrUpdate.

func DeleteIfOwned added in v1.8.0

func DeleteIfOwned(ctx context.Context, kubeClient client.Client, obj GCRuntimeObject, owner metav1.Object) error

func ErrorStrings

func ErrorStrings(errs ...error) []string

convert a list of errors into a list of string.

func OnPatchErrorRecreate added in v1.5.0

func OnPatchErrorRecreate(ctx context.Context, kubeClient client.Client, current, desired GCRuntimeObject) error

OnPatchErrorRecreate recreates a resource by deleting old resources before applying it again.

func RestartRollout added in v1.2.0

func RestartRollout(ctx context.Context, kubeClient client.Client, obj client.Object) error

RestartRollout is "kubectl rollout restart" in go

Works for Deployments, StatefulSets, DaemonSets and maybe others. Restart is trigger by setting/updating an annotation on the pod template.

func ToReconcileResult

func ToReconcileResult(errs ...error) (reconcile.Result, error)

convert a list of errors into a result as returned by reconcile.Reconciler.

func UpdateFromEnv added in v1.1.0

func UpdateFromEnv(ctx context.Context, client client.Client, obj client.Object, specs ...EnvSpec) error

Types

type CombinedError

type CombinedError struct {
	Sources []error
}

an error implementing the error interface, that has multiple sources.

func (*CombinedError) Error

func (e *CombinedError) Error() string

type EnvSpec added in v1.1.0

type EnvSpec struct {
	Env    string
	Target *string
}

type GCRuntimeObject added in v1.2.0

type GCRuntimeObject interface {
	metav1.Object
	runtime.Object
}

type OnPatchError added in v1.5.0

type OnPatchError = func(ctx context.Context, kubeClient client.Client, current, desired GCRuntimeObject) error
var OnPatchErrorReturn OnPatchError

OnPatchErrorReturn returns the error when applying the patch.

type TemporaryError

type TemporaryError struct {
	Source       error
	RequeueAfter time.Duration
}

wrapper around an error that may be solved after waiting some time.

func (*TemporaryError) Error

func (e *TemporaryError) Error() string

func (*TemporaryError) Is

func (e *TemporaryError) Is(target error) bool

func (*TemporaryError) ToReconcileResult

func (e *TemporaryError) ToReconcileResult() reconcile.Result

func (*TemporaryError) Unwrap

func (e *TemporaryError) Unwrap() error

Jump to

Keyboard shortcuts

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