util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ZapLogger *zap.Logger

Functions

func AddFinalizer

func AddFinalizer(object metav1.Object, finalizer string) (changed bool)

AddFinalizer adds the Finalizer to the metav1.Object if the Finalizer is not present.

func CRDIsEstablished added in v0.2.0

func CRDIsEstablished(crd *apiextensionsv1.CustomResourceDefinition) bool

func CmdLogMixin

func CmdLogMixin(cmd *cobra.Command) *cobra.Command

CmdLogMixin adds necessary CLI flags for logging and setups the controller runtime log

func DeleteObjects

func DeleteObjects(ctx context.Context, cl client.Client, scheme *runtime.Scheme, listTypes []runtime.Object, options ...client.ListOption) (cleanedUp bool, err error)

Delete deletes all object of given types adhering to additional ListOptions

func DeploymentIsAvailable

func DeploymentIsAvailable(deployment *appsv1.Deployment) bool

DeploymentIsAvailable checks if a deployment is available.

func ListObjects

func ListObjects(ctx context.Context, cl client.Client, scheme *runtime.Scheme, listTypes []runtime.Object, options ...client.ListOption) ([]runtime.Object, error)

ListObjects lists all object of given types adhering to additional ListOptions

func MustLogLine added in v0.2.0

func MustLogLine(obj runtime.Object, scheme *runtime.Scheme) string

func RemoveFinalizer

func RemoveFinalizer(object metav1.Object, finalizer string) (changed bool)

RemoveFinalizer removes the finalizer from the metav1.Object if the Finalizer is present.

func UpdateObservedGeneration

func UpdateObservedGeneration(src, dest *unstructured.Unstructured) error

UpdateObservedGeneration sets dest.Status.ObservedGeneration=dest.Generation, if src.Generation == src.Status.ObservedGeneration

Types

type ClientWatcher

type ClientWatcher struct {
	client.Client
	// contains filtered or unexported fields
}

func NewClientWatcher

func NewClientWatcher(conf *rest.Config, scheme *runtime.Scheme, log logr.Logger) (*ClientWatcher, error)

func (*ClientWatcher) WaitUntil

func (cw *ClientWatcher) WaitUntil(ctx context.Context, obj runtime.Object, cond func() (done bool, err error), options ...ClientWatcherOption) error

WaitUntil waits until the Object's condition function is true, or the context deadline is reached

condition function should operate on the passed object in a closure and should not modify the obj

func (*ClientWatcher) WaitUntilNotFound added in v0.2.0

func (cw *ClientWatcher) WaitUntilNotFound(ctx context.Context, obj runtime.Object, options ...ClientWatcherOption) error

WaitUntilNotFound waits until the object is not found or the context deadline is exceeded

type ClientWatcherOption added in v0.2.0

type ClientWatcherOption func(*clientWatcherOption) error

func WithClientWatcherTimeout added in v0.2.0

func WithClientWatcherTimeout(t time.Duration) ClientWatcherOption

func WithoutClientWatcher added in v0.2.0

func WithoutClientWatcher() ClientWatcherOption

type ObjectReference

type ObjectReference struct {
	// Name of the referent.
	Name string `json:"name"`
	// Namespace that the referent object lives in.
	Namespace string `json:"namespace"`
	// The API Group of the referent.
	Group string `json:"group"`
	// The Kind of the referent.
	Kind string `json:"kind"`
}

ObjectReference references an owning/controlling object across Namespaces.

func ToObjectReference

func ToObjectReference(object runtime.Object, scheme *runtime.Scheme) ObjectReference

ToOwnerReference converts the given object into an ownerReference.

type PredicateFn

type PredicateFn func(obj runtime.Object) bool

func (PredicateFn) Create

func (p PredicateFn) Create(ev event.CreateEvent) bool

func (PredicateFn) Delete

func (p PredicateFn) Delete(ev event.DeleteEvent) bool

func (PredicateFn) Generic

func (p PredicateFn) Generic(ev event.GenericEvent) bool

func (PredicateFn) Update

func (p PredicateFn) Update(ev event.UpdateEvent) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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