gce

package
v0.0.0-...-f071e3e Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateInstanceUrl

func GenerateInstanceUrl(project, zone, name string) string

GenerateInstanceUrl generates url for instance.

func GenerateMigUrl

func GenerateMigUrl(project, zone, name string) string

GenerateMigUrl generates url for instance.

func ParseInstanceUrl

func ParseInstanceUrl(url string) (project string, zone string, name string, err error)

ParseInstanceUrl expects url in format: https://content.googleapis.com/compute/v1/projects/<project-id>/zones/<zone>/instances/<name>

func ParseMigUrl

func ParseMigUrl(url string) (project string, zone string, name string, err error)

ParseMigUrl expects url in format: https://content.googleapis.com/compute/v1/projects/<project-id>/zones/<zone>/instanceGroups/<name>

Types

type GceCloudProvider

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

GceCloudProvider implements CloudProvider interface.

func BuildGceCloudProvider

func BuildGceCloudProvider(gceManager *GceManager, specs []string) (*GceCloudProvider, error)

BuildGceCloudProvider builds CloudProvider implementation for GCE.

func (*GceCloudProvider) Name

func (gce *GceCloudProvider) Name() string

Name returns name of the cloud provider.

func (*GceCloudProvider) NodeGroupForNode

func (gce *GceCloudProvider) NodeGroupForNode(node *kube_api.Node) (cloudprovider.NodeGroup, error)

NodeGroupForNode returns the node group for the given node.

func (*GceCloudProvider) NodeGroups

func (gce *GceCloudProvider) NodeGroups() []cloudprovider.NodeGroup

NodeGroups returns all node groups configured for this cloud provider.

type GceManager

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

GceManager is handles gce communication and data caching.

func CreateGceManager

func CreateGceManager(configReader io.Reader) (*GceManager, error)

CreateGceManager constructs gceManager object.

func (*GceManager) DeleteInstances

func (m *GceManager) DeleteInstances(instances []*GceRef) error

DeleteInstances deletes the given instances. All instances must be controlled by the same MIG.

func (*GceManager) GetMigForInstance

func (m *GceManager) GetMigForInstance(instance *GceRef) (*Mig, error)

GetMigForInstance returns MigConfig of the given Instance

func (*GceManager) GetMigSize

func (m *GceManager) GetMigSize(mig *Mig) (int64, error)

GetMigSize gets MIG size.

func (*GceManager) RegisterMig

func (m *GceManager) RegisterMig(mig *Mig)

RegisterMig registers mig in Gce Manager.

func (*GceManager) SetMigSize

func (m *GceManager) SetMigSize(mig *Mig, size int64) error

SetMigSize sets MIG size.

type GceRef

type GceRef struct {
	Project string
	Zone    string
	Name    string
}

GceRef contains s reference to some entity in GCE/GKE world.

func GceRefFromProviderId

func GceRefFromProviderId(id string) (*GceRef, error)

GceRefFromProviderId creates InstanceConfig object from provider id which must be in format: gce://<project-id>/<zone>/<name> TODO(piosz): add better check whether the id is correct

type Mig

type Mig struct {
	GceRef
	// contains filtered or unexported fields
}

Mig implements NodeGroup interfrace.

func (*Mig) Belongs

func (mig *Mig) Belongs(node *kube_api.Node) (bool, error)

Belongs returns true if the given node belongs to the NodeGroup.

func (*Mig) Debug

func (mig *Mig) Debug() string

Debug returns a debug string for the Mig.

func (*Mig) DeleteNodes

func (mig *Mig) DeleteNodes(nodes []*kube_api.Node) error

DeleteNodes deletes the nodes from the group.

func (*Mig) Id

func (mig *Mig) Id() string

Id returns mig url.

func (*Mig) IncreaseSize

func (mig *Mig) IncreaseSize(delta int) error

IncreaseSize increases Mig size

func (*Mig) MaxSize

func (mig *Mig) MaxSize() int

MaxSize returns maximum size of the node group.

func (*Mig) MinSize

func (mig *Mig) MinSize() int

MinSize returns minimum size of the node group.

func (*Mig) TargetSize

func (mig *Mig) TargetSize() (int, error)

TargetSize returns the current TARGET size of the node group. It is possible that the number is different from the number of nodes registered in Kuberentes.

Jump to

Keyboard shortcuts

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