Documentation
¶
Index ¶
- type ClusterClient
- type NodeManager
- func (manager *NodeManager) DeleteNodes(instanceIDs []string) (int, error)
- func (manager *NodeManager) GetNode(instanceID string) (stackpointio.Node, bool)
- func (manager *NodeManager) GetNodePK(nodePK int) (stackpointio.Node, bool)
- func (manager *NodeManager) IncreaseSize(additional int, nodeType string, groupName string) (int, error)
- func (manager *NodeManager) Nodes() ([]string, error)
- func (manager *NodeManager) NodesForGroupID(group string) ([]string, error)
- func (manager *NodeManager) Size() int
- func (manager *NodeManager) Update() error
- type SpcCloudProvider
- type SpcNodeClass
- type SpcNodeGroup
- func (sng SpcNodeGroup) Debug() string
- func (sng SpcNodeGroup) DecreaseTargetSize(delta int) error
- func (sng SpcNodeGroup) DeleteNodes(nodes []*apiv1.Node) error
- func (sng SpcNodeGroup) Id() string
- func (sng SpcNodeGroup) IncreaseSize(delta int) error
- func (sng SpcNodeGroup) MaxSize() int
- func (sng SpcNodeGroup) MinSize() int
- func (sng SpcNodeGroup) Nodes() ([]string, error)
- func (sng SpcNodeGroup) TargetSize() (int, error)
- type StackpointClusterClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterClient ¶
type ClusterClient interface {
// contains filtered or unexported methods
}
ClusterClient represents an api interface
type NodeManager ¶
type NodeManager struct {
// contains filtered or unexported fields
}
NodeManager has a set of nodes and can add or delete them via the StackPointCloud API
func CreateNodeManager ¶
func CreateNodeManager(cluster *StackpointClusterClient) NodeManager
CreateNodeManager creates a NodeManager
func (*NodeManager) DeleteNodes ¶
func (manager *NodeManager) DeleteNodes(instanceIDs []string) (int, error)
DeleteNodes calls the StackPointCloud API and ensures that the specified nodes are in a deleted state. Returns the number of nodes deleted and an error If the deletion count is less than requested but all nodes are in a deleted state, then the error will be nil.
func (*NodeManager) GetNode ¶
func (manager *NodeManager) GetNode(instanceID string) (stackpointio.Node, bool)
GetNode returns a Node identified by the stackpointio instanceID
func (*NodeManager) GetNodePK ¶
func (manager *NodeManager) GetNodePK(nodePK int) (stackpointio.Node, bool)
GetNodePK returns a Node identified by the stackpointio primaryKey
func (*NodeManager) IncreaseSize ¶
func (manager *NodeManager) IncreaseSize(additional int, nodeType string, groupName string) (int, error)
IncreaseSize adds nodes to the manager and to the cluster, waits until the addition is complete. Returns the count of running nodes.
func (*NodeManager) Nodes ¶
func (manager *NodeManager) Nodes() ([]string, error)
Nodes returns the complete set of stackpointio node instanceIDs
func (*NodeManager) NodesForGroupID ¶
func (manager *NodeManager) NodesForGroupID(group string) ([]string, error)
NodesForGroupID returns a set of stackpointio node instanceIDs for a given node group
func (*NodeManager) Size ¶
func (manager *NodeManager) Size() int
Size returns the number of nodes which are in a "running" state
func (*NodeManager) Update ¶
func (manager *NodeManager) Update() error
Update refreshes the state of the current nodes in the clusterClient
type SpcCloudProvider ¶
type SpcCloudProvider struct {
// contains filtered or unexported fields
}
SpcCloudProvider implements CloudProvider
func BuildSpcCloudProvider ¶
func BuildSpcCloudProvider(spcClient *StackpointClusterClient, specs []string) (*SpcCloudProvider, error)
BuildSpcCloudProvider builds CloudProvider implementation for stackpointio.
func (*SpcCloudProvider) Name ¶
func (spc *SpcCloudProvider) Name() string
Name returns name of the cloud provider.
func (*SpcCloudProvider) NodeGroupForNode ¶
func (spc *SpcCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.NodeGroup, error)
NodeGroupForNode returns the node group for the given node cloudprovider text says, "nil if the node should not be processed by cluster autoscaler, or non-nil error if such occurred." but the implementation requires a non-nil error, value of the NodeGroup is _not_ consistently checked against nil
func (*SpcCloudProvider) NodeGroups ¶
func (spc *SpcCloudProvider) NodeGroups() []cloudprovider.NodeGroup
NodeGroups returns all node groups configured for this cloud provider.
type SpcNodeClass ¶
type SpcNodeClass struct {
Type string
}
type SpcNodeGroup ¶
type SpcNodeGroup struct { Class SpcNodeClass // contains filtered or unexported fields }
SpcNodeGroup implements NodeGroup
func (SpcNodeGroup) Debug ¶
func (sng SpcNodeGroup) Debug() string
Debug returns a string containing all information regarding this node group.
func (SpcNodeGroup) DecreaseTargetSize ¶
func (sng SpcNodeGroup) DecreaseTargetSize(delta int) error
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 (SpcNodeGroup) DeleteNodes ¶
func (sng SpcNodeGroup) DeleteNodes(nodes []*apiv1.Node) error
DeleteNodes deletes nodes from this node group. Error is returned either on failure or if the given node doesn't belong to this node group. This function should wait until node group size is updated.
func (SpcNodeGroup) Id ¶
func (sng SpcNodeGroup) Id() string
Id returns an unique identifier of the node group.
func (SpcNodeGroup) IncreaseSize ¶
func (sng SpcNodeGroup) IncreaseSize(delta int) error
IncreaseSize increases the size of the node group. To delete a node you need to explicitly name it and use DeleteNode. This function should wait until node group size is updated.
func (SpcNodeGroup) MaxSize ¶
func (sng SpcNodeGroup) MaxSize() int
MaxSize returns maximum size of the node group.
func (SpcNodeGroup) MinSize ¶
func (sng SpcNodeGroup) MinSize() int
MinSize returns minimum size of the node group.
func (SpcNodeGroup) Nodes ¶
func (sng SpcNodeGroup) Nodes() ([]string, error)
Nodes returns a list of all nodes that belong to this node group. return value is a set of ... strings for gce, this is "fmt.Sprintf("gce://%s/%s/%s", project, zone, name))" for aws, this is Instance.InstanceId, something like "i-04a211e5f5c755e64" for azure, this is "azure:////" + fixEndiannessUUID(string(strings.ToUpper(*instance.VirtualMachineScaleSetVMProperties.VMID)))""
func (SpcNodeGroup) TargetSize ¶
func (sng SpcNodeGroup) TargetSize() (int, error)
TargetSize returns the current target size of the node group. It is possible that the number of nodes in Kubernetes is different at the moment but should be equal to Size() once everything stabilizes (new nodes finish startup and registration or removed nodes are deleted completely)
type StackpointClusterClient ¶
type StackpointClusterClient struct {
// contains filtered or unexported fields
}
StackpointClusterClient is a StackPointCloud API client for a particular cluster
func CreateClusterClient ¶
func CreateClusterClient() (*StackpointClusterClient, error)
CreateClusterClient creates a ClusterClient from environment variables {CLUSTER_API_TOKEN, SPC_BASE_API_URL, ORGANIZATION_ID, CLUSTER_ID}