utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogger

func CreateLogger(logLevel int, enableDeveloperMode bool) (logr.Logger, *zap.Logger, error)

CreateLogger constructs a logger with the given log level and formats the output for humans when developer mode is enabled.

Types

type DefaultSubReconciler

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

DefaultSubReconciler provides fields and methods which are needed for all sub reconcilers. This struct is intended to be embedded into the concrete sub reconciler.

func NewDefaultSubReconciler

func NewDefaultSubReconciler(client client.Client) DefaultSubReconciler

func (*DefaultSubReconciler) GetClient

func (r *DefaultSubReconciler) GetClient() client.Client

func (*DefaultSubReconciler) SetupWithManager

func (r *DefaultSubReconciler) SetupWithManager(ctrlBuilder *builder.Builder) *builder.Builder

type LoggingClient

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

LoggingClient is a Kubernetes client which is creating log entries for every modifying action.

func NewLoggingClient

func NewLoggingClient(client client.Client, logger logr.Logger) *LoggingClient

func (*LoggingClient) Create

func (l *LoggingClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

func (*LoggingClient) Delete

func (l *LoggingClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

func (*LoggingClient) DeleteAllOf

func (l *LoggingClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

func (*LoggingClient) Get

func (*LoggingClient) GroupVersionKindFor

func (l *LoggingClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error)

func (*LoggingClient) IsObjectNamespaced

func (l *LoggingClient) IsObjectNamespaced(obj runtime.Object) (bool, error)

func (*LoggingClient) List

func (l *LoggingClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

func (*LoggingClient) Patch

func (l *LoggingClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

func (*LoggingClient) RESTMapper

func (l *LoggingClient) RESTMapper() meta.RESTMapper

func (*LoggingClient) Scheme

func (l *LoggingClient) Scheme() *runtime.Scheme

func (*LoggingClient) Status

func (*LoggingClient) SubResource

func (l *LoggingClient) SubResource(subResource string) client.SubResourceClient

func (*LoggingClient) Update

func (l *LoggingClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

type LoggingSubResourceClient

type LoggingSubResourceClient struct {
	LoggingSubResourceWriter
	// contains filtered or unexported fields
}

func (*LoggingSubResourceClient) Get

type LoggingSubResourceWriter

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

func (*LoggingSubResourceWriter) Create

func (*LoggingSubResourceWriter) Patch

func (*LoggingSubResourceWriter) Update

type Reconciler

type Reconciler[T client.Object] struct {
	// contains filtered or unexported fields
}

Reconciler is a generalization of a top level reconciler. The type parameter should be a pointer to the kubernetes data type this reconciler will reconcile. Every reconcile event is then forwarded to all sub reconcilers.

func NewReconciler

func NewReconciler[T client.Object](client client.Client, newObj func() T, options ...ReconcilerOption[T]) *Reconciler[T]

NewReconciler creates a new reconciler instance. The reconciler is initialized with the given client and applies the provided options to the reconciler.

func (*Reconciler[T]) AppendSubReconciler

func (r *Reconciler[T]) AppendSubReconciler(subReconciler SubReconciler[T])

func (*Reconciler[T]) GetClient

func (r *Reconciler[T]) GetClient() client.Client

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 registers all enabled sub-reconcilers with the given manager.

type ReconcilerOption

type ReconcilerOption[T client.Object] func(reconciler *Reconciler[T])

ReconcilerOption is an option which can be applied to the reconciler.

type SubReconciler

type SubReconciler[T client.Object] interface {
	Reconcile(ctx context.Context, obj T) (ctrl.Result, error)
	SetupWithManager(builder *builder.Builder) *builder.Builder
}

SubReconciler is the interface all sub-reconcilers need to implement.

Jump to

Keyboard shortcuts

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