qingcloud

package
v1.4.19 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ListenerTimeoutMin = 10
	ListenerTimeoutMax = 86400
)
View Source
const (
	NodeAnnotationInstanceID = "node.beta.kubernetes.io/instance-id"

	//1. Configure Network
	ServiceAnnotationLoadBalancerNetworkType        = "service.beta.kubernetes.io/qingcloud-load-balancer-network-type"
	NetworkModePublic                        string = "public"
	NetworkModeInternal                             = "internal"

	//1.1 Configure EIP
	// ServiceAnnotationLoadBalancerEipIds is the annotation which specifies a list of eip ids.
	// The ids in list are separated by ',', e.g. "eip-j38f2h3h,eip-ornz2xq7". And this annotation should
	// NOT be used with ServiceAnnotationLoadBalancerVxnetId. Please make sure there is one and only one
	// of them being set
	ServiceAnnotationLoadBalancerEipIds    = "service.beta.kubernetes.io/qingcloud-load-balancer-eip-ids"
	ServiceAnnotationLoadBalancerEipSource = "service.beta.kubernetes.io/qingcloud-load-balancer-eip-source"
	ManualSet                              = "manual"
	UseAvailableOrAllocateOne              = "auto"
	UseAvailableOnly                       = "use-available"
	AllocateOnly                           = "allocate"

	ServiceAnnotationEipReplace = "service.beta.kubernetes.io/qingcloud-load-balancer-eip-replace"

	//1.2 Configure vxnet
	// ServiceAnnotationLoadBalancerVxnetId is the annotation which indicates the very vxnet where load
	// balancer resides. This annotation should NOT be used when ServiceAnnotationLoadBalancerEipIds is
	// set.
	ServiceAnnotationLoadBalancerVxnetID         = "service.beta.kubernetes.io/qingcloud-load-balancer-vxnet-id"
	ServiceAnnotationLoadBalancerInternalIP      = "service.beta.kubernetes.io/qingcloud-load-balancer-internal-ip"
	ServiceAnnotationLoadBalancerInternalReuseID = "service.beta.kubernetes.io/qingcloud-load-balancer-reuse-id"

	//2. Configure loadbalance
	//2.1 Configure loadbalance name
	// ServiceAnnotationLoadBalancerID is needed when user want to use exsiting lb
	ServiceAnnotationLoadBalancerID = "service.beta.kubernetes.io/qingcloud-load-balancer-id"
	// ServiceAnnotationLoadBalancerPolicy is usd to specify EIP use strategy
	// reuse represent the EIP can be shared with other service which has no port conflict
	// exclusive is the default value, means every service has its own EIP
	ServiceAnnotationLoadBalancerPolicy = "service.beta.kubernetes.io/qingcloud-load-balancer-eip-strategy"
	//ReuseExistingLB  use existing loadbalancer on the cloud
	ReuseExistingLB = "reuse-lb"
	// Exclusive is the default value, means every service has its own EIP
	Exclusive = "exclusive"
	// Shared represent the EIP can be shared with other service which has no port conflict
	Shared = "reuse"

	//2.2 Configure loadbalance attributes
	// ServiceAnnotationLoadBalancerType is the annotation used on the
	// service to indicate that we want a qingcloud loadBalancer type.
	// value "0" means the LB can max support 5000 concurrency connections, it's default type.
	// value "1" means the LB can max support 20000 concurrency connections.
	// value "2" means the LB can max support 40000 concurrency connections.
	// value "3" means the LB can max support 100000 concurrency connections.
	// value "4" means the LB can max support 200000 concurrency connections.
	// value "5" means the LB can max support 500000 concurrency connections.
	ServiceAnnotationLoadBalancerType = "service.beta.kubernetes.io/qingcloud-load-balancer-type"
	//LoadBalancer node number
	ServiceAnnotationLoadBalancerNodes = "service.beta.kubernetes.io/qingcloud-load-balancer-nodes"

	//4. Configure listener
	// tcp or http, such as "80:tcp,443:tcp"
	ServiceAnnotationListenerHealthyCheckMethod = "service.beta.kubernetes.io/qingcloud-lb-listener-healthycheckmethod"
	// inter | timeout | fall | rise , such as "80:10|5|2|5,443:10|5|2|5", default is "*:10|5|2|5"
	ServiceAnnotationListenerHealthyCheckOption = "service.beta.kubernetes.io/qingcloud-lb-listener-healthycheckoption"
	// roundrobin / leastconn / source
	ServiceAnnotationListenerBalanceMode = "service.beta.kubernetes.io/qingcloud-lb-listener-balancemode"
	// port:certificate, such as "6443:sc-77oko7zj,8443:sc-77oko7zj"
	ServiceAnnotationListenerServerCertificate = "service.beta.kubernetes.io/qingcloud-lb-listener-cert"
	// port:protocol, such as "443:https,80:http"
	ServiceAnnotationListenerProtocol = "service.beta.kubernetes.io/qingcloud-lb-listener-protocol"
	// port:timeout, such as "443:50", the value must in range 10 ~ 86400
	ServiceAnnotationListenerTimeout = "service.beta.kubernetes.io/qingcloud-lb-listener-timeout"

	// 5. Configure backend
	// backend label, such as "key1=value1,key2=value2"
	ServiceAnnotationBackendLabel = "service.beta.kubernetes.io/qingcloud-lb-backend-label"
	// backend count limit, if value is 0 or greater than cluster ready worker, will use default value : 1/3 of cluster ready worker
	ServiceAnnotationBackendCount = "service.beta.kubernetes.io/qingcloud-lb-backend-count"
)
View Source
const (
	ProviderName        = "qingcloud"
	QYConfigPath        = "/etc/qingcloud/config.yaml"
	DefaultBackendCount = 3
)

Variables

This section is empty.

Functions

func LBBackendName added in v1.4.6

func LBBackendName(config *LoadBalancerConfig, instance string) string

func NewQingCloud added in v1.4.6

func NewQingCloud(cfg io.Reader) (cloudprovider.Interface, error)

NewQingCloud returns a new instance of QingCloud cloud provider.

Types

type Config

type Config struct {
	Zone              string   `yaml:"zone"`
	DefaultVxNetForLB string   `yaml:"defaultVxNetForLB,omitempty"`
	ClusterID         string   `yaml:"clusterID"`
	IsApp             bool     `yaml:"isApp,omitempty"`
	TagIDs            []string `yaml:"tagIDs,omitempty"`
	InstanceIDs       []string `yaml:"instanceIDs,omitempty"`
}

type LoadBalancerConfig added in v1.4.6

type LoadBalancerConfig struct {
	//Network
	EipIDs     []*string
	EipSource  *string
	VxNetID    *string
	EipReplace bool

	//Attribute
	LoadBalancerType *int
	NodeCount        *int
	InternalIP       *string

	ServerCertificate *string
	Protocol          *string
	Timeout           *string

	//backend
	BackendLabel       string
	BackendCountConfig string
	BackendCountResult int

	//It's just for defining names, nothing more.
	NetworkType      string
	Policy           string
	InternalReuseID  *string
	ReuseLBID        string
	LoadBalancerName string

	InstanceIDs []*string
	// contains filtered or unexported fields
}

type QingCloud

type QingCloud struct {
	Config *Config
	Client executor.QingCloudClientInterface
	// contains filtered or unexported fields
}

QingCloud is the main entry of all interface

func (*QingCloud) Clusters

func (qc *QingCloud) Clusters() (cloudprovider.Clusters, bool)

func (*QingCloud) EnsureLoadBalancer

func (qc *QingCloud) EnsureLoadBalancer(ctx context.Context, _ string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)

EnsureLoadBalancer creates a new load balancer 'name', or updates the existing one. Returns the status of the balancer Implementations must treat the *v1.Service and *v1.Node parameters as read-only and not modify them. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager

func (*QingCloud) EnsureLoadBalancerDeleted

func (qc *QingCloud) EnsureLoadBalancerDeleted(ctx context.Context, _ string, service *v1.Service) error

EnsureLoadBalancerDeleted deletes the specified load balancer if it exists, returning nil if the load balancer specified either didn't exist or was successfully deleted. This construction is useful because many cloud providers' load balancers have multiple underlying components, meaning a Get could say that the LB doesn't exist even if some part of it is still laying around. Implementations must treat the *v1.Service parameter as read-only and not modify it. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager

func (*QingCloud) GetLoadBalancer

func (qc *QingCloud) GetLoadBalancer(ctx context.Context, _ string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)

GetLoadBalancer returns whether the specified load balancer exists, and if so, what its status is.

func (*QingCloud) GetLoadBalancerName

func (qc *QingCloud) GetLoadBalancerName(_ context.Context, _ string, service *v1.Service) string

GetLoadBalancerName returns the name of the load balancer. Implementations must treat the *v1.Service parameter as read-only and not modify it.

func (*QingCloud) HasClusterID

func (qc *QingCloud) HasClusterID() bool

func (*QingCloud) Initialize

func (qc *QingCloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{})

func (*QingCloud) Instances

func (qc *QingCloud) Instances() (cloudprovider.Instances, bool)

func (*QingCloud) InstancesV2 added in v1.4.8

func (qc *QingCloud) InstancesV2() (cloudprovider.InstancesV2, bool)

func (*QingCloud) LoadBalancer

func (qc *QingCloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)

LoadBalancer returns an implementation of LoadBalancer for QingCloud.

func (*QingCloud) ParseServiceLBConfig added in v1.4.6

func (qc *QingCloud) ParseServiceLBConfig(cluster string, service *v1.Service) (*LoadBalancerConfig, error)

func (*QingCloud) ProviderName

func (qc *QingCloud) ProviderName() string

func (*QingCloud) Routes

func (qc *QingCloud) Routes() (cloudprovider.Routes, bool)

func (*QingCloud) UpdateLoadBalancer

func (qc *QingCloud) UpdateLoadBalancer(ctx context.Context, _ string, service *v1.Service, nodes []*v1.Node) error

UpdateLoadBalancer updates hosts under the specified load balancer. Implementations must treat the *v1.Service and *v1.Node parameters as read-only and not modify them. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager

func (*QingCloud) Zones

func (qc *QingCloud) Zones() (cloudprovider.Zones, bool)

Jump to

Keyboard shortcuts

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