server

package
v1.24.5 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FailedEvent  = "Failed"
	SuccessEvent = "Success"
	WarningEvent = "Warning"
	ErrorEvent   = "Error"
)
View Source
const (
	// AutoScalerServerNodeStateNotCreated not created state
	AutoScalerServerNodeStateNotCreated = iota

	// AutoScalerServerNodeStateRunning running state
	AutoScalerServerNodeStateRunning

	// AutoScalerServerNodeStateStopped stopped state
	AutoScalerServerNodeStateStopped

	// AutoScalerServerNodeStateDeleted deleted state
	AutoScalerServerNodeStateDeleted

	// AutoScalerServerNodeStateUndefined undefined state
	AutoScalerServerNodeStateUndefined
)
View Source
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
)
View Source
const (
	// NodegroupNotCreated not created state
	NodegroupNotCreated = iota

	// NodegroupCreated create state
	NodegroupCreated

	// NodegroupDeleting deleting status
	NodegroupDeleting

	// NodegroupDeleted deleted status
	NodegroupDeleted
)
View Source
const (
	ServerNodeStateNotRunning = iota
	ServerNodeStateDeleted
	ServerNodeStateCreating
	ServerNodeStateRunning
)

Variables

This section is empty.

Functions

func StartServer

func StartServer(kubeClient types.ClientGenerator, c *types.Config)

StartServer start the service

Types

type AutoScalerServerApp

type AutoScalerServerApp struct {
	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

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"`
	InstanceName     string                    `json:"instance-name"`
	NodeName         string                    `json:"node-name"`
	NodeIndex        int                       `json:"index"`
	UID              uid.UID                   `json:"crd-uid"`
	Memory           int                       `json:"memory"`
	CPU              int                       `json:"cpu"`
	DiskSize         int                       `json:"diskSize"`
	DiskType         string                    `default:"standard" json:"diskType"`
	InstanceType     string                    `json:"instance-Type"`
	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      KubernetesLabel           `json:"labels,omitempty"`
	ExtraAnnotations KubernetesLabel           `json:"annotations,omitempty"`
	// contains filtered or unexported fields
}

AutoScalerServerNode Describe a AutoScaler VM Node name and instance name could be differ when using AWS cloud provider

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"`
	ProvisionnedNodeNamePrefix string                           `default:"autoscaled" json:"node-name-prefix"`
	ManagedNodeNamePrefix      string                           `default:"worker" json:"managed-name-prefix"`
	ControlPlaneNamePrefix     string                           `default:"master" json:"controlplane-name-prefix"`
	InstanceType               string                           `json:"instance-type"`
	DiskType                   string                           `default:"gp2" json:"diskType"`
	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"`
	RunningNodes               map[int]ServerNodeState          `json:"running-nodes"`
	// 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

func (AutoScalerServerNodeState) String

func (s AutoScalerServerNodeState) String() string

type AutoScalerServerNodeType added in v1.20.15

type AutoScalerServerNodeType int32

AutoScalerServerNodeType node class (external, autoscaled, managed)

type Controller added in v1.20.15

type Controller struct {
	// contains filtered or unexported fields
}

Controller is the controller implementation for Foo resources

func NewController added in v1.20.15

func NewController(application applicationInterface, stopCh <-chan struct{}) (*Controller, error)

NewController returns a new sample controller

func (*Controller) CreateCRD added in v1.20.15

func (c *Controller) CreateCRD() error

func (*Controller) Run added in v1.20.15

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 KubernetesLabel

type KubernetesLabel map[string]string

KubernetesLabel labels

func CreateLabelOrAnnotation added in v1.20.15

func CreateLabelOrAnnotation(values []string) KubernetesLabel

type NodeGroupState

type NodeGroupState int32

NodeGroupState describe the nodegroup status

type ServerNodeState added in v1.20.14

type ServerNodeState int

Jump to

Keyboard shortcuts

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