server

package
v1.17.5 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

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

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

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

func (*AutoScalerServerApp) Cleanup

Cleanup cleans up open resources before the cloud provider is destroyed, i.e. go routines etc.

func (*AutoScalerServerApp) Connect

Connect allows client to connect

func (*AutoScalerServerApp) Create

Create creates the node group on the cloud provider side. Implementation optional.

func (*AutoScalerServerApp) Debug

Debug returns a string containing all information regarding this node group.

func (*AutoScalerServerApp) 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. 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

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

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

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

GPULabel returns the label added to nodes with GPU resource.

func (*AutoScalerServerApp) GetAvailableGPUTypes

GetAvailableGPUTypes return all available GPU types cloud provider supports.

func (*AutoScalerServerApp) GetAvailableMachineTypes

GetAvailableMachineTypes get all machine types that can be requested from the cloud provider. Implementation optional.

func (*AutoScalerServerApp) GetResourceLimiter

GetResourceLimiter returns struct containing limits (max, min) for resources (cores, memory etc.).

func (*AutoScalerServerApp) Id

Id returns an unique identifier of the node group.

func (*AutoScalerServerApp) IncreaseSize

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

MaxSize returns maximum size of the node group.

func (*AutoScalerServerApp) MinSize

MinSize returns minimum size of the node group.

func (*AutoScalerServerApp) Name

Name returns name of the cloud provider.

func (*AutoScalerServerApp) NewNodeGroup

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

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

NodeGroups returns all node groups configured for this cloud provider.

func (*AutoScalerServerApp) NodePrice

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

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

PodPrice returns a theoretical minimum price of running a pod for a given period of time on a perfectly matching machine.

func (*AutoScalerServerApp) Pricing

Pricing returns pricing model for this cloud provider or error if not available. Implementation optional.

func (*AutoScalerServerApp) Refresh

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

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

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 KubernetesLabel

type KubernetesLabel map[string]string

KubernetesLabel labels

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
)

Jump to

Keyboard shortcuts

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