baiducloud

package
v0.0.0-...-386b7fa Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

README

Cluster Autoscaler on BaiduCloud

The cluster autoscaler on BaiduCloud scales worker nodes within any specified autoscaling group. It will run as a Deployment in your cluster. This README will go over some of the necessary steps required to get the cluster autoscaler up and running.

Kubernetes Version

Cluster autoscaler must run on v1.8.6 or greater.

Deployment Specification

1 ASG Setup (min: 1, max: 10, ASG Name: k8s-worker-asg-1)
kubectl apply -f examples/cluster-autoscaler-one-asg.yaml
Multiple ASG Setup

Multiple ASG Setup is not supported in BaiduCloud currently.

Common Notes and Gotchas:

  • By default, cluster autoscaler will not terminate nodes running pods in the kube-system namespace. You can override this default behaviour by passing in the --skip-nodes-with-system-pods=false flag.
  • By default, cluster autoscaler will wait 10 minutes between scale down operations, you can adjust this using the --scale-down-delay flag. E.g. --scale-down-delay=5m to decrease the scale down delay to 5 minutes.

Maintainer

Documentation

Index

Constants

View Source
const (
	// ProviderName is the cloud provider name for baiducloud
	ProviderName = "baiducloud"

	// GPULabel is the label added to nodes with GPU resource.
	GPULabel = "cloud.google.com/gke-accelerator"
)
View Source
const (

	// CceUserAgent is prefix of http header UserAgent
	CceUserAgent = "cce-k8s:"
)

Variables

This section is empty.

Functions

func BuildBaiducloud

BuildBaiducloud builds baiducloud cloud provider, manager etc.

func BuildBaiducloudCloudProvider

func BuildBaiducloudCloudProvider(manager *BaiducloudManager, discoveryOpts cloudprovider.NodeGroupDiscoveryOptions, resourceLimiter *cloudprovider.ResourceLimiter) (cloudprovider.CloudProvider, error)

BuildBaiducloudCloudProvider builds CloudProvider implementation for Baiducloud.

Types

type Asg

type Asg struct {
	BaiducloudRef
	// contains filtered or unexported fields
}

Asg implements NodeGroup interface.

func (*Asg) Autoprovisioned

func (asg *Asg) Autoprovisioned() bool

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 (*Asg) Create

func (asg *Asg) Create() (cloudprovider.NodeGroup, error)

Create creates the node group on the cloud provider side. Implementation optional.

func (*Asg) Debug

func (asg *Asg) Debug() string

Debug returns a string containing all information regarding this node group.

func (*Asg) DecreaseTargetSize

func (asg *Asg) DecreaseTargetSize(delta int) error

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 (*Asg) Delete

func (asg *Asg) Delete() error

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 (*Asg) DeleteNodes

func (asg *Asg) DeleteNodes(nodes []*apiv1.Node) error

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 (*Asg) Exist

func (asg *Asg) Exist() bool

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 (*Asg) Id

func (asg *Asg) Id() string

Id returns an unique identifier of the node group.

func (*Asg) IncreaseSize

func (asg *Asg) IncreaseSize(delta int) error

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 (*Asg) MaxSize

func (asg *Asg) MaxSize() int

MaxSize returns maximum size of the node group.

func (*Asg) MinSize

func (asg *Asg) MinSize() int

MinSize returns minimum size of the node group.

func (*Asg) Nodes

func (asg *Asg) Nodes() ([]cloudprovider.Instance, error)

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 (*Asg) TargetSize

func (asg *Asg) TargetSize() (int, error)

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 (*Asg) TemplateNodeInfo

func (asg *Asg) TemplateNodeInfo() (*schedulernodeinfo.NodeInfo, error)

TemplateNodeInfo returns a schedulernodeinfo.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 BaiducloudManager

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

BaiducloudManager is handles baiducloud communication and data caching.

func CreateBaiducloudManager

func CreateBaiducloudManager(configReader io.Reader) (*BaiducloudManager, error)

CreateBaiducloudManager constructs baiducloudManager object.

func (*BaiducloudManager) GetAsgForInstance

func (m *BaiducloudManager) GetAsgForInstance(instance *BaiducloudRef) (*Asg, error)

GetAsgForInstance returns AsgConfig of the given Instance

func (*BaiducloudManager) GetAsgNodes

func (m *BaiducloudManager) GetAsgNodes(asg *Asg) ([]string, error)

GetAsgNodes returns Asg nodes.

func (*BaiducloudManager) GetAsgSize

func (m *BaiducloudManager) GetAsgSize(asg *Asg) (int64, error)

GetAsgSize gets asg size.

func (*BaiducloudManager) RegisterAsg

func (m *BaiducloudManager) RegisterAsg(asg *Asg)

RegisterAsg registers asg in in Bce Manager

func (*BaiducloudManager) ScaleDownCluster

func (m *BaiducloudManager) ScaleDownCluster(instances []string) error

ScaleDownCluster gets Scale Set size.

func (*BaiducloudManager) ScaleUpCluster

func (m *BaiducloudManager) ScaleUpCluster(delta int) error

ScaleUpCluster Scale UP cluster

type BaiducloudRef

type BaiducloudRef struct {
	Name string
}

BaiducloudRef contains a reference to some entity in baiducloud world.

type CloudConfig

type CloudConfig struct {
	ClusterID       string `json:"ClusterId"`
	ClusterName     string `json:"ClusterName"`
	AccessKeyID     string `json:"AccessKeyID"`
	SecretAccessKey string `json:"SecretAccessKey"`
	Region          string `json:"Region"`
	VpcID           string `json:"VpcId"`
	MasterID        string `json:"MasterId"`
	Endpoint        string `json:"Endpoint"`
	NodeIP          string `json:"NodeIP"`
	Debug           bool   `json:"Debug"`
}

CloudConfig cloud config file for baiducloud

Directories

Path Synopsis
baiducloud-sdk-go
bcc
bce
Package bce defined a set of core data structure and functions for Baidu Cloud API.
Package bce defined a set of core data structure and functions for Baidu Cloud API.
blb
cce
eip
util
Package util implements a set of util functions.
Package util implements a set of util functions.
vpc

Jump to

Keyboard shortcuts

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