Documentation ¶
Index ¶
- func StartServer(kubeConfig, saveState, configFileName string)
- type AutoScalerServerApp
- func (s *AutoScalerServerApp) Autoprovisioned(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.AutoprovisionedReply, error)
- func (s *AutoScalerServerApp) Belongs(ctx context.Context, request *apigrpc.BelongsRequest) (*apigrpc.BelongsReply, error)
- func (s *AutoScalerServerApp) Cleanup(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.CleanupReply, error)
- func (s *AutoScalerServerApp) Connect(ctx context.Context, request *apigrpc.ConnectRequest) (*apigrpc.ConnectReply, error)
- func (s *AutoScalerServerApp) Create(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.CreateReply, error)
- func (s *AutoScalerServerApp) Debug(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.DebugReply, error)
- func (s *AutoScalerServerApp) DecreaseTargetSize(ctx context.Context, request *apigrpc.DecreaseTargetSizeRequest) (*apigrpc.DecreaseTargetSizeReply, error)
- func (s *AutoScalerServerApp) Delete(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.DeleteReply, error)
- func (s *AutoScalerServerApp) DeleteNodes(ctx context.Context, request *apigrpc.DeleteNodesRequest) (*apigrpc.DeleteNodesReply, error)
- func (s *AutoScalerServerApp) Exist(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.ExistReply, error)
- func (s *AutoScalerServerApp) GPULabel(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.GPULabelReply, error)
- func (s *AutoScalerServerApp) GetAvailableGPUTypes(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.GetAvailableGPUTypesReply, error)
- func (s *AutoScalerServerApp) GetAvailableMachineTypes(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.AvailableMachineTypesReply, error)
- func (s *AutoScalerServerApp) GetResourceLimiter(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.ResourceLimiterReply, error)
- func (s *AutoScalerServerApp) Id(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.IdReply, error)
- func (s *AutoScalerServerApp) IncreaseSize(ctx context.Context, request *apigrpc.IncreaseSizeRequest) (*apigrpc.IncreaseSizeReply, error)
- func (s *AutoScalerServerApp) Load(fileName string) error
- func (s *AutoScalerServerApp) MaxSize(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.MaxSizeReply, error)
- func (s *AutoScalerServerApp) MinSize(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.MinSizeReply, error)
- func (s *AutoScalerServerApp) Name(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.NameReply, error)
- func (s *AutoScalerServerApp) NewNodeGroup(ctx context.Context, request *apigrpc.NewNodeGroupRequest) (*apigrpc.NewNodeGroupReply, error)
- func (s *AutoScalerServerApp) NodeGroupForNode(ctx context.Context, request *apigrpc.NodeGroupForNodeRequest) (*apigrpc.NodeGroupForNodeReply, error)
- func (s *AutoScalerServerApp) NodeGroups(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.NodeGroupsReply, error)
- func (s *AutoScalerServerApp) NodePrice(ctx context.Context, request *apigrpc.NodePriceRequest) (*apigrpc.NodePriceReply, error)
- func (s *AutoScalerServerApp) Nodes(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.NodesReply, error)
- func (s *AutoScalerServerApp) PodPrice(ctx context.Context, request *apigrpc.PodPriceRequest) (*apigrpc.PodPriceReply, error)
- func (s *AutoScalerServerApp) Pricing(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.PricingModelReply, error)
- func (s *AutoScalerServerApp) Refresh(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.RefreshReply, error)
- func (s *AutoScalerServerApp) Save(fileName string) error
- func (s *AutoScalerServerApp) TargetSize(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.TargetSizeReply, error)
- func (s *AutoScalerServerApp) TemplateNodeInfo(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.TemplateNodeInfoReply, error)
- type AutoScalerServerNode
- type AutoScalerServerNodeGroup
- type AutoScalerServerNodeState
- type KubernetesLabel
- type NodeGroupState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartServer ¶
func StartServer(kubeConfig, saveState, configFileName string)
StartServer start the service
Types ¶
type AutoScalerServerApp ¶
type AutoScalerServerApp struct { ResourceLimiter *types.ResourceLimiter `json:"limits"` Groups map[string]*AutoScalerServerNodeGroup `json:"groups"` Configuration *types.AutoScalerServerConfig `json:"config"` KubeAdmConfiguration *apigrpc.KubeAdmConfig `json:"kubeadm"` NodesDefinition []*apigrpc.NodeGroupDef `json:"nodedefs"` AutoProvision bool `json:"auto"` }
AutoScalerServerApp declare AutoScaler grpc server
func (*AutoScalerServerApp) Autoprovisioned ¶
func (s *AutoScalerServerApp) Autoprovisioned(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.AutoprovisionedReply, error)
Autoprovisioned returns true if the node group is autoprovisioned. An autoprovisioned group was created by CA and can be deleted when scaled to 0.
func (*AutoScalerServerApp) Belongs ¶
func (s *AutoScalerServerApp) Belongs(ctx context.Context, request *apigrpc.BelongsRequest) (*apigrpc.BelongsReply, error)
Belongs returns true if the given node belongs to the NodeGroup.
func (*AutoScalerServerApp) Cleanup ¶
func (s *AutoScalerServerApp) Cleanup(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.CleanupReply, error)
Cleanup cleans up open resources before the cloud provider is destroyed, i.e. go routines etc.
func (*AutoScalerServerApp) Connect ¶
func (s *AutoScalerServerApp) Connect(ctx context.Context, request *apigrpc.ConnectRequest) (*apigrpc.ConnectReply, error)
Connect allows client to connect
func (*AutoScalerServerApp) Create ¶
func (s *AutoScalerServerApp) Create(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.CreateReply, error)
Create creates the node group on the cloud provider side. Implementation optional.
func (*AutoScalerServerApp) Debug ¶
func (s *AutoScalerServerApp) Debug(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.DebugReply, error)
Debug returns a string containing all information regarding this node group.
func (*AutoScalerServerApp) DecreaseTargetSize ¶
func (s *AutoScalerServerApp) DecreaseTargetSize(ctx context.Context, request *apigrpc.DecreaseTargetSizeRequest) (*apigrpc.DecreaseTargetSizeReply, 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. It is assumed that cloud provider will not delete the existing nodes when there is an option to just decrease the target. Implementation required.
func (*AutoScalerServerApp) Delete ¶
func (s *AutoScalerServerApp) Delete(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.DeleteReply, error)
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. Implementation optional.
func (*AutoScalerServerApp) DeleteNodes ¶
func (s *AutoScalerServerApp) DeleteNodes(ctx context.Context, request *apigrpc.DeleteNodesRequest) (*apigrpc.DeleteNodesReply, 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. Implementation required.
func (*AutoScalerServerApp) Exist ¶
func (s *AutoScalerServerApp) Exist(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.ExistReply, error)
Exist checks if the node group really exists on the cloud provider side. Allows to tell the theoretical node group from the real one. Implementation required.
func (*AutoScalerServerApp) GPULabel ¶
func (s *AutoScalerServerApp) GPULabel(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.GPULabelReply, error)
GPULabel returns the label added to nodes with GPU resource.
func (*AutoScalerServerApp) GetAvailableGPUTypes ¶
func (s *AutoScalerServerApp) GetAvailableGPUTypes(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.GetAvailableGPUTypesReply, error)
GetAvailableGPUTypes return all available GPU types cloud provider supports.
func (*AutoScalerServerApp) GetAvailableMachineTypes ¶
func (s *AutoScalerServerApp) GetAvailableMachineTypes(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.AvailableMachineTypesReply, error)
GetAvailableMachineTypes get all machine types that can be requested from the cloud provider. Implementation optional.
func (*AutoScalerServerApp) GetResourceLimiter ¶
func (s *AutoScalerServerApp) GetResourceLimiter(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.ResourceLimiterReply, error)
GetResourceLimiter returns struct containing limits (max, min) for resources (cores, memory etc.).
func (*AutoScalerServerApp) Id ¶
func (s *AutoScalerServerApp) Id(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.IdReply, error)
Id returns an unique identifier of the node group.
func (*AutoScalerServerApp) IncreaseSize ¶
func (s *AutoScalerServerApp) IncreaseSize(ctx context.Context, request *apigrpc.IncreaseSizeRequest) (*apigrpc.IncreaseSizeReply, 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. Implementation required.
func (*AutoScalerServerApp) Load ¶
func (s *AutoScalerServerApp) Load(fileName string) error
Load saved state from file
func (*AutoScalerServerApp) MaxSize ¶
func (s *AutoScalerServerApp) MaxSize(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.MaxSizeReply, error)
MaxSize returns maximum size of the node group.
func (*AutoScalerServerApp) MinSize ¶
func (s *AutoScalerServerApp) MinSize(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.MinSizeReply, error)
MinSize returns minimum size of the node group.
func (*AutoScalerServerApp) Name ¶
func (s *AutoScalerServerApp) Name(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.NameReply, error)
Name returns name of the cloud provider.
func (*AutoScalerServerApp) NewNodeGroup ¶
func (s *AutoScalerServerApp) NewNodeGroup(ctx context.Context, request *apigrpc.NewNodeGroupRequest) (*apigrpc.NewNodeGroupReply, 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. Implementation optional.
func (*AutoScalerServerApp) NodeGroupForNode ¶
func (s *AutoScalerServerApp) NodeGroupForNode(ctx context.Context, request *apigrpc.NodeGroupForNodeRequest) (*apigrpc.NodeGroupForNodeReply, error)
NodeGroupForNode returns the node group for the given node, nil if the node should not be processed by cluster autoscaler, or non-nil error if such occurred. Must be implemented.
func (*AutoScalerServerApp) NodeGroups ¶
func (s *AutoScalerServerApp) NodeGroups(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.NodeGroupsReply, error)
NodeGroups returns all node groups configured for this cloud provider.
func (*AutoScalerServerApp) NodePrice ¶
func (s *AutoScalerServerApp) NodePrice(ctx context.Context, request *apigrpc.NodePriceRequest) (*apigrpc.NodePriceReply, error)
NodePrice returns a price of running the given node for a given period of time. All prices returned by the structure should be in the same currency.
func (*AutoScalerServerApp) Nodes ¶
func (s *AutoScalerServerApp) Nodes(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.NodesReply, error)
Nodes returns a list of all nodes that belong to this node group. It is required that Instance objects returned by this method have Id field set. Other fields are optional.
func (*AutoScalerServerApp) PodPrice ¶
func (s *AutoScalerServerApp) PodPrice(ctx context.Context, request *apigrpc.PodPriceRequest) (*apigrpc.PodPriceReply, error)
PodPrice returns a theoretical minimum price of running a pod for a given period of time on a perfectly matching machine.
func (*AutoScalerServerApp) Pricing ¶
func (s *AutoScalerServerApp) Pricing(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.PricingModelReply, error)
Pricing returns pricing model for this cloud provider or error if not available. Implementation optional.
func (*AutoScalerServerApp) Refresh ¶
func (s *AutoScalerServerApp) Refresh(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.RefreshReply, 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().
func (*AutoScalerServerApp) Save ¶
func (s *AutoScalerServerApp) Save(fileName string) error
Save state to file
func (*AutoScalerServerApp) TargetSize ¶
func (s *AutoScalerServerApp) TargetSize(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.TargetSizeReply, 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). Implementation required.
func (*AutoScalerServerApp) TemplateNodeInfo ¶
func (s *AutoScalerServerApp) TemplateNodeInfo(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.TemplateNodeInfoReply, error)
TemplateNodeInfo returns a schedulercache.NodeInfo structure of an empty (as if just started) node. This will be used in scale-up simulations to predict what would a new node look like if a node group was expanded. The returned NodeInfo is expected to have a fully populated Node object, with all of the labels, capacity and allocatable information as well as all pods that are started on the node by default, using manifest (most likely only kube-proxy). Implementation optional.
type AutoScalerServerNode ¶
type AutoScalerServerNode struct { ProviderID string `json:"providerID"` NodeGroupID string `json:"group"` // Node name and instance name could be differ when using AWS cloud provider InstanceName string `json:"instance-name"` NodeName string `json:"node-name"` NodeIndex int `json:"index"` InstanceType string `json:"instance-Type"` Disk int `json:"disk"` Addresses []string `json:"addresses"` State AutoScalerServerNodeState `json:"state"` AutoProvisionned bool `json:"auto"` AwsConfig *aws.Configuration `json:"aws"` RunningInstance *aws.Ec2Instance // contains filtered or unexported fields }
AutoScalerServerNode Describe a AutoScaler VM
func (*AutoScalerServerNode) CheckIfIPIsReady ¶
func (vm *AutoScalerServerNode) CheckIfIPIsReady(nodename, address string) error
CheckIfIPIsReady method SSH test IP
type AutoScalerServerNodeGroup ¶
type AutoScalerServerNodeGroup struct { sync.Mutex NodeGroupIdentifier string `json:"identifier"` ServiceIdentifier string `json:"service"` InstanceType string `json:"instance-type"` DiskSize int `json:"diskSize"` Status NodeGroupState `json:"status"` MinNodeSize int `json:"minSize"` MaxNodeSize int `json:"maxSize"` Nodes map[string]*AutoScalerServerNode `json:"nodes"` NodeLabels KubernetesLabel `json:"nodeLabels"` SystemLabels KubernetesLabel `json:"systemLabels"` AutoProvision bool `json:"auto-provision"` LastCreatedNodeIndex int `json:"node-index"` // contains filtered or unexported fields }
AutoScalerServerNodeGroup Group all AutoScaler VM created inside a NodeGroup Each node have name like <node group name>-vm-<vm index>
type AutoScalerServerNodeState ¶
type AutoScalerServerNodeState int32
AutoScalerServerNodeState VM state
const ( // AutoScalerServerNodeStateNotCreated not created state AutoScalerServerNodeStateNotCreated AutoScalerServerNodeState = 0 // AutoScalerServerNodeStateRunning running state AutoScalerServerNodeStateRunning AutoScalerServerNodeState = 1 // AutoScalerServerNodeStateStopped stopped state AutoScalerServerNodeStateStopped AutoScalerServerNodeState = 2 // AutoScalerServerNodeStateDeleted deleted state AutoScalerServerNodeStateDeleted AutoScalerServerNodeState = 3 // AutoScalerServerNodeStateUndefined undefined state AutoScalerServerNodeStateUndefined AutoScalerServerNodeState = 4 )
func (AutoScalerServerNodeState) String ¶
func (s AutoScalerServerNodeState) String() string
type NodeGroupState ¶
type NodeGroupState int32
NodeGroupState describe the nodegroup status
const ( // NodegroupNotCreated not created state NodegroupNotCreated NodeGroupState = 0 // NodegroupCreated create state NodegroupCreated NodeGroupState = 1 // NodegroupDeleting deleting status NodegroupDeleting NodeGroupState = 2 // NodegroupDeleted deleted status NodegroupDeleted NodeGroupState = 3 )