types

package
v1.27.3 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxGracePeriod    time.Duration = 120 * time.Second
	DefaultMaxRequestTimeout time.Duration = 120 * time.Second
	DefaultMaxDeletionPeriod time.Duration = 300 * time.Second
	DefaultNodeReadyTimeout  time.Duration = 300 * time.Second
)
View Source
const (
	ManagedNodeMinMemory   = 2 * 1024
	ManagedNodeMaxMemory   = 128 * 1024
	ManagedNodeMinCores    = 2
	ManagedNodeMaxCores    = 32
	ManagedNodeMinDiskSize = 10
	ManagedNodeMaxDiskSize = 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoScalerServerConfig

type AutoScalerServerConfig struct {
	UseExternalEtdc            *bool                             `json:"use-external-etcd"`
	UseK3S                     *bool                             `json:"use-k3s"`
	UseVanillaGrpcProvider     *bool                             `json:"use-vanilla-grpc"`
	UseControllerManager       *bool                             `json:"use-controller-manager"`
	ExtDestinationEtcdSslDir   string                            `default:"/etc/etcd/ssl" json:"dst-etcd-ssl-dir"`
	ExtSourceEtcdSslDir        string                            `default:"/etc/etcd/ssl" json:"src-etcd-ssl-dir"`
	KubernetesPKISourceDir     string                            `default:"/etc/kubernetes/pki" json:"kubernetes-pki-srcdir"`
	KubernetesPKIDestDir       string                            `default:"/etc/kubernetes/pki" json:"kubernetes-pki-dstdir"`
	Network                    string                            `default:"tcp" json:"network"`                     // Mandatory, Network to listen (see grpc doc) to listen
	Listen                     string                            `default:"0.0.0.0:5200" json:"listen"`             // Mandatory, Address to listen
	CertPrivateKey             string                            `json:"cert-private-key,omitempty"`                // Optional to secure grcp channel
	CertPublicKey              string                            `json:"cert-public-key,omitempty"`                 // Optional to secure grcp channel
	CertCA                     string                            `json:"cert-ca,omitempty"`                         // Optional to secure grcp channel
	ServiceIdentifier          string                            `json:"secret"`                                    // Mandatory, secret Identifier, client must match this
	MinNode                    int                               `json:"minNode"`                                   // Mandatory, Min AutoScaler VM
	MaxNode                    int                               `json:"maxNode"`                                   // Mandatory, Max AutoScaler VM
	MaxPods                    int                               `json:"maxPods"`                                   // Mandatory, Max kubelet pods
	MaxCreatedNodePerCycle     int                               `json:"maxNode-per-cycle" default:"2"`             // Optional, the max number VM to create in //
	ProvisionnedNodeNamePrefix string                            `default:"autoscaled" json:"node-name-prefix"`     // Optional, the created node name prefix
	ManagedNodeNamePrefix      string                            `default:"worker" json:"managed-name-prefix"`      // Optional, the created node name prefix
	ControlPlaneNamePrefix     string                            `default:"master" json:"controlplane-name-prefix"` // Optional, the created node name prefix
	NodePrice                  float64                           `json:"nodePrice"`                                 // Optional, The VM price
	PodPrice                   float64                           `json:"podPrice"`                                  // Optional, The pod price
	KubeAdm                    KubeJoinConfig                    `json:"kubeadm"`
	K3S                        K3SJoinConfig                     `json:"k3s"`
	DefaultMachineType         string                            `default:"standard" json:"default-machine"`
	NodeLabels                 KubernetesLabel                   `json:"nodeLabels"`
	Machines                   map[string]*MachineCharacteristic `default:"{\"standard\": {}}" json:"machines"` // Mandatory, Available machines
	Optionals                  *AutoScalerServerOptionals        `json:"optionals"`
	ManagedNodeResourceLimiter *ResourceLimiter                  `json:"managednodes-limits"`
	SSH                        *AutoScalerServerSSH              `json:"ssh-infos"`
	AutoScalingOptions         *NodeGroupAutoscalingOptions      `json:"autoscaling-options,omitempty"`
	CloudProvider              string                            `json:"cloud-provider"`
	AwsInfos                   map[string]*aws.Configuration     `json:"aws"`
	DebugMode                  *bool                             `json:"debug,omitempty"`
}

AutoScalerServerConfig is contains configuration

func (*AutoScalerServerConfig) GetAwsConfiguration

func (conf *AutoScalerServerConfig) GetAwsConfiguration(name string) *aws.Configuration

GetAwsConfiguration returns the aws named conf or default

type AutoScalerServerOptionals

type AutoScalerServerOptionals struct {
	Pricing                  bool `json:"pricing"`
	GetAvailableMachineTypes bool `json:"getAvailableMachineTypes"`
	NewNodeGroup             bool `json:"newNodeGroup"`
	TemplateNodeInfo         bool `json:"templateNodeInfo"`
	Create                   bool `json:"create"`
	Delete                   bool `json:"delete"`
}

AutoScalerServerOptionals declare wich features must be optional

type AutoScalerServerSSH

type AutoScalerServerSSH struct {
	UserName              string `json:"user"`
	Password              string `json:"password"`
	AuthKeys              string `json:"ssh-private-key"`
	WaitSshReadyInSeconds int    `default:"180" json:"wait-ssh-ready-seconds"`
	TestMode              bool   `json:"-"`
}

AutoScalerServerSSH contains ssh client infos

func (*AutoScalerServerSSH) GetAuthKeys

func (ssh *AutoScalerServerSSH) GetAuthKeys() string

GetAuthKeys returns the path to key file, subsistute ~

func (*AutoScalerServerSSH) GetUserName

func (ssh *AutoScalerServerSSH) GetUserName() string

GetUserName returns user name from config or the real current username is empty or equal to ~

type ClientGenerator added in v1.20.5

type ClientGenerator interface {
	KubeClient() (kubernetes.Interface, error)
	NodeManagerClient() (clientset.Interface, error)
	ApiExtentionClient() (apiextension.Interface, error)

	PodList(nodeName string, podFilter PodFilterFunc) ([]apiv1.Pod, error)
	NodeList() (*apiv1.NodeList, error)
	GetNode(nodeName string) (*apiv1.Node, error)
	SetProviderID(nodeName, providerID string) error
	UncordonNode(nodeName string) error
	CordonNode(nodeName string) error
	MarkDrainNode(nodeName string) error
	DrainNode(nodeName string, ignoreDaemonSet, deleteLocalData bool) error
	DeleteNode(nodeName string) error
	AnnoteNode(nodeName string, annotations map[string]string) error
	LabelNode(nodeName string, labels map[string]string) error
	TaintNode(nodeName string, taints ...apiv1.Taint) error
	WaitNodeToBeReady(nodeName string) error
}

ClientGenerator provides clients

type Config added in v1.20.5

type Config struct {
	APIServerURL             string
	KubeConfig               string
	ExtDestinationEtcdSslDir string
	ExtSourceEtcdSslDir      string
	KubernetesPKISourceDir   string
	KubernetesPKIDestDir     string
	UseExternalEtdc          bool
	UseK3S                   bool
	UseVanillaGrpcProvider   bool
	UseControllerManager     bool
	RequestTimeout           time.Duration
	DeletionTimeout          time.Duration
	MaxGracePeriod           time.Duration
	NodeReadyTimeout         time.Duration
	Config                   string
	SaveLocation             string
	DisplayVersion           bool
	DebugMode                bool
	LogFormat                string
	LogLevel                 string
	MinCpus                  int64
	MinMemory                int64
	MaxCpus                  int64
	MaxMemory                int64
	ManagedNodeMinDiskSize   int64
	ManagedNodeMaxDiskSize   int64
	ManagedNodeDiskType      string
}

func NewConfig added in v1.20.5

func NewConfig() *Config

NewConfig returns new Config object

func (*Config) GetManagedNodeResourceLimiter added in v1.20.15

func (c *Config) GetManagedNodeResourceLimiter() *ResourceLimiter

func (*Config) GetResourceLimiter added in v1.20.5

func (c *Config) GetResourceLimiter() *ResourceLimiter

func (*Config) ParseFlags added in v1.20.5

func (cfg *Config) ParseFlags(args []string, version string) error

func (*Config) String added in v1.20.5

func (cfg *Config) String() string

type K3SJoinConfig added in v1.25.7

type K3SJoinConfig struct {
	ExtraCommands     []string `json:"extras-commands,omitempty"`
	DatastoreEndpoint string   `json:"datastore-endpoint,omitempty"`
}

type KubeJoinConfig

type KubeJoinConfig struct {
	Address        string   `json:"address,omitempty"`
	Token          string   `json:"token,omitempty"`
	CACert         string   `json:"ca,omitempty"`
	ExtraArguments []string `json:"extras-args,omitempty"`
}

KubeJoinConfig give element to join kube master

type KubernetesLabel added in v1.24.9

type KubernetesLabel map[string]string

KubernetesLabel labels

type MachineCharacteristic

type MachineCharacteristic struct {
	Price    float64 `json:"price"`                  // VM price in USD
	Memory   int     `json:"memsize"`                // VM Memory size in megabytes
	Vcpu     int     `json:"vcpus"`                  // VM number of cpus
	DiskType string  `default:"gp2" json:"diskType"` // VM disk size type gp2, gp3.....
	DiskSize int     `json:"diskSize"`               // VM disk size in megabytes
}

MachineCharacteristic defines VM kind

type NodeGroupAutoscalingOptions added in v1.25.6

type NodeGroupAutoscalingOptions struct {
	// ScaleDownUtilizationThreshold sets threshold for nodes to be considered for scale down
	// if cpu or memory utilization is over threshold.
	ScaleDownUtilizationThreshold float64 `json:"scaleDownUtilizationThreshold,omitempty"`

	// ScaleDownGpuUtilizationThreshold sets threshold for gpu nodes to be
	// considered for scale down if gpu utilization is over threshold.
	ScaleDownGpuUtilizationThreshold float64 `json:"scaleDownGpuUtilizationThreshold,omitempty"`

	// ScaleDownUnneededTime sets the duration CA expects a node to be
	// unneeded/eligible for removal before scaling down the node.
	ScaleDownUnneededTime time.Duration `json:"scaleDownUnneededTime,omitempty"`

	// ScaleDownUnreadyTime represents how long an unready node should be
	// unneeded before it is eligible for scale down.
	ScaleDownUnreadyTime time.Duration `json:"scaleDownUnreadyTime,omitempty"`
}

type PodFilterFunc added in v1.20.5

type PodFilterFunc func(p apiv1.Pod) (bool, error)

A PodFilterFunc returns true if the supplied pod passes the filter.

type ResourceLimiter

type ResourceLimiter struct {
	MinLimits map[string]int64 `json:"min"`
	MaxLimits map[string]int64 `json:"max"`
}

ResourceLimiter define limit, not really used

func (*ResourceLimiter) GetMaxValue added in v1.20.15

func (limits *ResourceLimiter) GetMaxValue(key string, defaultValue int) int

func (*ResourceLimiter) GetMaxValue64 added in v1.20.15

func (limits *ResourceLimiter) GetMaxValue64(key string, defaultValue int64) int64

func (*ResourceLimiter) GetMinValue added in v1.20.15

func (limits *ResourceLimiter) GetMinValue(key string, defaultValue int) int

func (*ResourceLimiter) GetMinValue64 added in v1.20.15

func (limits *ResourceLimiter) GetMinValue64(key string, defaultValue int64) int64

func (*ResourceLimiter) MergeRequestResourceLimiter added in v1.20.15

func (limits *ResourceLimiter) MergeRequestResourceLimiter(limiter *apigrpc.ResourceLimiter)

func (*ResourceLimiter) SetMaxValue added in v1.20.15

func (limits *ResourceLimiter) SetMaxValue(key string, value int)

func (*ResourceLimiter) SetMaxValue64 added in v1.20.15

func (limits *ResourceLimiter) SetMaxValue64(key string, value int64)

func (*ResourceLimiter) SetMinValue added in v1.20.15

func (limits *ResourceLimiter) SetMinValue(key string, value int)

func (*ResourceLimiter) SetMinValue64 added in v1.20.15

func (limits *ResourceLimiter) SetMinValue64(key string, value int64)

Jump to

Keyboard shortcuts

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