Documentation ¶
Index ¶
- Constants
- func CreateLabelOrAnnotation(values []string) types.KubernetesLabel
- func NewExternalgrpcServerApp(appServer *AutoScalerServerApp) (*externalgrpcServerApp, error)
- func StartServer(kubeClient types.ClientGenerator, c *types.Config)
- 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) GetOptions(ctx context.Context, request *apigrpc.GetOptionsRequest) (*apigrpc.GetOptionsReply, error)
- func (s *AutoScalerServerApp) GetResourceLimiter(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.ResourceLimiterReply, error)
- func (s *AutoScalerServerApp) HasInstance(ctx context.Context, request *apigrpc.HasInstanceRequest) (*apigrpc.HasInstanceReply, 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 AutoScalerServerNodeType
- type Controller
- type NodeGroupState
- type ServerNodeState
Constants ¶
const ( FailedEvent = "Failed" SuccessEvent = "Success" WarningEvent = "Warning" ErrorEvent = "Error" )
const ( // AutoScalerServerNodeStateNotCreated not created state AutoScalerServerNodeStateNotCreated = iota // AutoScalerServerNodeStateCreating running state AutoScalerServerNodeStateCreating // AutoScalerServerNodeStateRunning running state AutoScalerServerNodeStateRunning // AutoScalerServerNodeStateStopped stopped state AutoScalerServerNodeStateStopped // AutoScalerServerNodeStateDeleted deleted state AutoScalerServerNodeStateDeleted // AutoScalerServerNodeStateUndefined undefined state AutoScalerServerNodeStateUndefined )
const ( // AutoScalerServerNodeExternal is a node create out of autoscaler AutoScalerServerNodeExternal = iota // AutoScalerServerNodeAutoscaled is a node create by autoscaler AutoScalerServerNodeAutoscaled // AutoScalerServerNodeManaged is a node managed by controller AutoScalerServerNodeManaged )
const ( // NodegroupNotCreated not created state NodegroupNotCreated = iota // NodegroupCreated create state NodegroupCreated // NodegroupDeleting deleting status NodegroupDeleting // NodegroupDeleted deleted status NodegroupDeleted )
const ( ServerNodeStateNotRunning = iota ServerNodeStateDeleted ServerNodeStateCreating ServerNodeStateRunning )
Variables ¶
This section is empty.
Functions ¶
func CreateLabelOrAnnotation ¶ added in v1.21.8
func CreateLabelOrAnnotation(values []string) types.KubernetesLabel
func NewExternalgrpcServerApp ¶ added in v1.25.6
func NewExternalgrpcServerApp(appServer *AutoScalerServerApp) (*externalgrpcServerApp, error)
func StartServer ¶
func StartServer(kubeClient types.ClientGenerator, c *types.Config)
StartServer start the service
Types ¶
type AutoScalerServerApp ¶
type AutoScalerServerApp struct { apigrpc.UnimplementedCloudProviderServiceServer apigrpc.UnimplementedNodeGroupServiceServer apigrpc.UnimplementedPricingModelServiceServer ResourceLimiter *types.ResourceLimiter `json:"limits"` Groups map[string]*AutoScalerServerNodeGroup `json:"groups"` NodesDefinition []*apigrpc.NodeGroupDef `json:"nodedefs"` AutoProvision bool `json:"auto"` // contains filtered or unexported fields }
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 ¶ added in v0.2.0
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 ¶ added in v0.2.0
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) GetOptions ¶ added in v1.25.6
func (s *AutoScalerServerApp) GetOptions(ctx context.Context, request *apigrpc.GetOptionsRequest) (*apigrpc.GetOptionsReply, error)
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) HasInstance ¶ added in v1.26.0
func (s *AutoScalerServerApp) HasInstance(ctx context.Context, request *apigrpc.HasInstanceRequest) (*apigrpc.HasInstanceReply, error)
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 { NodeGroupID string `json:"group"` NodeName string `json:"name"` NodeIndex int `json:"index"` VMUUID string `json:"vm-uuid"` CRDUID uid.UID `json:"crd-uid"` Memory int `json:"memory"` CPU int `json:"cpu"` Disk int `json:"disk"` IPAddress string `json:"address"` State AutoScalerServerNodeState `json:"state"` NodeType AutoScalerServerNodeType `json:"type"` ControlPlaneNode bool `json:"control-plane,omitempty"` AllowDeployment bool `json:"allow-deployment,omitempty"` ExtraLabels types.KubernetesLabel `json:"labels,omitempty"` ExtraAnnotations types.KubernetesLabel `json:"annotations,omitempty"` VSphereConfig *vsphere.Configuration `json:"vmware"` // contains filtered or unexported fields }
AutoScalerServerNode Describe a AutoScaler VM
func (*AutoScalerServerNode) GetVSphere ¶ added in v1.20.5
func (vm *AutoScalerServerNode) GetVSphere() *vsphere.Configuration
GetVSphere method
type AutoScalerServerNodeGroup ¶
type AutoScalerServerNodeGroup struct { sync.Mutex NodeGroupIdentifier string `json:"identifier"` ServiceIdentifier string `json:"service"` ProvisionnedNodeNamePrefix string `default:"autoscaled" json:"node-name-prefix"` ManagedNodeNamePrefix string `default:"worker" json:"managed-name-prefix"` ControlPlaneNamePrefix string `default:"master" json:"controlplane-name-prefix"` Machine *types.MachineCharacteristic `json:"machine"` Status NodeGroupState `json:"status"` MinNodeSize int `json:"minSize"` MaxNodeSize int `json:"maxSize"` Nodes map[string]*AutoScalerServerNode `json:"nodes"` NodeLabels types.KubernetesLabel `json:"nodeLabels"` SystemLabels types.KubernetesLabel `json:"systemLabels"` AutoProvision bool `json:"auto-provision"` LastCreatedNodeIndex int `json:"node-index"` RunningNodes map[int]ServerNodeState `json:"running-nodes-state"` // 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>
func (*AutoScalerServerNodeGroup) AllNodes ¶ added in v1.25.6
func (g *AutoScalerServerNodeGroup) AllNodes() []*AutoScalerServerNode
func (*AutoScalerServerNodeGroup) GetOptions ¶ added in v1.25.6
func (g *AutoScalerServerNodeGroup) GetOptions(defaults *types.NodeGroupAutoscalingOptions) (*types.NodeGroupAutoscalingOptions, error)
type AutoScalerServerNodeState ¶
type AutoScalerServerNodeState int32
AutoScalerServerNodeState VM state
func (AutoScalerServerNodeState) String ¶
func (s AutoScalerServerNodeState) String() string
type AutoScalerServerNodeType ¶ added in v1.21.8
type AutoScalerServerNodeType int32
AutoScalerServerNodeType node class (external, autoscaled, managed)
type Controller ¶ added in v1.21.8
type Controller struct {
// contains filtered or unexported fields
}
Controller is the controller implementation for Foo resources
func NewController ¶ added in v1.21.8
func NewController(application applicationInterface, stopCh <-chan struct{}) (*Controller, error)
NewController returns a new sample controller
func (*Controller) CreateCRD ¶ added in v1.21.8
func (c *Controller) CreateCRD() error
func (*Controller) Run ¶ added in v1.21.8
func (c *Controller) Run() error
Run will set up the event handlers for types we are interested in, as well as syncing informer caches and starting workers. It will block until stopCh is closed, at which point it will shutdown the workqueue and wait for workers to finish processing their current work items.
type ServerNodeState ¶ added in v1.20.14
type ServerNodeState int