controllerutils

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConditionTypeSecretReady = "SecretReady"
)
View Source
const ReloaderAnnotationKey = "reloader.stakater.com/auto"

Variables

This section is empty.

Functions

func CreateConfigMapFromDir

func CreateConfigMapFromDir(ctx context.Context, name types.NamespacedName, client client.Client, fs fs.FS,
	rootDir string, mutators ...ObjectMutator[*corev1.ConfigMap]) (controllerutil.OperationResult, error)

func CreateOrUpdate added in v0.6.1

func CreateOrUpdate[T client.Object](ctx context.Context, client client.Client,
	key types.NamespacedName, mutators ...ObjectMutator[T]) (T, controllerutil.OperationResult, error)

func DefaultLiveness

func DefaultLiveness() *corev1.Probe

func DefineOwner

func DefineOwner(ctx context.Context, client client.Client, scheme *runtime.Scheme, ob client.Object, ownerKey types.NamespacedName, ownerType client.Object) error

func GetImage

func GetImage(component, version string) string

func ImagePullPolicy

func ImagePullPolicy(o interface {
	GetVersion() string
}) corev1.PullPolicy

func IsDeleted

func IsDeleted(meta client.Object) bool

func OwnerReference

func OwnerReference(o client.Object) metav1.OwnerReference

func Requeue

func Requeue(after ...time.Duration) *controllerruntime.Result

func SetSecretError

func SetSecretError(object apisv1beta2.Object, msg ...string)

func SetSecretReady

func SetSecretReady(object apisv1beta2.Object, msg ...string)

func SinglePort

func SinglePort(name string, port int32) []v1.ContainerPort

Types

type Finalizer

type Finalizer struct {
	// contains filtered or unexported fields
}

func New

func New(name string) *Finalizer

func (*Finalizer) Add

func (f *Finalizer) Add(ctx context.Context, client client.Client, object client.Object) error

func (*Finalizer) AssertIsInstalled

func (f *Finalizer) AssertIsInstalled(ctx context.Context, client client.Client, ob client.Object) error

func (*Finalizer) Handle

func (f *Finalizer) Handle(ctx context.Context, client client.Client, ob client.Object, fn func() error) (bool, error)

func (*Finalizer) IsPresent

func (f *Finalizer) IsPresent(ob client.Object) bool

func (*Finalizer) Remove

func (f *Finalizer) Remove(ctx context.Context, client client.Client, object client.Object) error

type Mutator

type Mutator[T apisv1beta2.Object] interface {
	SetupWithBuilder(mgr ctrl.Manager, builder *ctrl.Builder) error
	Mutate(ctx context.Context, t T) (*ctrl.Result, error)
}

type ObjectMutator added in v0.6.1

type ObjectMutator[T any] func(t T) error

func WithAnnotations added in v0.6.1

func WithAnnotations[T client.Object](newAnnotations map[string]string) ObjectMutator[T]

func WithController added in v0.6.1

func WithController[T client.Object](owner client.Object, scheme *runtime.Scheme) ObjectMutator[T]

func WithReloaderAnnotations added in v0.6.1

func WithReloaderAnnotations[T client.Object]() ObjectMutator[T]

type Reconciler

type Reconciler[T apisv1beta2.Object] struct {
	client.Client
	Scheme  *runtime.Scheme
	Mutator Mutator[T]
}

Reconciler reconciles a Stack object

func NewReconciler

func NewReconciler[T apisv1beta2.Object](client client.Client, scheme *runtime.Scheme, mutator Mutator[T]) *Reconciler[T]

func (*Reconciler[T]) Reconcile

func (r *Reconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*Reconciler[T]) SetupWithManager

func (r *Reconciler[T]) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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