types

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 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
)
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"`
	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
	ProviderID                 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"`
	DefaultMachineType         string                            `default:"standard" json:"default-machine"`
	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"`
	CloudProvider              string                            `json:"cloud-provider"`
	AwsInfos                   map[string]*aws.Configuration     `json:"aws"`
}

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"`
}

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, timeToWaitInSeconds int) 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
	RequestTimeout           time.Duration
	DeletionTimeout          time.Duration
	MaxGracePeriod           time.Duration
	Config                   string
	SaveLocation             string
	DisplayVersion           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 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 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 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