Documentation
¶
Index ¶
- func CombineReconcileResults(results ...reconcile.Result) reconcile.Result
- func CreateOrUpdate(ctx context.Context, kubeClient client.Client, scheme *runtime.Scheme, ...) (bool, error)
- func CreateOrUpdateWithOwner(ctx context.Context, kubeClient client.Client, scheme *runtime.Scheme, ...) (bool, error)
- func DeleteIfOwned(ctx context.Context, kubeClient client.Client, obj GCRuntimeObject, ...) error
- func ErrorStrings(errs ...error) []string
- func OnPatchErrorRecreate(ctx context.Context, kubeClient client.Client, ...) error
- func RestartRollout(ctx context.Context, kubeClient client.Client, obj client.Object) error
- func ToReconcileResult(errs ...error) (reconcile.Result, error)
- func UpdateFromEnv(ctx context.Context, client client.Client, obj client.Object, specs ...EnvSpec) error
- type CombinedError
- type EnvSpec
- type GCRuntimeObject
- type OnPatchError
- type TemporaryError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombineReconcileResults ¶
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 ErrorStrings ¶
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
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 ¶
convert a list of errors into a result as returned by reconcile.Reconciler.
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 GCRuntimeObject ¶ added in v1.2.0
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 ¶
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