Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements the Sync contoller interface, applying node labels to StorageOS nodes.
func NewController ¶
func NewController(api NodeLabeller, log logr.Logger) (*Controller, error)
NewController returns a Controller that implements node label sync in StorageOS.
func (Controller) Diff ¶
Diff takes a list of Kubernets node objects and returns them if they exist within StorageOS but the labels are different.
func (Controller) Ensure ¶
Ensure applies labels set on the k8s node to the StorageOS node.
StorageOS reserved labels are validated and applied first, then the remaining unreserved labels are applied.
Any errors will result in a requeue, with standard back-off retries.
There is no label sync from StorageOS to Kubernetes. This is intentional to ensure a simple flow of desired state set by users in Kubernetes to actual state set on the StorageOS node.
type NodeLabeller ¶
type NodeLabeller interface { EnsureNodeLabels(ctx context.Context, key client.ObjectKey, labels map[string]string) error NodeObjects(ctx context.Context) (map[client.ObjectKey]storageos.Object, error) }
NodeLabeller provides access to update node labels.
type Predicate ¶
type Predicate struct { predicate.IgnoreFuncs // contains filtered or unexported fields }
Predicate filters events before enqueuing the keys. Ignore all but Update events, and then filter out events from non-StorageOS nodes. Trigger a resync when labels have changed.
Nodes added to the cluster will not immediately be added to StorageOS, so we can't react to node create events. Instead, trigger a resync when the StorageOS CSI driver annotation has been added, indicating that the node is known to StorageOS and can receive label updates.
type Reconciler ¶
type Reconciler struct { client.Client msyncv1.Reconciler // contains filtered or unexported fields }
Reconciler reconciles a Node object by applying labels from the Kubernetes node to the StorageOS node object.
func NewReconciler ¶
func NewReconciler(api NodeLabeller, k8s client.Client, resyncDelay time.Duration, resyncInterval time.Duration) *Reconciler
NewReconciler returns a new Node label reconciler.
The resyncInterval determines how often the periodic resync operation should be run.
func (*Reconciler) SetupWithManager ¶
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager, workers int) error
SetupWithManager registers the controller with the controller manager.