v1

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: MIT Imports: 7 Imported by: 3

Documentation

Overview

Package v1 provides helpers to implement an external object sync controller. It's based on the sync controller and adds a garbage collector sync function for the purpose of syncing objects between a kubernetes cluster and an external system. The garbage collector deletes orphan objects in the external system.

Index

Constants

View Source
const (
	// DefaultGarbageCollectionPeriod is the default period at which garbage
	// collection is executed.
	DefaultGarbageCollectionPeriod time.Duration = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	syncv1.Controller

	// List lists all the objects in the external system. It returns a list of
	// NamespacedName of the external objects. This is used for garbage
	// collection and can be expensive. The garbage collector is run in a
	// separate goroutine periodically, not affecting the main reconciliation
	// control-loop. If the external system has no concept of namespace, the
	// namespace value can be empty.
	List(context.Context) ([]types.NamespacedName, error)
}

Controller is an external object sync controller interface that must be implemented by an external sync controller. It provides methods required for reconciling and syncing a k8s object to external objects.

type Reconciler

type Reconciler struct {
	syncv1.Reconciler
	Ctrlr Controller
	// contains filtered or unexported fields
}

Reconciler defines an external object sync reconciler based on the Sync reconciler with a sync function for garbage collection of the external objects.

func (*Reconciler) Init

func (s *Reconciler) Init(mgr ctrl.Manager, ctrlr Controller, prototype client.Object, prototypeList client.ObjectList, opts ...syncv1.ReconcilerOption) error

Init initializes the reconciler.

func (*Reconciler) SetGarbageCollectionPeriod

func (s *Reconciler) SetGarbageCollectionPeriod(period time.Duration)

SetGarbageCollectionPeriod sets the garbage collection period.

func (*Reconciler) SetStartupGarbageCollectionDelay

func (s *Reconciler) SetStartupGarbageCollectionDelay(period time.Duration)

SetStartupGarbageCollectionDelay sets a delay for the initial garbage collection at startup. NOTE: Setting this too low can result in failure due to uninitialized controller components.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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