controllers

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyProfiles added in v0.17.0

func ApplyProfiles(params reconcileParameters, data *state.Data) error

ensure a profile is assigned and profile states have been maintained beforehand.

func EnsureLabelMap added in v0.17.0

func EnsureLabelMap(params reconcileParameters, data *state.Data) error

func HandleNode added in v0.17.0

func HandleNode(params reconcileParameters, data *state.Data) error

func MaintainProfileStates added in v0.17.0

func MaintainProfileStates(params reconcileParameters, data *state.Data) error

ensure a profile is assigned beforehand.

func UpdateMaintenanceStateLabel added in v0.17.0

func UpdateMaintenanceStateLabel(params reconcileParameters, data *state.Data) error

Types

type Config

type Config struct {
	// RequeueInterval defines a duration after the a node is reconceiled again by the controller
	RequeueInterval time.Duration
	// Profiles contains all known profiles
	Profiles map[string]state.Profile
	// Contains reference to all plugins and their instances
	Registry plugin.Registry
}

Config represents the controllers global configuration.

func LoadConfig

func LoadConfig(config *ucfgwrap.Config) (*Config, error)

LoadConfig (re-)initializes the config with values provided by the given ucfg.Config.

type ConfigDescriptor

type ConfigDescriptor struct {
	Intervals struct {
		Requeue time.Duration `config:"requeue" validate:"required"`
	} `config:"intervals" validate:"required"`
	Instances plugin.InstancesDescriptor
	Profiles  []ProfileDescriptor
}

ConfigDescriptor describes the configuration structure to be parsed.

type NodeHandler added in v0.17.0

type NodeHandler = func(params reconcileParameters, data *state.Data) error

type NodeReconciler

type NodeReconciler struct {
	client.Client
	Log           logr.Logger
	Scheme        *runtime.Scheme
	Recorder      record.EventRecorder
	NodeInfoCache cache.NodeInfoCache
}

NodeReconciler reconciles a Node object.

func (*NodeReconciler) Reconcile

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

Reconcile reconciles the given request.

func (*NodeReconciler) SetupWithManager

func (r *NodeReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager attaches the controller to the given manager.

type ProfileDescriptor

type ProfileDescriptor struct {
	Name                string `config:"name" validate:"required"`
	Operational         StateDescriptor
	MaintenanceRequired StateDescriptor `config:"maintenance-required"`
	InMaintenance       StateDescriptor `config:"in-maintenance"`
}

type StateDescriptor

type StateDescriptor struct {
	Notify      string
	Transitions []TransitionDescriptor
}

type TransitionDescriptor

type TransitionDescriptor struct {
	Check   string `config:"check" validate:"required"`
	Next    string `config:"next" validate:"required"`
	Trigger string
}

Jump to

Keyboard shortcuts

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