zonegetter

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllNodesFilter                 = "AllNodesFilter"
	CandidateNodesFilter           = "CandidateNodesFilter"
	CandidateAndUnreadyNodesFilter = "CandidateAndUnreadyNodesFilter"
)

Variables

View Source
var ErrNodeNotFound = errors.New("node not found")
View Source
var ErrProviderIDNotFound = errors.New("providerID not found")
View Source
var ErrSplitProviderID = errors.New("error splitting providerID")

Functions

func AddFakeNode added in v1.28.0

func AddFakeNode(zoneGetter *ZoneGetter, node *apiv1.Node) error

AddFakeNode adds fake node to the ZoneGetter.

func AddFakeNodes

func AddFakeNodes(zoneGetter *ZoneGetter, newZone string, instances ...string) error

AddFakeNodes adds fake nodes to the ZoneGetter in the provided zone.

func DeleteFakeNodesInZone

func DeleteFakeNodesInZone(t *testing.T, zone string, zoneGetter *ZoneGetter)

DeleteFakeNodesInZone deletes all nodes in a zone.

func FakeNodeInformer

func FakeNodeInformer() cache.SharedIndexInformer

func PopulateFakeNodeInformer

func PopulateFakeNodeInformer(nodeInformer cache.SharedIndexInformer)

PopulateFakeNodeInformer populates a fake node informer with fake nodes.

Types

type Filter

type Filter string

type Mode

type Mode int
const (
	// In GCP mode, the ZoneGetter will fetch the zone information from
	// k8s Node objects.
	GCP Mode = iota
	// In NonGCP mode, the ZoneGetter will only return the zone specified
	// in gce.conf directly.
	NonGCP
)

type ZoneGetter

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

ZoneGetter manages lookups for GCE instances to zones.

func NewNonGCPZoneGetter

func NewNonGCPZoneGetter(zone string) *ZoneGetter

NewNonGCPZoneGetter initialize a ZoneGetter in Non-GCP mode.

func NewZoneGetter

func NewZoneGetter(nodeInformer cache.SharedIndexInformer) *ZoneGetter

NewZoneGetter initialize a ZoneGetter in GCP mode.

func (*ZoneGetter) List

func (z *ZoneGetter) List(filter Filter, logger klog.Logger) ([]string, error)

List returns a list of zones containing nodes that satisfy the given node filtering mode.

func (*ZoneGetter) ZoneForNode

func (z *ZoneGetter) ZoneForNode(name string, logger klog.Logger) (string, error)

ZoneForNode returns the zone for a given node by looking up providerID.

Jump to

Keyboard shortcuts

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