objects

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 32 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
	// 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) CanPropagate added in v1.1.0

func (r *Reconciler) CanPropagate() bool

CanPropagate returns true if Propagate mode or AllowPropagate mode is set

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) OnChangeNamespace added in v1.1.0

func (r *Reconciler) OnChangeNamespace(log logr.Logger, ns *forest.Namespace)

OnChangeNamespace is called whenever a namespace is changed (according to HierarchyConfigReconciler). It enqueues all the current objects in the namespace and local copies of the original objects in the ancestors.

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

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