pod

package
v0.0.0-...-55df139 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PodAllocator

type PodAllocator struct {
	// contains filtered or unexported fields
}

PodAllocator acts on pods events handed off by the cluster network controller and allocates or releases resources (IPs and tunnel IDs at the time of this writing) to pods on behalf of cluster manager.

func NewPodAllocator

func NewPodAllocator(
	netInfo util.NetInfo,
	podAnnotationAllocator *pod.PodAnnotationAllocator,
	ipAllocator subnet.Allocator,
	claimsReconciler persistentips.PersistentAllocations,
	nadController nad.NADController,
	recorder record.EventRecorder,
	idAllocator id.Allocator,
) *PodAllocator

NewPodAllocator builds a new PodAllocator

func (*PodAllocator) GetNetworkRole

func (a *PodAllocator) GetNetworkRole(pod *corev1.Pod) (string, error)

GetNetworkRole returns the role of this controller's network for the given pod Expected values are: (1) "primary" if this network is the primary network of the pod.

The "default" network is the primary network of any pod usually
unless user-defined-network-segmentation feature has been activated.
If network segmentation feature is enabled then any user defined
network can be the primary network of the pod.

(2) "secondary" if this network is the secondary network of the pod.

Only user defined networks can be secondary networks for a pod.

(3) "infrastructure-locked" is applicable only to "default" network if

a user defined network is the "primary" network for this pod. This
signifies the "default" network is only used for probing and
is otherwise locked for all intents and purposes.

NOTE: Like in other places, expectation is this function is always called from controller's that have some relation to the given pod, unrelated networks are treated as secondary networks so caller has to be careful

func (*PodAllocator) Init

func (a *PodAllocator) Init() error

Init checks if persistentIPs controller elements are correctly configured for the network

func (*PodAllocator) Reconcile

func (a *PodAllocator) Reconcile(old, new *corev1.Pod) error

Reconcile allocates or releases IPs for pods updating the pod annotation as necessary with all the additional information derived from those IPs

func (*PodAllocator) Sync

func (a *PodAllocator) Sync(objs []interface{}) error

Sync initializes the allocator with pods that already exist on the cluster

Jump to

Keyboard shortcuts

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