objects

package
v0.9.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServingPath is where the validator will run. Must be kept in sync
	// with the kubebuilder markers below.
	ServingPath = "/validate-objects"
)

Variables

This section is empty.

Functions

func GetValidateMode

func GetValidateMode(mode api.SynchronizationMode, log logr.Logger) api.SynchronizationMode

GetValidateMode returns a valid api.SynchronizationMode based on the given mode. Please see the comments of api.SynchronizationMode for currently supported modes. If mode is not set, it will be api.Propagate by default. Any unrecognized mode is treated as api.Ignore.

Types

type HNCConfigReconcilerType

type HNCConfigReconcilerType interface {
	Enqueue(reason string)
}

type Reconciler

type Reconciler struct {
	client.Client
	EventRecorder record.EventRecorder
	Log           logr.Logger

	// Forest is the in-memory forest managed by the HierarchyConfigReconciler.
	Forest *forest.Forest

	// GVK is the group/version/kind handled by this reconciler.
	GVK schema.GroupVersionKind

	// Mode describes propagation mode of objects that are handled by this reconciler.
	// See more details in the comments of api.SynchronizationMode.
	Mode api.SynchronizationMode

	// Affected is a channel of event.GenericEvent (see "Watching Channels" in
	// https://book-v1.book.kubebuilder.io/beyond_basics/controller_watches.html) that is used to
	// enqueue additional objects that need updating.
	Affected chan event.GenericEvent

	// AffectedNamespace is a channel of events used to update namespaces.
	AffectedNamespace chan event.GenericEvent

	HNCConfigReconciler HNCConfigReconcilerType
	// contains filtered or unexported fields
}

Reconciler reconciles generic propagated objects. You must create one for each group/version/kind that needs to be propagated and set its `GVK` field appropriately.

func (*Reconciler) GetGVK

func (r *Reconciler) GetGVK() schema.GroupVersionKind

GetGVK provides GVK that is handled by this reconciler.

func (*Reconciler) GetMode

func (r *Reconciler) GetMode() api.SynchronizationMode

GetMode provides the mode of objects that are handled by this reconciler.

func (*Reconciler) GetNumPropagatedObjects

func (r *Reconciler) GetNumPropagatedObjects() int

GetNumPropagatedObjects returns the number of propagated objects of the GVK handled by this object reconciler.

func (*Reconciler) Reconcile

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

func (*Reconciler) SetMode

func (r *Reconciler) SetMode(ctx context.Context, log logr.Logger, mode api.SynchronizationMode) error

SetMode sets the Mode field of an object reconciler and syncs objects in the cluster if needed. The method will return an error if syncs fail.

func (*Reconciler) SetupWithManager

func (r *Reconciler) SetupWithManager(mgr ctrl.Manager, maxReconciles int) error

func (*Reconciler) SyncNamespace

func (r *Reconciler) SyncNamespace(ctx context.Context, log logr.Logger, ns string) error

SyncNamespace can be called manually by the HierarchyConfigReconciler when the hierarchy changes. It enqueues all the current objects in the namespace and local copies of the original objects in the ancestors.

type Validator

type Validator struct {
	Log    logr.Logger
	Forest *forest.Forest
	// contains filtered or unexported fields
}

func (*Validator) Handle

func (*Validator) InjectClient

func (v *Validator) InjectClient(c client.Client) error

func (*Validator) InjectDecoder

func (v *Validator) InjectDecoder(d *admission.Decoder) error

Jump to

Keyboard shortcuts

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