package sync

import "k8s.io/kubernetes/pkg/controller/nodeipam/ipam/sync"

Index

Constants

const (
	// InvalidPodCIDR is the event recorded when a node is found with an
	// invalid PodCIDR.
	InvalidPodCIDR = "CloudCIDRAllocatorInvalidPodCIDR"
	// InvalidModeEvent is the event recorded when the CIDR range cannot be
	// sync'd due to the cluster running in the wrong mode.
	InvalidModeEvent = "CloudCIDRAllocatorInvalidMode"
	// MismatchEvent is the event recorded when the CIDR range allocated in the
	// node spec does not match what has been allocated in the cloud.
	MismatchEvent = "CloudCIDRAllocatorMismatch"
)

Functions

func IsValidMode

func IsValidMode(m NodeSyncMode) bool

IsValidMode returns true if the given mode is valid.

Types

type NodeSync

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

NodeSync synchronizes the state for a single node in the cluster.

func New

func New(c controller, cloudAlias cloudAlias, kubeAPI kubeAPI, mode NodeSyncMode, nodeName string, set *cidrset.CidrSet) *NodeSync

New returns a new syncer for a given node.

func (*NodeSync) Delete

func (sync *NodeSync) Delete(node *v1.Node)

Delete performs the sync operations necessary to remove the node from the IPAM state.

This method is safe to call from multiple goroutines.

func (*NodeSync) Loop

func (sync *NodeSync) Loop(logger klog.Logger, done chan struct{})

Loop runs the sync loop for a given node. done is an optional channel that is closed when the Loop() returns.

func (*NodeSync) Update

func (sync *NodeSync) Update(node *v1.Node)

Update causes an update operation on the given node. If node is nil, then the syncer will fetch the node spec from the API server before syncing.

This method is safe to call from multiple goroutines.

type NodeSyncMode

type NodeSyncMode string

NodeSyncMode is the mode the cloud CIDR allocator runs in.

var (
	// SyncFromCloud is the mode that synchronizes the IP allocation from the cloud
	// platform to the node.
	SyncFromCloud NodeSyncMode = "SyncFromCloud"
	// SyncFromCluster is the mode that synchronizes the IP allocation determined
	// by the k8s controller to the cloud provider.
	SyncFromCluster NodeSyncMode = "SyncFromCluster"
)

Source Files

sync.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
3 hours ago

Tools for package owners.