utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSCCName = "volsync-mover"

DefaultSCCName is the default name of the volsync security context constraint

Variables

View Source
var SCCName string

SCCName is the name of the SCC to use for the mover Jobs

Functions

func CleanupObjects

func CleanupObjects(ctx context.Context, c client.Client,
	logger logr.Logger, owner metav1.Object, types []client.Object) error

CleanupObjects deletes all objects that have been marked. The objects to be cleaned up must have been previously marked via MarkForCleanup() and associated with "owner". The "types" array should contain one object of each type to clean up.

func EnvFromSecret

func EnvFromSecret(secretName string, field string, optional bool) corev1.EnvVar

func GetAndValidateSecret

func GetAndValidateSecret(ctx context.Context, client client.Client,
	logger logr.Logger, secret *corev1.Secret, fields ...string) error

func MarkForCleanup

func MarkForCleanup(owner metav1.Object, obj metav1.Object)

MarkForCleanup marks the provided "obj" to be deleted at the end of the synchronization iteration.

func NameFor

func NameFor(obj metav1.Object) types.NamespacedName

func ReconcileBatch

func ReconcileBatch(l logr.Logger, reconcileFuncs ...ReconcileFunc) (bool, error)

reconcileBatch steps through a list of reconcile functions until one returns false or an error.

Types

type ReconcileFunc

type ReconcileFunc func(logr.Logger) (bool, error)

reconcileFunc is a function that partially reconciles an object. It returns a bool indicating whether reconciling should continue and an error.

type SAHandler

type SAHandler struct {
	Context context.Context
	Client  client.Client
	SA      *corev1.ServiceAccount
	Owner   metav1.Object
	// contains filtered or unexported fields
}

func NewSAHandler

func NewSAHandler(ctx context.Context, c client.Client, owner metav1.Object, sa *corev1.ServiceAccount) SAHandler

func (*SAHandler) Reconcile

func (d *SAHandler) Reconcile(l logr.Logger) (bool, error)

Jump to

Keyboard shortcuts

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