Documentation ¶
Index ¶
- func Create(mgr ctrl.Manager, f *forest.Forest, maxReconciles int) error
- func GetValidateMode(mode api.SynchronizationMode, log logr.Logger) api.SynchronizationMode
- type ConfigReconciler
- type HierarchicalNamespaceReconciler
- type HierarchyConfigReconciler
- type ObjectReconciler
- func (r *ObjectReconciler) GetGVK() schema.GroupVersionKind
- func (r *ObjectReconciler) GetMode() api.SynchronizationMode
- func (r *ObjectReconciler) GetNumPropagatedObjects() int
- func (r *ObjectReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)
- func (r *ObjectReconciler) SetMode(ctx context.Context, mode api.SynchronizationMode, log logr.Logger) error
- func (r *ObjectReconciler) SetupWithManager(mgr ctrl.Manager, maxReconciles int) error
- func (r *ObjectReconciler) SyncNamespace(ctx context.Context, log logr.Logger, ns string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create creates all reconcilers.
This function is called both from main.go as well as from the integ tests.
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 ConfigReconciler ¶
type ConfigReconciler struct { client.Client Log logr.Logger Manager ctrl.Manager // Forest is the in-memory data structure that is shared with all other reconcilers. Forest *forest.Forest // Trigger 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 the singleton to trigger reconciliation. Trigger chan event.GenericEvent // HierarchyConfigUpdates is a channel of events used to update hierarchy configuration changes performed by // ObjectReconcilers. It is passed on to ObjectReconcilers for the updates. The ConfigReconciler itself does // not use it. HierarchyConfigUpdates chan event.GenericEvent // contains filtered or unexported fields }
ConfigReconciler is responsible for determining the HNC configuration from the HNCConfiguration CR, as well as ensuring all objects are propagated correctly when the HNC configuration changes. It can also set the status of the HNCConfiguration CR.
func (*ConfigReconciler) SetupWithManager ¶
func (r *ConfigReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager builds a controller with the reconciler.
func (*ConfigReconciler) SyncNumObjects ¶
func (r *ConfigReconciler) SyncNumObjects(log logr.Logger)
SyncNumObjects will be called by object reconcilers to signal config reconciler to reconcile when the status of the `config` object might need to be updated.
type HierarchicalNamespaceReconciler ¶
type HierarchicalNamespaceReconciler struct { client.Client Log logr.Logger // 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 }
HierarchicalNamespaceReconciler reconciles HierarchicalNamespace CRs to make sure all the hierarchical namespaces are properly maintained.
func (*HierarchicalNamespaceReconciler) Reconcile ¶
Reconcile sets up some basic variables and then calls the business logic. It currently only handles the creation of the namespaces but no deletion or state reporting yet.
func (*HierarchicalNamespaceReconciler) SetupWithManager ¶
func (r *HierarchicalNamespaceReconciler) SetupWithManager(mgr ctrl.Manager) error
type HierarchyConfigReconciler ¶
type HierarchyConfigReconciler struct { client.Client Log logr.Logger // Forest is the in-memory data structure that is shared with all other reconcilers. // HierarchyConfigReconciler is responsible for keeping it up-to-date, but the other reconcilers // use it to determine how to propagate objects. Forest *forest.Forest // 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 namespaces that need updating. Affected chan event.GenericEvent // contains filtered or unexported fields }
HierarchyConfigReconciler is responsible for determining the forest structure from the Hierarchy CRs, as well as ensuring all objects in the forest are propagated correctly when the hierarchy changes. It can also set the status of the Hierarchy CRs, as well as (in rare cases) override part of its spec (i.e., if a parent namespace no longer exists).
func (*HierarchyConfigReconciler) Reconcile ¶
Reconcile sets up some basic variables and then calls the business logic.
func (*HierarchyConfigReconciler) SetupWithManager ¶
func (r *HierarchyConfigReconciler) SetupWithManager(mgr ctrl.Manager, maxReconciles int) error
type ObjectReconciler ¶
type ObjectReconciler struct { client.Client 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 // contains filtered or unexported fields }
ObjectReconciler 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 (*ObjectReconciler) GetGVK ¶
func (r *ObjectReconciler) GetGVK() schema.GroupVersionKind
GetGVK provides GVK that is handled by this reconciler.
func (*ObjectReconciler) GetMode ¶
func (r *ObjectReconciler) GetMode() api.SynchronizationMode
GetMode provides the mode of objects that are handled by this reconciler.
func (*ObjectReconciler) GetNumPropagatedObjects ¶
func (r *ObjectReconciler) GetNumPropagatedObjects() int
GetNumPropagatedObjects returns the number of propagated objects of the GVK handled by this object reconciler.
func (*ObjectReconciler) SetMode ¶
func (r *ObjectReconciler) SetMode(ctx context.Context, mode api.SynchronizationMode, log logr.Logger) 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 (*ObjectReconciler) SetupWithManager ¶
func (r *ObjectReconciler) SetupWithManager(mgr ctrl.Manager, maxReconciles int) error
func (*ObjectReconciler) SyncNamespace ¶
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.