Documentation ¶
Index ¶
- type FakeInstanceGroups
- func (f *FakeInstanceGroups) AddInstancesToInstanceGroup(name, zone string, instanceRefs []*compute.InstanceReference) error
- func (f *FakeInstanceGroups) CreateInstanceGroup(ig *compute.InstanceGroup, zone string) error
- func (f *FakeInstanceGroups) DeleteInstanceGroup(name, zone string) error
- func (f *FakeInstanceGroups) GetInstanceGroup(name, zone string) (*compute.InstanceGroup, error)
- func (f *FakeInstanceGroups) GetInstancesByZone() map[string][]string
- func (f *FakeInstanceGroups) ListInstancesInInstanceGroup(name, zone string, state string) ([]*compute.InstanceWithNamedPorts, error)
- func (f *FakeInstanceGroups) RemoveInstancesFromInstanceGroup(name, zone string, instanceRefs []*compute.InstanceReference) error
- func (f *FakeInstanceGroups) SetNamedPortsOfInstanceGroup(igName, zone string, namedPorts []*compute.NamedPort) error
- func (f *FakeInstanceGroups) ToInstanceReferences(zone string, instanceNames []string) (refs []*compute.InstanceReference)
- type FakeZoneLister
- type InstanceGroups
- type Instances
- func (i *Instances) Add(groupName string, names []string) error
- func (i *Instances) DeleteInstanceGroup(name string) error
- func (i *Instances) EnsureInstanceGroupsAndPorts(name string, ports []int64) (igs []*compute.InstanceGroup, err error)
- func (i *Instances) Get(name, zone string) (*compute.InstanceGroup, error)
- func (i *Instances) Init(zl ZoneLister)
- func (i *Instances) Remove(groupName string, names []string) error
- func (i *Instances) Sync(nodes []string) (err error)
- type NodePool
- type ZoneLister
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeInstanceGroups ¶
type FakeInstanceGroups struct {
// contains filtered or unexported fields
}
FakeInstanceGroups fakes out the instance groups api.
func NewFakeInstanceGroups ¶
func NewFakeInstanceGroups(nodes sets.String, namer *utils.Namer) *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) GetInstancesByZone ¶
func (f *FakeInstanceGroups) GetInstancesByZone() map[string][]string
GetInstancesByZone returns the zone to instances map.
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 FakeZoneLister ¶
type FakeZoneLister struct {
Zones []string
}
FakeZoneLister records zones for nodes.
func (*FakeZoneLister) GetZoneForNode ¶
func (z *FakeZoneLister) GetZoneForNode(name string) (string, error)
GetZoneForNode returns the only zone stored in the fake zone lister.
func (*FakeZoneLister) ListZones ¶
func (z *FakeZoneLister) ListZones() ([]string, error)
ListZones returns the list of zones.
type InstanceGroups ¶
type InstanceGroups interface { GetInstanceGroup(name, zone string) (*compute.InstanceGroup, error) CreateInstanceGroup(ig *compute.InstanceGroup, zone string) error DeleteInstanceGroup(name, zone string) error // TODO: Refactor for modulatiry. 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 }
InstanceGroups is an interface for managing gce instances groups, and the instances therein.
type Instances ¶
type Instances struct { ZoneLister // contains filtered or unexported fields }
Instances implements NodePool.
func (*Instances) DeleteInstanceGroup ¶
DeleteInstanceGroup deletes the given IG by name, from all zones.
func (*Instances) EnsureInstanceGroupsAndPorts ¶
func (i *Instances) EnsureInstanceGroupsAndPorts(name string, ports []int64) (igs []*compute.InstanceGroup, err error)
EnsureInstanceGroupsAndPorts creates or gets an instance group if it doesn't exist and adds the given ports to it. Returns a list of one instance group per zone, all of which have the exact same named ports.
func (*Instances) Get ¶
func (i *Instances) Get(name, zone string) (*compute.InstanceGroup, error)
Get returns the Instance Group by name.
func (*Instances) Init ¶
func (i *Instances) Init(zl ZoneLister)
Init initializes the instance pool. The given zoneLister is used to list all zones that require an instance group, and to lookup which zone a given Kubernetes node is in so we can add it to the right instance group.
type NodePool ¶
type NodePool interface { Init(zl ZoneLister) // The following 2 methods operate on instance groups. EnsureInstanceGroupsAndPorts(name string, ports []int64) ([]*compute.InstanceGroup, error) DeleteInstanceGroup(name string) error // TODO: Refactor for modularity Add(groupName string, nodeNames []string) error Remove(groupName string, nodeNames []string) error Sync(nodeNames []string) error Get(name, zone string) (*compute.InstanceGroup, error) }
NodePool is an interface to manage a pool of kubernetes nodes synced with vm instances in the cloud through the InstanceGroups interface. It handles zones opaquely using the zoneLister.
func NewNodePool ¶
func NewNodePool(cloud InstanceGroups, namer *utils.Namer) NodePool
NewNodePool creates a new node pool.
- cloud: implements InstanceGroups, used to sync Kubernetes nodes with members of the cloud InstanceGroup.