Documentation ¶
Index ¶
- Constants
- Variables
- func AddressCount(network *net.IPNet) uint64
- func AddressRange(network *net.IPNet) (net.IP, net.IP)
- func BuildVirturalGroupFromService(s *LoadBalancerClient, service *v1.Service, nodes []*v1.Node, lbsId string) error
- func Dec(IP net.IP) net.IP
- func Host(base *net.IPNet, num int) (net.IP, error)
- func Inc(IP net.IP) net.IP
- func NextSubnet(network *net.IPNet, prefixLen int) (*net.IPNet, bool)
- func NodeList(nodes []*v1.Node) []string
- func PreviousSubnet(network *net.IPNet, prefixLen int) (*net.IPNet, bool)
- func Subnet(base *net.IPNet, newBits int, num int) (*net.IPNet, error)
- func VerifyNoOverlap(subnets []*net.IPNet, CIDRBlock *net.IPNet) error
- type ClientMgr
- type Cloud
- func (c *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error
- func (bc *Cloud) Clusters() (cloudprovider.Clusters, bool)
- func (c *Cloud) CreateRoute(ctx context.Context, clusterName string, nameHint string, ...) error
- func (c *Cloud) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error)
- func (c *Cloud) DeleteRoute(ctx context.Context, clusterName string, route *cloudprovider.Route) error
- func (c *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)
- func (c *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error
- func (c *Cloud) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)
- func (c *Cloud) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string
- func (c *Cloud) GetZone(ctx context.Context) (cloudprovider.Zone, error)
- func (c *Cloud) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error)
- func (c *Cloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)
- func (bc *Cloud) HasClusterID() bool
- func (c *Cloud) Initialize(builder controller.ControllerClientBuilder)
- func (c *Cloud) InstanceExistsByProviderID(ctx context.Context, providerID string, ip string) (bool, error)
- func (c *Cloud) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error)
- func (c *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
- func (c *Cloud) InstanceType(ctx context.Context, name types.NodeName) (string, error)
- func (c *Cloud) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)
- func (c *Cloud) Instances() (cloudprovider.Instances, bool)
- func (bc *Cloud) ListClusters(ctx context.Context) ([]string, error)
- func (c *Cloud) ListRoutes(ctx context.Context, clusterName string) ([]*cloudprovider.Route, error)
- func (c *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
- func (bc *Cloud) Master(ctx context.Context, clusterName string) (string, error)
- func (c *Cloud) NodeAddresses(ctx context.Context, name types.NodeName) ([]v1.NodeAddress, error)
- func (c *Cloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)
- func (c *Cloud) ProviderName() string
- func (c *Cloud) Routes() (cloudprovider.Routes, bool)
- func (c *Cloud) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error
- func (c *Cloud) Zones() (cloudprovider.Zones, bool)
- type CloudConfig
- type InstanceClient
- type LoadBalancerClient
- type NodeAnnotation
- type ServiceAnnotation
- type VsgBackendServer
Constants ¶
const ( // ServiceAnnotationLoadBalancerPrefix is the annotation prefix of LoadBalancer ServiceAnnotationLoadBalancerPrefix = "service.beta.kubernetes.io/linkedcare-load-balancer-" ServiceAnnotationLoadBalancerId = ServiceAnnotationLoadBalancerPrefix + "id" )
const ( // NodeAnnotationPrefix is the annotation prefix of Node NodeAnnotationPrefix = "node.alpha.kubernetes.io/" // NodeAnnotationVpcId is the annotation of VpcId on node NodeAnnotationVpcId = NodeAnnotationPrefix + "vpc-id" // NodeAnnotationVpcRouteTableId is the annotation of VpcRouteTableId on node NodeAnnotationVpcRouteTableId = NodeAnnotationPrefix + "vpc-route-table-id" // NodeAnnotationVpcRouteRuleId is the annotation of VpcRouteRuleId on node NodeAnnotationVpcRouteRuleId = NodeAnnotationPrefix + "vpc-route-rule-id" // NodeAnnotationCCMVersion is the version of CCM NodeAnnotationCCMVersion = NodeAnnotationPrefix + "ccm-version" // NodeAnnotationAdvertiseRoute indicates whether to advertise route to vpc route table NodeAnnotationAdvertiseRoute = NodeAnnotationPrefix + "advertise-route" )
const ProviderName = "alicloud"
ProviderName is the name of this cloud provider.
Variables ¶
var ( // DEFAULT_BANDWIDTH default bandwidth DEFAULT_BANDWIDTH = 100 DEFAULT_NODE_MONITOR_PERIOD = 120 * time.Second DEFAULT_NODE_ADDR_SYNC_PERIOD = 240 * time.Second )
var CCMVersion string
CCMVersion is the version of CCM
var CLUSTER_ID = "clusterid"
CLUSTER_ID default cluster id if it is not specified.
var KUBERNETES_ALICLOUD_IDENTITY = fmt.Sprintf("Kubernetes.Alicloud/%s", version.Get().String())
KUBERNETES_ALICLOUD_IDENTITY is for statistic purpose.
Functions ¶
func AddressCount ¶
AddressCount returns the number of distinct host addresses within the given CIDR range.
Since the result is a uint64, this function returns meaningful information only for IPv4 ranges and IPv6 ranges with a prefix size of at least 65.
func AddressRange ¶
AddressRange returns the first and last addresses in the given CIDR range.
func Host ¶
Host takes a parent CIDR range and turns it into a host IP address with the given host number.
For example, 10.3.0.0/16 with a host number of 2 gives 10.3.0.2.
func NextSubnet ¶
NextSubnet returns the next available subnet of the desired mask size starting for the maximum IP of the offset subnet If the IP exceeds the maxium IP then the second return value is true
func PreviousSubnet ¶
PreviousSubnet returns the subnet of the desired mask in the IP space just lower than the start of IPNet provided. If the IP space rolls over then the second return value is true
Types ¶
type ClientMgr ¶
type ClientMgr struct {
// contains filtered or unexported fields
}
func NewClientMgr ¶
NewClientMgr return a new client manager
func (*ClientMgr) Instances ¶
func (mgr *ClientMgr) Instances() *InstanceClient
Instances return instance client
func (*ClientMgr) LoadBalancers ¶
func (mgr *ClientMgr) LoadBalancers() *LoadBalancerClient
LoadBalancers return loadbalancer client
type Cloud ¶
type Cloud struct {
// contains filtered or unexported fields
}
Cloud defines the main struct
func (*Cloud) AddSSHKeyToAllInstances ¶
func (*Cloud) Clusters ¶
func (bc *Cloud) Clusters() (cloudprovider.Clusters, bool)
Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise.
func (*Cloud) CreateRoute ¶
func (*Cloud) CurrentNodeName ¶
Doing
func (*Cloud) DeleteRoute ¶
func (*Cloud) EnsureLoadBalancer ¶
func (*Cloud) EnsureLoadBalancerDeleted ¶
func (*Cloud) GetLoadBalancer ¶
func (*Cloud) GetLoadBalancerName ¶
func (*Cloud) GetZoneByNodeName ¶
func (*Cloud) GetZoneByProviderID ¶
func (*Cloud) HasClusterID ¶
HasClusterID returns true if a ClusterID is required and set
func (*Cloud) Initialize ¶
func (c *Cloud) Initialize(builder controller.ControllerClientBuilder)
Initialize provides the cloud with a kubernetes client builder and may spawn goroutines to perform housekeeping activities within the cloud provider.
func (*Cloud) InstanceExistsByProviderID ¶
func (*Cloud) InstanceID ¶
func (*Cloud) InstanceShutdownByProviderID ¶
TODO
func (*Cloud) InstanceType ¶
func (*Cloud) InstanceTypeByProviderID ¶
func (*Cloud) ListClusters ¶
ListClusters lists the names of the available clusters.
func (*Cloud) ListRoutes ¶
func (*Cloud) LoadBalancer ¶
func (c *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
func (*Cloud) Master ¶
Master gets back the address (either DNS name or IP address) of the master node for the cluster.
func (*Cloud) NodeAddresses ¶
func (*Cloud) NodeAddressesByProviderID ¶
func (*Cloud) ProviderName ¶
func (*Cloud) Routes ¶
func (c *Cloud) Routes() (cloudprovider.Routes, bool)
****************routes******************
func (*Cloud) UpdateLoadBalancer ¶
type CloudConfig ¶
type CloudConfig struct { UID string `json:"uid"` ClusterID string `json:"ClusterId"` ClusterName string `json:"ClusterName"` AccessKeyID string `json:"AccessKeyID"` AccessKeySecret string `json:"AccessKeySecret"` Region string `json:"Region"` VpcID string `json:"VpcId"` SubnetID string `json:"SubnetId"` MasterID string `json:"MasterId"` Endpoint string `json:"Endpoint"` NodeIP string `json:"NodeIP"` Debug bool `json:"Debug"` }
CloudConfig is the cloud config
type InstanceClient ¶
type InstanceClient struct {
// contains filtered or unexported fields
}
type LoadBalancerClient ¶
type LoadBalancerClient struct {
// contains filtered or unexported fields
}
type NodeAnnotation ¶
type NodeAnnotation struct { VpcId string VpcRouteTableId string VpcRouteRuleId string CCMVersion string AdvertiseRoute bool }
NodeAnnotation contains annotations from node
func ExtractNodeAnnotation ¶
func ExtractNodeAnnotation(node *v1.Node) (*NodeAnnotation, error)
ExtractNodeAnnotation extract annotations from node
type ServiceAnnotation ¶
type ServiceAnnotation struct { /* BLB */ Loadbalancerid string }
ServiceAnnotation contains annotations from service
func ExtractServiceAnnotation ¶
func ExtractServiceAnnotation(service *v1.Service) (*ServiceAnnotation, error)
ExtractServiceAnnotation extract annotations from service