reconciler

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Getter gets a resource from the k8s API.
	Getter Getter
	// ObjectType is the type of the resource that the reconciler will reconcile.
	ObjectType client.Object
	// EventCh is the channel where the reconciler will send events.
	EventCh chan<- interface{}
	// NamespacedNameFilter filters resources the controller will process. Can be nil.
	NamespacedNameFilter NamespacedNameFilterFunc
}

Config contains the configuration for the Implementation.

type Getter

type Getter interface {
	// Get is from client.Reader.
	Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
}

Getter gets a resource from the k8s API. It allows us to mock the client.Reader.Get method.

type Implementation

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

Implementation is a reconciler for Kubernetes resources. It implements the reconcile.Reconciler interface. A successful reconciliation of a resource has the two possible outcomes: (1) If the resource is deleted, the Implementation will send a DeleteEvent to the event channel. (2) If the resource is upserted (created or updated), the Implementation will send an UpsertEvent to the event channel.

func NewImplementation

func NewImplementation(cfg Config) *Implementation

NewImplementation creates a new Implementation.

func (*Implementation) Reconcile

Reconcile implements the reconcile.Reconciler Reconcile method.

type NamespacedNameFilterFunc

type NamespacedNameFilterFunc func(nsname types.NamespacedName) (bool, string)

NamespacedNameFilterFunc is a function that returns true if the resource should be processed by the reconciler. If the function returns false, the reconciler will log the returned string.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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