Documentation ¶
Index ¶
- Constants
- func GenerateInstanceUrl(project, zone, name string) string
- func GenerateMigUrl(project, zone, name string) string
- func ParseInstanceUrl(url string) (project string, zone string, name string, err error)
- func ParseMigUrl(url string) (project string, zone string, name string, err error)
- type GceCloudProvider
- func (gce *GceCloudProvider) Cleanup() error
- func (gce *GceCloudProvider) GetAvailableMachineTypes() ([]string, error)
- func (gce *GceCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
- func (gce *GceCloudProvider) Name() string
- func (gce *GceCloudProvider) NewNodeGroup(machineType string, labels map[string]string, systemLabels map[string]string, ...) (cloudprovider.NodeGroup, error)
- func (gce *GceCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.NodeGroup, error)
- func (gce *GceCloudProvider) NodeGroups() []cloudprovider.NodeGroup
- func (gce *GceCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError)
- func (gce *GceCloudProvider) Refresh() error
- type GceManager
- type GcePriceModel
- type GceRef
- type GcpCloudProviderMode
- type Mig
- func (mig *Mig) Autoprovisioned() bool
- func (mig *Mig) Belongs(node *apiv1.Node) (bool, error)
- func (mig *Mig) Create() error
- func (mig *Mig) Debug() string
- func (mig *Mig) DecreaseTargetSize(delta int) error
- func (mig *Mig) Delete() error
- func (mig *Mig) DeleteNodes(nodes []*apiv1.Node) error
- func (mig *Mig) Exist() bool
- func (mig *Mig) Id() string
- func (mig *Mig) IncreaseSize(delta int) error
- func (mig *Mig) MaxSize() int
- func (mig *Mig) MinSize() int
- func (mig *Mig) Nodes() ([]string, error)
- func (mig *Mig) TargetSize() (int, error)
- func (mig *Mig) TemplateNodeInfo() (*schedulercache.NodeInfo, error)
Constants ¶
const ( ProviderNameGCE = "gce" ProviderNameGKE = "gke" )
The 'GCE' cloud provider actually implements both the GCE and GKE providers.
Variables ¶
This section is empty.
Functions ¶
func GenerateInstanceUrl ¶
GenerateInstanceUrl generates url for instance.
func GenerateMigUrl ¶
GenerateMigUrl generates url for instance.
func ParseInstanceUrl ¶
ParseInstanceUrl expects url in format: https://content.googleapis.com/compute/v1/projects/<project-id>/zones/<zone>/instances/<name>
func ParseMigUrl ¶
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, resourceLimiter *cloudprovider.ResourceLimiter) (*GceCloudProvider, error)
BuildGceCloudProvider builds CloudProvider implementation for GCE.
func (*GceCloudProvider) Cleanup ¶
func (gce *GceCloudProvider) Cleanup() error
Cleanup cleans up all resources before the cloud provider is removed
func (*GceCloudProvider) GetAvailableMachineTypes ¶
func (gce *GceCloudProvider) GetAvailableMachineTypes() ([]string, error)
GetAvailableMachineTypes get all machine types that can be requested from the cloud provider.
func (*GceCloudProvider) GetResourceLimiter ¶
func (gce *GceCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
GetResourceLimiter returns struct containing limits (max, min) for resources (cores, memory etc.).
func (*GceCloudProvider) Name ¶
func (gce *GceCloudProvider) Name() string
Name returns name of the cloud provider.
func (*GceCloudProvider) NewNodeGroup ¶
func (gce *GceCloudProvider) NewNodeGroup(machineType string, labels map[string]string, systemLabels map[string]string, extraResources map[string]resource.Quantity) (cloudprovider.NodeGroup, error)
NewNodeGroup builds a theoretical node group based on the node definition provided. The node group is not automatically created on the cloud provider side. The node group is not returned by NodeGroups() until it is created.
func (*GceCloudProvider) NodeGroupForNode ¶
func (gce *GceCloudProvider) NodeGroupForNode(node *apiv1.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.
func (*GceCloudProvider) Pricing ¶
func (gce *GceCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError)
Pricing returns pricing model for this cloud provider or error if not available.
func (*GceCloudProvider) Refresh ¶
func (gce *GceCloudProvider) Refresh() error
Refresh is called before every main loop and can be used to dynamically update cloud provider state. In particular the list of node groups returned by NodeGroups can change as a result of CloudProvider.Refresh().
type GceManager ¶
type GceManager interface { // RegisterMig registers mig in Gce Manager. Returns true if the node group didn't exist before. RegisterMig(mig *Mig) bool // UnregisterMig unregisters mig in Gce Manager. Returns true if the node group has been removed. UnregisterMig(toBeRemoved *Mig) bool // GetMigSize gets MIG size. GetMigSize(mig *Mig) (int64, error) // SetMigSize sets MIG size. SetMigSize(mig *Mig, size int64) error // DeleteInstances deletes the given instances. All instances must be controlled by the same MIG. DeleteInstances(instances []*GceRef) error // GetMigForInstance returns MigConfig of the given Instance GetMigForInstance(instance *GceRef) (*Mig, error) // GetMigNodes returns mig nodes. GetMigNodes(mig *Mig) ([]string, error) // Refresh updates config by calling GKE API (in GKE mode only). Refresh() error // GetResourceLimiter returns resource limiter. GetResourceLimiter() (*cloudprovider.ResourceLimiter, error) // Cleanup cleans up open resources before the cloud provider is destroyed, i.e. go routines etc. Cleanup() error // contains filtered or unexported methods }
GceManager handles gce communication and data caching.
func CreateGceManager ¶
func CreateGceManager(configReader io.Reader, mode GcpCloudProviderMode, clusterName string, discoveryOpts cloudprovider.NodeGroupDiscoveryOptions) (GceManager, error)
CreateGceManager constructs gceManager object.
type GcePriceModel ¶
type GcePriceModel struct { }
GcePriceModel implements PriceModel interface for GCE.
type GceRef ¶
GceRef contains s reference to some entity in GCE/GKE world.
func GceRefFromProviderId ¶
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 GcpCloudProviderMode ¶
type GcpCloudProviderMode string
GcpCloudProviderMode allows to pass information whether the cluster is GCE or GKE.
const ( // ModeGCE means that the cluster is running on gce (or using the legacy gke setup). ModeGCE GcpCloudProviderMode = "gce" // ModeGKE means that the cluster is running ModeGKE GcpCloudProviderMode = "gke" // ModeGKENAP means that the cluster is running on GKE with autoprovisioning enabled. // TODO(maciekpytel): remove this when NAP API is available in normal client ModeGKENAP GcpCloudProviderMode = "gke_nap" )
type Mig ¶
type Mig struct { GceRef // contains filtered or unexported fields }
Mig implements NodeGroup interfrace.
func (*Mig) Autoprovisioned ¶
Autoprovisioned returns true if the node group is autoprovisioned.
func (*Mig) DecreaseTargetSize ¶
DecreaseTargetSize decreases the target size of the node group. This function doesn't permit to delete any existing node and can be used only to reduce the request for new nodes that have not been yet fulfilled. Delta should be negative.
func (*Mig) Delete ¶
Delete deletes the node group on the cloud provider side. This will be executed only for autoprovisioned node groups, once their size drops to 0.
func (*Mig) DeleteNodes ¶
DeleteNodes deletes the nodes from the group.
func (*Mig) Exist ¶
Exist checks if the node group really exists on the cloud provider side. Allows to tell the theoretical node group from the real one.
func (*Mig) IncreaseSize ¶
IncreaseSize increases Mig size
func (*Mig) TargetSize ¶
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 Kubernetes.
func (*Mig) TemplateNodeInfo ¶
func (mig *Mig) TemplateNodeInfo() (*schedulercache.NodeInfo, error)
TemplateNodeInfo returns a node template for this node group.