instancegroups

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller synchronizes the state of the nodes to the unmanaged instance groups.

func NewController

func NewController(config *ControllerConfig, logger klog.Logger) *Controller

NewController returns a new node update controller.

func (*Controller) Run

func (c *Controller) Run()

Run the queue to process updates for the controller. This must be run in a separate goroutine (method will block until queue shutdown).

func (*Controller) Shutdown

func (c *Controller) Shutdown()

Shutdown shuts down the goroutine that processes node updates.

type ControllerConfig

type ControllerConfig struct {
	NodeInformer cache.SharedIndexInformer
	IGManager    Manager
	HasSynced    func() bool
	StopCh       <-chan struct{}
}

type FakeInstanceGroups

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

FakeInstanceGroups fakes out the instance groups api.

func NewEmptyFakeInstanceGroups

func NewEmptyFakeInstanceGroups() *FakeInstanceGroups

NewEmptyFakeInstanceGroups creates a new FakeInstanceGroups without zones, igs or instances.

func NewFakeInstanceGroups

func NewFakeInstanceGroups(zonesToIGsToInstances map[string]IGsToInstances, maxIGSize int) *FakeInstanceGroups

NewFakeInstanceGroups creates a new FakeInstanceGroups.

func (*FakeInstanceGroups) AddInstancesToInstanceGroup

func (f *FakeInstanceGroups) AddInstancesToInstanceGroup(name, zone string, instanceRefs []*compute.InstanceReference) error

AddInstancesToInstanceGroup fakes adding instances to an instance group.

func (*FakeInstanceGroups) CreateInstanceGroup

func (f *FakeInstanceGroups) CreateInstanceGroup(ig *compute.InstanceGroup, zone string) error

CreateInstanceGroup fakes instance group creation.

func (*FakeInstanceGroups) DeleteInstanceGroup

func (f *FakeInstanceGroups) DeleteInstanceGroup(name, zone string) error

DeleteInstanceGroup fakes instance group deletion.

func (*FakeInstanceGroups) GetInstanceGroup

func (f *FakeInstanceGroups) GetInstanceGroup(name, zone string) (*compute.InstanceGroup, error)

GetInstanceGroup fakes getting an instance group from the cloud.

func (*FakeInstanceGroups) ListInstanceGroups

func (f *FakeInstanceGroups) ListInstanceGroups(zone string) ([]*compute.InstanceGroup, error)

ListInstanceGroups fakes listing instance groups in a zone

func (*FakeInstanceGroups) ListInstancesInInstanceGroup

func (f *FakeInstanceGroups) ListInstancesInInstanceGroup(name, zone string, state string) ([]*compute.InstanceWithNamedPorts, error)

ListInstancesInInstanceGroup fakes listing instances in an instance group.

func (*FakeInstanceGroups) RemoveInstancesFromInstanceGroup

func (f *FakeInstanceGroups) RemoveInstancesFromInstanceGroup(name, zone string, instanceRefs []*compute.InstanceReference) error

RemoveInstancesFromInstanceGroup fakes removing instances from an instance group.

func (*FakeInstanceGroups) SetNamedPortsOfInstanceGroup

func (f *FakeInstanceGroups) SetNamedPortsOfInstanceGroup(igName, zone string, namedPorts []*compute.NamedPort) error

func (*FakeInstanceGroups) ToInstanceReferences

func (f *FakeInstanceGroups) ToInstanceReferences(zone string, instanceNames []string) (refs []*compute.InstanceReference)

type IGsToInstances

type IGsToInstances map[*compute.InstanceGroup]sets.String

type Manager

type Manager interface {
	EnsureInstanceGroupsAndPorts(name string, ports []int64) ([]*compute.InstanceGroup, error)
	DeleteInstanceGroup(name string) error

	Get(name, zone string) (*compute.InstanceGroup, error)
	List() ([]string, error)

	Sync(nodeNames []string) error
}

Manager is an interface to sync kubernetes nodes to google cloud instance groups through the Provider interface. It handles zones opaquely using the zoneLister.

func NewManager

func NewManager(config *ManagerConfig, logger klog.Logger) Manager

NewManager creates a new node pool using ManagerConfig.

type ManagerConfig

type ManagerConfig struct {
	// Cloud implements Provider, used to sync Kubernetes nodes with members of the cloud InstanceGroup.
	Cloud      Provider
	Namer      namer.BackendNamer
	Recorders  recorderSource
	BasePath   string
	ZoneGetter *zonegetter.ZoneGetter
	MaxIGSize  int
}

ManagerConfig is used for Manager constructor.

type Provider

type Provider interface {
	GetInstanceGroup(name, zone string) (*compute.InstanceGroup, error)
	CreateInstanceGroup(ig *compute.InstanceGroup, zone string) error
	DeleteInstanceGroup(name, zone string) error
	ListInstanceGroups(zone string) ([]*compute.InstanceGroup, error)

	// TODO: Refactor for modularity.
	ListInstancesInInstanceGroup(name, zone string, state string) ([]*compute.InstanceWithNamedPorts, error)
	AddInstancesToInstanceGroup(name, zone string, instanceRefs []*compute.InstanceReference) error
	RemoveInstancesFromInstanceGroup(name, zone string, instanceRefs []*compute.InstanceReference) error
	ToInstanceReferences(zone string, instanceNames []string) (refs []*compute.InstanceReference)
	SetNamedPortsOfInstanceGroup(igName, zone string, namedPorts []*compute.NamedPort) error
}

Provider is an interface for managing gce instances groups, and the instances therein.

Jump to

Keyboard shortcuts

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