server

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 52 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

	// AutoScalerServerNodeStateCreating running state
	AutoScalerServerNodeStateCreating

	// AutoScalerServerNodeStateRunning running state
	AutoScalerServerNodeStateRunning

	// AutoScalerServerNodeStateStopped stopped state
	AutoScalerServerNodeStateStopped

	// AutoScalerServerNodeStateDeleted deleted state
	AutoScalerServerNodeStateDeleted

	// AutoScalerServerNodeStateDeleting deleting state
	AutoScalerServerNodeStateDeleting

	// 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

	// NodegroupCreating creating state
	NodegroupCreating

	// NodegroupCreated create state
	NodegroupCreated

	// NodegroupDeleting deleting status
	NodegroupDeleting

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

Variables

This section is empty.

Functions

func CreateLabelOrAnnotation

func CreateLabelOrAnnotation(values []string) types.KubernetesLabel

func NewExternalgrpcServerApp

func NewExternalgrpcServerApp(appServer *AutoScalerServerApp) (*externalgrpcServerApp, error)

func NewGrpcServerApp

func NewGrpcServerApp(appServer *AutoScalerServerApp) (*grpcServerApp, error)

func StartServer

func StartServer(kubeClient client.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) Load

func (s *AutoScalerServerApp) Load(fileName string) error

Load saved state from file

func (*AutoScalerServerApp) Save

func (s *AutoScalerServerApp) Save(fileName string) error

Save state to file

type AutoScalerServerNode

type AutoScalerServerNode struct {
	NodeGroup        string                    `json:"group"`
	NodeName         string                    `json:"node-name"`
	NodeIndex        int                       `json:"index"`
	InstanceName     string                    `json:"instance-name"`
	VMUUID           string                    `json:"vm-uuid"`
	CRDUID           uid.UID                   `json:"crd-uid"`
	Memory           int                       `json:"memory"`
	CPU              int                       `json:"cpu"`
	DiskSize         int                       `json:"diskSize"`
	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"`
	CloudInit        cloudinit.CloudInit       `json:"cloud-init,omitempty"`
	MaxPods          int                       `json:"max-pods,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) WaitForIP

func (vm *AutoScalerServerNode) WaitForIP() (string, error)

func (*AutoScalerServerNode) WaitSSHReady

func (vm *AutoScalerServerNode) WaitSSHReady(nodename, address string) error

WaitSSHReady 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"`
	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 NewAutoScalerServerNodeGroup

func NewAutoScalerServerNodeGroup(s *nodegroupCreateInput) (nodeGroup *AutoScalerServerNodeGroup)

func (*AutoScalerServerNodeGroup) AllNodes

func (*AutoScalerServerNodeGroup) GetOptions

func (*AutoScalerServerNodeGroup) Machine

type AutoScalerServerNodeState

type AutoScalerServerNodeState int32

AutoScalerServerNodeState VM state

func (AutoScalerServerNodeState) String

func (s AutoScalerServerNodeState) String() string

type AutoScalerServerNodeType

type AutoScalerServerNodeType int32

AutoScalerServerNodeType node class (external, autoscaled, managed)

type Controller

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

Controller is the controller implementation for Foo resources

func NewController

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

NewController returns a new sample controller

func (*Controller) CreateCRD

func (c *Controller) CreateCRD() error

func (*Controller) Run

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 NodeGroupState

type NodeGroupState int32

NodeGroupState describe the nodegroup status

type ServerNodeState

type ServerNodeState int

Jump to

Keyboard shortcuts

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