controller

package
v1.2.11 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NET_ATTACH_LABEL_PREFIX = "used-"
	L2SM_NETWORK_ANNOTATION = "l2sm/networks"
	MULTUS_ANNOTATION_KEY   = "k8s.v1.cni.cncf.io/networks"
	ERROR_ANNOTATION        = "l2sm/error"
	L2SM_PODNAME_LABEL      = "l2sm/app"
)

Variables

This section is empty.

Functions

func CreateDNSEntry added in v1.2.11

func CreateDNSEntry(network *l2smv1.L2Network, podName, podCIDR string) error

func CreateErrorEvent added in v1.2.9

func CreateErrorEvent(
	ctx context.Context,
	client client.Client,
	pod *corev1.Pod,
	message string,
	reason string,
)

func Generate4byteChunk added in v1.2.9

func Generate4byteChunk() string

func GenerateAnnotations added in v1.2.9

func GenerateAnnotations(overlayName string, ammount int) string

func GetFreeNetAttachDefs

func GetFreeNetAttachDefs(ctx context.Context, c client.Client, switchesNamespace, label string) nettypes.NetworkAttachmentDefinitionList

func GetL2Networks

func GetL2Networks(ctx context.Context, c client.Client, networks []NetworkAnnotation) ([]l2smv1.L2Network, error)

func GetL2NetworksMap added in v1.2.9

func GetL2NetworksMap(ctx context.Context, c client.Client, networks []NetworkAnnotation) (map[string]l2smv1.L2Network, error)

TODO: join methods together

func GetNextAvailableIP added in v1.2.9

func GetNextAvailableIP(networkCIDR, lastAssignedIP string, assignedIPs map[string]string) (string, string, error)

GetNextAvailableIP generates the next available IP dynamically and returns it with the subnet mask.

Types

type L2NetworkReconciler

type L2NetworkReconciler struct {
	client.Client
	Log    logr.Logger
	Scheme *runtime.Scheme

	// Manages interactions with the onos SDN Controller.
	InternalClient    sdnclient.Client
	SwitchesNamespace string
}

L2NetworkReconciler reconciles a L2Network object

func (*L2NetworkReconciler) ConnectInternalSwitchToNED added in v1.2.10

func (r *L2NetworkReconciler) ConnectInternalSwitchToNED(ctx context.Context, networkName, nedNodeName string) (nettypes.NetworkAttachmentDefinition, error)

func (*L2NetworkReconciler) CreateNewNEDConnection added in v1.2.10

func (r *L2NetworkReconciler) CreateNewNEDConnection(network *l2smv1.L2Network, nedNetworkAttachDef string, ned l2smv1.NetworkEdgeDevice) error

CreateNEDConnection is a method that given the name of the network and the

func (*L2NetworkReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the L2Network object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.0/pkg/reconcile

func (*L2NetworkReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type NetworkAnnotation

type NetworkAnnotation struct {
	Name       string   `json:"name"`
	Namespace  string   `json:"namespace,omitempty"`
	IPAdresses []string `json:"ips,omitempty"`
}

func (*NetworkAnnotation) GenerateIPv6Address

func (network *NetworkAnnotation) GenerateIPv6Address()

type NetworkEdgeDeviceReconciler

type NetworkEdgeDeviceReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

NetworkEdgeDeviceReconciler reconciles a NetworkEdgeDevice object

func (*NetworkEdgeDeviceReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the NetworkEdgeDevice object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.0/pkg/reconcile

func (*NetworkEdgeDeviceReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type NodeJson

type NodeJson struct {
	Name   string `json:"name"`
	NodeIP string `json:"nodeIP"`
}

type OverlayConfigJson added in v1.2.9

type OverlayConfigJson struct {
	ControllerIp string `json:"ControllerIp"`
}

type OverlayReconciler

type OverlayReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

OverlayReconciler reconciles a Overlay object

func (*OverlayReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the Overlay object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.0/pkg/reconcile

func (*OverlayReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type PodAnnotator

type PodAnnotator struct {
	Client            client.Client
	Decoder           *admission.Decoder
	SwitchesNamespace string
}

+kubebuilder:webhook:path=/mutate-v1-pod,mutating=true,failurePolicy=fail,groups="",resources=pods,verbs=update,versions=v1,name=mpod.kb.io

func (*PodAnnotator) Handle

func (*PodAnnotator) InjectDecoder

func (a *PodAnnotator) InjectDecoder(d *admission.Decoder) error

type PodReconciler

type PodReconciler struct {
	client.Client
	Log logr.Logger

	Scheme            *runtime.Scheme
	SwitchesNamespace string
	InternalClient    sdnclient.Client
}

PodReconciler reconciles a Pod object

func (*PodReconciler) DetachNetAttachDef

func (r *PodReconciler) DetachNetAttachDef(ctx context.Context, multusNetAttachDef NetworkAnnotation, namespace string) error

func (*PodReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the Pod object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.0/pkg/reconcile

func (*PodReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type TopologySwitchJson

type TopologySwitchJson struct {
	Nodes []NodeJson    `json:"Nodes"`
	Links []l2smv1.Link `json:"Links"`
}

Jump to

Keyboard shortcuts

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