types

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 17 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
	DefaultMinNodes                        = 0
	DefaultMaxNodes                        = 24
	DefaultMaxPods                         = 110
	DefaultMinCpus                         = 2
	DefaultMaxCpus                         = 24
	DefaultMinMemoryInMB                   = 1024
	DefaultMaxMemoryInMB                   = 24 * 1024
)
View Source
const (
	ManagedNodeMinMemory   = 2 * 1024
	ManagedNodeMaxMemory   = 128 * 1024
	ManagedNodeMinCores    = 2
	ManagedNodeMaxCores    = 32
	ManagedNodeMinDiskSize = 10 * 1024
	ManagedNodeMaxDiskSize = 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoScalerServerConfig

type AutoScalerServerConfig struct {
	Distribution                  *string                        `default:"kubeadm" json:"distribution"`
	Plateform                     *string                        `default:"vsphere" json:"plateform"`
	MachineConfig                 *string                        `json:"machines"`
	ImageCredentialProviderConfig *string                        `json:"image-credential-provider-config"`
	ImageCredentialProviderBinDir *string                        `json:"image-credential-provider-bin-dir"`
	UseExternalEtdc               *bool                          `json:"use-external-etcd"`
	UseEtcHosts                   *bool                          `json:"use-etc-hosts"`
	UseCloudInitConfig            *bool                          `json:"use-cloudinit-config"`
	CloudInitFileOwner            *string                        `json:"cloudinit-file-owner"`
	CloudInitFileMode             *uint                          `json:"cloudinit-file-mode"`
	CloudProvider                 *string                        `json:"cloud-provider"`
	GrpcProvider                  *string                        `json:"grpc-provider"`
	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"`
	Listen                        *string                        `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
	NodeGroup                     *string                        `json:"nodegroup"`                                 // Mandatory, the nodegroup
	MinNode                       *int64                         `json:"minNode"`                                   // Mandatory, Min AutoScaler VM
	MaxNode                       *int64                         `json:"maxNode"`                                   // Mandatory, Max AutoScaler VM
	MaxPods                       *int64                         `json:"maxPods"`                                   // Mandatory, Max pod per node
	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                       *kubernetes.KubeJoinConfig     `json:"kubeadm"`
	K3S                           *kubernetes.K3SJoinConfig      `json:"k3s,omitempty"`
	RKE2                          *kubernetes.RKE2JoinConfig     `json:"rke2,omitempty"`
	MicroK8S                      *kubernetes.MicroK8SJoinConfig `json:"microk8s,omitempty"`
	External                      *kubernetes.ExternalJoinConfig `json:"external,omitempty"`
	DefaultMachineType            string                         `default:"standard" json:"default-machine"`
	NodeLabels                    KubernetesLabel                `json:"nodeLabels"`
	CloudInit                     cloudinit.CloudInit            `json:"cloud-init"` // Optional, The cloud init conf file
	Optionals                     *AutoScalerServerOptionals     `json:"optionals"`
	ManagedNodeResourceLimiter    *ResourceLimiter               `json:"managednodes-limits"`
	SSH                           *sshutils.AutoScalerServerSSH  `json:"ssh-infos"`
	AutoScalingOptions            *NodeGroupAutoscalingOptions   `json:"autoscaling-options,omitempty"`
	DebugMode                     *bool                          `json:"debug,omitempty"`
	AllowUpgrade                  *bool                          `json:"allow-upgrade,omitempty"`
	CredentialProviderConfig      any                            `json:"credential-provider-config,omitempty"`
	// contains filtered or unexported fields
}

AutoScalerServerConfig is contains configuration

func (*AutoScalerServerConfig) DisableCloudController

func (conf *AutoScalerServerConfig) DisableCloudController() bool

func (*AutoScalerServerConfig) GetAutoScalingOptions

func (conf *AutoScalerServerConfig) GetAutoScalingOptions() (*apigrpc.AutoscalingOptions, error)

func (*AutoScalerServerConfig) GetCloudConfiguration

func (conf *AutoScalerServerConfig) GetCloudConfiguration() providers.ProviderConfiguration

func (*AutoScalerServerConfig) GetCloudInitFileMode

func (conf *AutoScalerServerConfig) GetCloudInitFileMode() uint

func (*AutoScalerServerConfig) GetCloudInitFileOwner

func (conf *AutoScalerServerConfig) GetCloudInitFileOwner() string

func (*AutoScalerServerConfig) GetCloudProviderName

func (conf *AutoScalerServerConfig) GetCloudProviderName() string

func (*AutoScalerServerConfig) GetCredentialProviderConfig

func (conf *AutoScalerServerConfig) GetCredentialProviderConfig() any

func (*AutoScalerServerConfig) GetExtDestinationEtcdSslDir

func (conf *AutoScalerServerConfig) GetExtDestinationEtcdSslDir() string

func (*AutoScalerServerConfig) GetExtSourceEtcdSslDir

func (conf *AutoScalerServerConfig) GetExtSourceEtcdSslDir() string

func (*AutoScalerServerConfig) GetExternalConfig

func (conf *AutoScalerServerConfig) GetExternalConfig() *kubernetes.ExternalJoinConfig

func (*AutoScalerServerConfig) GetImageCredentialProviderBinDir

func (conf *AutoScalerServerConfig) GetImageCredentialProviderBinDir() string

func (*AutoScalerServerConfig) GetImageCredentialProviderConfig

func (conf *AutoScalerServerConfig) GetImageCredentialProviderConfig() string

func (*AutoScalerServerConfig) GetK3SJoinConfig

func (conf *AutoScalerServerConfig) GetK3SJoinConfig() *kubernetes.K3SJoinConfig

func (*AutoScalerServerConfig) GetKubeAdmConfig

func (conf *AutoScalerServerConfig) GetKubeAdmConfig() *kubernetes.KubeJoinConfig

func (*AutoScalerServerConfig) GetKubernetesPKIDestDir

func (conf *AutoScalerServerConfig) GetKubernetesPKIDestDir() string

func (*AutoScalerServerConfig) GetKubernetesPKISourceDir

func (conf *AutoScalerServerConfig) GetKubernetesPKISourceDir() string

func (*AutoScalerServerConfig) GetMicroK8SConfig

func (conf *AutoScalerServerConfig) GetMicroK8SConfig() *kubernetes.MicroK8SJoinConfig

func (*AutoScalerServerConfig) GetRKE2Config

func (conf *AutoScalerServerConfig) GetRKE2Config() *kubernetes.RKE2JoinConfig

func (*AutoScalerServerConfig) GetSSHConfig

func (conf *AutoScalerServerConfig) GetSSHConfig() *sshutils.AutoScalerServerSSH

func (*AutoScalerServerConfig) KubernetesDistribution

func (conf *AutoScalerServerConfig) KubernetesDistribution() string

func (*AutoScalerServerConfig) SetupCloudConfiguration

func (conf *AutoScalerServerConfig) SetupCloudConfiguration(configFile string) error

SetupCloudConfiguration returns the cloud configuration

func (*AutoScalerServerConfig) UseCloudInitToConfigure

func (conf *AutoScalerServerConfig) UseCloudInitToConfigure() bool

func (*AutoScalerServerConfig) UseControllerManager

func (conf *AutoScalerServerConfig) UseControllerManager() bool

func (*AutoScalerServerConfig) UseEtcHostsToConfigure

func (conf *AutoScalerServerConfig) UseEtcHostsToConfigure() bool

func (*AutoScalerServerConfig) UseExternalEtdcServer

func (conf *AutoScalerServerConfig) UseExternalEtdcServer() bool

func (*AutoScalerServerConfig) UseImageCredentialProviderConfig

func (conf *AutoScalerServerConfig) UseImageCredentialProviderConfig() bool

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 Config

type Config struct {
	APIServerURL                  string
	KubeConfig                    string
	ProviderConfig                string
	MachineConfig                 string
	Listen                        string
	ExtDestinationEtcdSslDir      string
	ExtSourceEtcdSslDir           string
	KubernetesPKISourceDir        string
	KubernetesPKIDestDir          string
	Distribution                  string
	UseExternalEtdc               bool
	UseEtcHosts                   bool
	UseCloudInitConfig            bool
	CloudInitFileOwner            string
	CloudInitFileMode             int
	GrpcProvider                  string
	CloudProvider                 string
	Nodegroup                     string
	RequestTimeout                time.Duration
	DeletionTimeout               time.Duration
	MaxGracePeriod                time.Duration
	NodeReadyTimeout              time.Duration
	Plateform                     string
	Config                        string
	SaveLocation                  string
	DisplayVersion                bool
	DebugMode                     bool
	AllowUpgrade                  bool
	LogFormat                     string
	LogLevel                      string
	MinNode                       int64
	MaxNode                       int64
	MaxPods                       int64
	MinCpus                       int64
	MinMemory                     int64
	MaxCpus                       int64
	MaxMemory                     int64
	ManagedNodeMinCpus            int64
	ManagedNodeMinMemory          int64
	ManagedNodeMaxCpus            int64
	ManagedNodeMaxMemory          int64
	ManagedNodeMinDiskSize        int64
	ManagedNodeMaxDiskSize        int64
	ImageCredentialProviderConfig string
	ImageCredentialProviderBinDir string
}

func NewConfig

func NewConfig() *Config

NewConfig returns new Config object

func (*Config) GetAPIServerURL

func (c *Config) GetAPIServerURL() string

func (*Config) GetDeletionTimeout

func (c *Config) GetDeletionTimeout() time.Duration

func (*Config) GetKubeConfig

func (c *Config) GetKubeConfig() string

func (*Config) GetManagedNodeResourceLimiter

func (c *Config) GetManagedNodeResourceLimiter() *ResourceLimiter

func (*Config) GetMaxGracePeriod

func (c *Config) GetMaxGracePeriod() time.Duration

func (*Config) GetNodeReadyTimeout

func (c *Config) GetNodeReadyTimeout() time.Duration

func (*Config) GetRequestTimeout

func (c *Config) GetRequestTimeout() time.Duration

func (*Config) GetResourceLimiter

func (c *Config) GetResourceLimiter() *ResourceLimiter

func (*Config) ParseFlags

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

func (*Config) String

func (cfg *Config) String() string

type KubernetesLabel

type KubernetesLabel map[string]string

KubernetesLabel labels

func MergeKubernetesLabel

func MergeKubernetesLabel(labels ...KubernetesLabel) KubernetesLabel

MergeKubernetesLabel merge kubernetes map in one

type NodeGroupAutoscalingOptions

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

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

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

	// ScaleDownUnreadyTime represents how long an unready node should be
	// unneeded before it is eligible for scale down.
	ScaleDownUnreadyTime string `default:"1m" json:"scaleDownUnreadyTime,omitempty"`

	MaxNodeProvisionTime string `default:"15m" json:"maxNodeProvisionTime,omitempty"`

	// ZeroOrMaxNodeScaling means that a node group should be scaled up to maximum size or down to zero nodes all at once instead of one-by-one.
	ZeroOrMaxNodeScaling bool `json:"zeroOrMaxNodeScaling,omitempty"`

	// IgnoreDaemonSetsUtilization sets if daemonsets utilization should be considered during node scale-down
	IgnoreDaemonSetsUtilization bool `json:"ignoreDaemonSetsUtilization,omitempty"`
}

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

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

func (*ResourceLimiter) GetMaxValue64

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

func (*ResourceLimiter) GetMinValue

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

func (*ResourceLimiter) GetMinValue64

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

func (*ResourceLimiter) MergeRequestResourceLimiter

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

func (*ResourceLimiter) SetMaxValue

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

func (*ResourceLimiter) SetMaxValue64

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

func (*ResourceLimiter) SetMinValue

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

func (*ResourceLimiter) SetMinValue64

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