Documentation ¶
Index ¶
- Constants
- Variables
- func GetDeletedSvcKeeper() *deletedSVCKeeper
- type AnnotationRequest
- type ClientMgr
- type Cloud
- func (c *Cloud) AddSSHKeyToAllInstances(user string, keyData []byte) error
- func (c *Cloud) Clusters() (cloudprovider.Clusters, bool)
- func (c *Cloud) CreateRoute(clusterName string, nameHint string, route *cloudprovider.Route) error
- func (c *Cloud) CurrentNodeName(hostname string) (types.NodeName, error)
- func (c *Cloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error
- func (c *Cloud) EnsureLoadBalancer(clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)
- func (c *Cloud) EnsureLoadBalancerDeleted(clusterName string, service *v1.Service) error
- func (c *Cloud) ExternalID(nodeName types.NodeName) (string, error)
- func (c *Cloud) GetLoadBalancer(clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)
- func (c *Cloud) GetZone() (cloudprovider.Zone, error)
- func (c *Cloud) GetZoneByNodeName(nodeName types.NodeName) (cloudprovider.Zone, error)
- func (c *Cloud) GetZoneByProviderID(providerID string) (cloudprovider.Zone, error)
- func (c *Cloud) HasClusterID() bool
- func (c *Cloud) Initialize(clientBuilder controller.ControllerClientBuilder)
- func (c *Cloud) InstanceExistsByProviderID(providerID string) (bool, error)
- func (c *Cloud) InstanceID(nodeName types.NodeName) (string, error)
- func (c *Cloud) InstanceType(name types.NodeName) (string, error)
- func (c *Cloud) InstanceTypeByProviderID(providerID string) (string, error)
- func (c *Cloud) Instances() (cloudprovider.Instances, bool)
- func (c *Cloud) ListClusters() ([]string, error)
- func (c *Cloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)
- func (c *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
- func (c *Cloud) Master(clusterName string) (string, error)
- func (c *Cloud) NodeAddresses(name types.NodeName) ([]v1.NodeAddress, error)
- func (c *Cloud) NodeAddressesByProviderID(providerID string) ([]v1.NodeAddress, error)
- func (c *Cloud) ProviderName() string
- func (c *Cloud) Routes() (cloudprovider.Routes, bool)
- func (c *Cloud) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)
- func (c *Cloud) UpdateLoadBalancer(clusterName string, service *v1.Service, nodes []*v1.Node) error
- func (c *Cloud) Zones() (cloudprovider.Zones, bool)
- type CloudConfig
- type InstancerClient
- type LoadBalancerClient
- func (s *LoadBalancerClient) EnsureBackendServer(service *v1.Service, nodes []*v1.Node, lb *slb.LoadBalancerType) (*slb.LoadBalancerType, error)
- func (s *LoadBalancerClient) EnsureHealthCheck(service *v1.Service, old *PortListener, new *PortListener) (*slb.LoadBalancerType, error)
- func (s *LoadBalancerClient) EnsureLoadBalanceDeleted(service *v1.Service) error
- func (s *LoadBalancerClient) EnsureLoadBalancer(service *v1.Service, nodes []*v1.Node, vswitchid string) (*slb.LoadBalancerType, error)
- func (s *LoadBalancerClient) EnsureLoadBalancerListener(service *v1.Service, lb *slb.LoadBalancerType) (*slb.LoadBalancerType, error)
- func (s *LoadBalancerClient) EnsureSVCNotDeleted(service *v1.Service) error
- func (s *LoadBalancerClient) SaveDeletedSVCResourceVersion(service *v1.Service) error
- func (s *LoadBalancerClient) UpdateLoadBalancer(service *v1.Service, nodes []*v1.Node) error
- type PortListener
- type RoutesClient
- func (r *RoutesClient) CreateRoute(route *cloudprovider.Route, region common.Region, vpcid string) error
- func (r *RoutesClient) DeleteRoute(route *cloudprovider.Route, region common.Region, vpcid string) error
- func (r *RoutesClient) ListRoutes(region common.Region, vpcs []string) ([]*cloudprovider.Route, error)
- type TokenAuth
Constants ¶
const ( ServiceAnnotationLoadBalancerPrefix = "service.beta.kubernetes.io/alicloud-loadbalancer-" ServiceAnnotationLoadBalancerProtocolPort = ServiceAnnotationLoadBalancerPrefix + "protocol-port" ServiceAnnotationLoadBalancerAddressType = ServiceAnnotationLoadBalancerPrefix + "address-type" ServiceAnnotationLoadBalancerSLBNetworkType = ServiceAnnotationLoadBalancerPrefix + "slb-network-type" ServiceAnnotationLoadBalancerChargeType = ServiceAnnotationLoadBalancerPrefix + "charge-type" ServiceAnnotationLoadBalancerId = ServiceAnnotationLoadBalancerPrefix + "id" ServiceAnnotationLoadBalancerBackendLabel = ServiceAnnotationLoadBalancerPrefix + "backend-label" ServiceAnnotationLoadBalancerRegion = ServiceAnnotationLoadBalancerPrefix + "region" ServiceAnnotationLoadBalancerBandwidth = ServiceAnnotationLoadBalancerPrefix + "bandwidth" ServiceAnnotationLoadBalancerCertID = ServiceAnnotationLoadBalancerPrefix + "cert-id" ServiceAnnotationLoadBalancerHealthCheckFlag = ServiceAnnotationLoadBalancerPrefix + "health-check-flag" ServiceAnnotationLoadBalancerHealthCheckType = ServiceAnnotationLoadBalancerPrefix + "health-check-type" ServiceAnnotationLoadBalancerHealthCheckURI = ServiceAnnotationLoadBalancerPrefix + "health-check-uri" ServiceAnnotationLoadBalancerHealthCheckConnectPort = ServiceAnnotationLoadBalancerPrefix + "health-check-connect-port" ServiceAnnotationLoadBalancerHealthCheckHealthyThreshold = ServiceAnnotationLoadBalancerPrefix + "healthy-threshold" ServiceAnnotationLoadBalancerHealthCheckUnhealthyThreshold = ServiceAnnotationLoadBalancerPrefix + "unhealthy-threshold" ServiceAnnotationLoadBalancerHealthCheckInterval = ServiceAnnotationLoadBalancerPrefix + "health-check-interval" ServiceAnnotationLoadBalancerHealthCheckConnectTimeout = ServiceAnnotationLoadBalancerPrefix + "health-check-connect-timeout" ServiceAnnotationLoadBalancerHealthCheckTimeout = ServiceAnnotationLoadBalancerPrefix + "health-check-timeout" MagicHealthCheckConnectPort = -520 MAX_LOADBALANCER_BACKEND = 20 )
const DEFAULT_SERVER_WEIGHT = 100
const ProviderName = "alicloud"
ProviderName is the name of this cloud provider.
Variables ¶
var ( DEFAULT_CHARGE_TYPE = common.PayByTraffic DEFAULT_BANDWIDTH = 50 DEFAULT_ADDRESS_TYPE = slb.InternetAddressType // DEFAULT_REGION should be override in cloud initialize. DEFAULT_REGION = common.Hangzhou )
var KUBERNETES_ALICLOUD_IDENTITY = fmt.Sprintf("Kubernetes.Alicloud/%s", version.Get().String())
This is for statistic purpose.
var ROLE_NAME = "KubernetesMasterRole"
var TOKEN_RESYNC_PERIOD = 5 * time.Minute
Functions ¶
func GetDeletedSvcKeeper ¶ added in v1.8.4
func GetDeletedSvcKeeper() *deletedSVCKeeper
Types ¶
type AnnotationRequest ¶
type AnnotationRequest struct { Loadbalancerid string BackendLabel string SSLPorts string AddressType slb.AddressType SLBNetworkType string ChargeType slb.InternetChargeType Region common.Region Bandwidth int CertID string HealthCheck slb.FlagType HealthCheckURI string HealthCheckConnectPort int HealthyThreshold int UnhealthyThreshold int HealthCheckInterval int HealthCheckConnectTimeout int // for tcp HealthCheckType slb.HealthCheckType // for tcp, Type could be http tcp HealthCheckTimeout int // for https and http }
func ExtractAnnotationRequest ¶
func ExtractAnnotationRequest(service *v1.Service) *AnnotationRequest
type ClientMgr ¶ added in v1.8.4
type ClientMgr struct {
// contains filtered or unexported fields
}
func NewClientMgr ¶ added in v1.8.4
func (*ClientMgr) Instances ¶ added in v1.8.4
func (c *ClientMgr) Instances(region common.Region) *InstancerClient
func (*ClientMgr) LoadBalancers ¶ added in v1.8.4
func (c *ClientMgr) LoadBalancers(region common.Region) *LoadBalancerClient
type Cloud ¶
type Cloud struct {
// contains filtered or unexported fields
}
Cloud is an implementation of Interface, LoadBalancer and Instances for Alicloud Services.
func (*Cloud) AddSSHKeyToAllInstances ¶
AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances expected format for the key is standard ssh-keygen format: <protocol> <blob>
func (*Cloud) Clusters ¶
func (c *Cloud) Clusters() (cloudprovider.Clusters, bool)
Clusters returns the list of clusters.
func (*Cloud) CreateRoute ¶
CreateRoute creates the described managed route route.Name will be ignored, although the cloud-provider may use nameHint to create a more user-meaningful name.
func (*Cloud) CurrentNodeName ¶
CurrentNodeName returns the name of the node we are currently running on On most clouds (e.g. GCE) this is the hostname, so we provide the hostname
func (*Cloud) DeleteRoute ¶
func (c *Cloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error
DeleteRoute deletes the specified managed route Route should be as returned by ListRoutes
func (*Cloud) EnsureLoadBalancer ¶
func (c *Cloud) EnsureLoadBalancer(clusterName 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 (*Cloud) EnsureLoadBalancerDeleted ¶
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 (*Cloud) ExternalID ¶
ExternalID returns the cloud provider ID of the node with the specified NodeName. Note that if the instance does not exist or is no longer running, we must return ("", cloudprovider.InstanceNotFound)
func (*Cloud) GetLoadBalancer ¶
func (c *Cloud) GetLoadBalancer(clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)
TODO: Break this up into different interfaces (LB, etc) when we have more than one type of service GetLoadBalancer returns whether the specified load balancer exists, and if so, what its status is. 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 (*Cloud) GetZone ¶
func (c *Cloud) GetZone() (cloudprovider.Zone, error)
GetZone returns the Zone containing the current failure zone and locality region that the program is running in
func (*Cloud) GetZoneByNodeName ¶ added in v1.8.4
GetZoneByNodeName returns the Zone containing the current zone and locality region of the node specified by node name This method is particularly used in the context of external cloud providers where node initialization must be down outside the kubelets.
func (*Cloud) GetZoneByProviderID ¶ added in v1.8.4
func (c *Cloud) GetZoneByProviderID(providerID string) (cloudprovider.Zone, error)
GetZoneByProviderID returns the Zone containing the current zone and locality region of the node specified by providerId This method is particularly used in the context of external cloud providers where node initialization must be down outside the kubelets.
func (*Cloud) HasClusterID ¶ added in v1.8.4
HasClusterID returns true if a ClusterID is required and set
func (*Cloud) Initialize ¶
func (c *Cloud) Initialize(clientBuilder controller.ControllerClientBuilder)
Initialize passes a Kubernetes clientBuilder interface to the cloud provider
func (*Cloud) InstanceExistsByProviderID ¶ added in v1.8.4
InstanceExistsByProviderID returns true if the instance for the given provider id still is running. If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
func (*Cloud) InstanceID ¶
InstanceID returns the cloud provider ID of the node with the specified NodeName.
func (*Cloud) InstanceType ¶
InstanceType returns the type of the specified instance.
func (*Cloud) InstanceTypeByProviderID ¶
InstanceTypeByProviderID returns the cloudprovider instance type of the node with the specified unique providerID This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here
func (*Cloud) Instances ¶
func (c *Cloud) Instances() (cloudprovider.Instances, bool)
Instances returns an implementation of Instances for Alicloud Services.
func (*Cloud) ListClusters ¶
ListClusters lists the names of the available clusters.
func (*Cloud) ListRoutes ¶
func (c *Cloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)
ListRoutes lists all managed routes that belong to the specified clusterName
func (*Cloud) LoadBalancer ¶
func (c *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
LoadBalancer returns an implementation of LoadBalancer for Alicloud Services.
func (*Cloud) Master ¶
Master gets back the address (either DNS name or IP address) of the master node for the cluster.
func (*Cloud) NodeAddresses ¶
NodeAddresses returns the addresses of the specified instance. TODO(roberthbailey): This currently is only used in such a way that it returns the address of the calling instance. We should do a rename to make this clearer.
func (*Cloud) NodeAddressesByProviderID ¶
func (c *Cloud) NodeAddressesByProviderID(providerID string) ([]v1.NodeAddress, error)
NodeAddressesByProviderID returns the node addresses of an instances with the specified unique providerID This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here
func (*Cloud) ProviderName ¶
ProviderName returns the cloud provider ID.
func (*Cloud) Routes ¶
func (c *Cloud) Routes() (cloudprovider.Routes, bool)
Routes returns an implementation of Routes for Alicloud Services.
func (*Cloud) UpdateLoadBalancer ¶
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
type CloudConfig ¶
type CloudConfig struct { Global struct { KubernetesClusterTag string AccessKeyID string `json:"accessKeyID"` AccessKeySecret string `json:"accessKeySecret"` Region string `json:"region"` } }
CloudConfig wraps the settings for the Alicloud provider.
type InstancerClient ¶ added in v1.8.4
type InstancerClient struct { CurrentNodeName types.NodeName // contains filtered or unexported fields }
func (*InstancerClient) Regions ¶ added in v1.8.4
func (s *InstancerClient) Regions() map[string][]string
func (*InstancerClient) Update ¶ added in v1.8.4
func (s *InstancerClient) Update(client *ecs.Client)
type LoadBalancerClient ¶ added in v1.8.4
type LoadBalancerClient struct {
// contains filtered or unexported fields
}
func (*LoadBalancerClient) EnsureBackendServer ¶ added in v1.8.4
func (s *LoadBalancerClient) EnsureBackendServer(service *v1.Service, nodes []*v1.Node, lb *slb.LoadBalancerType) (*slb.LoadBalancerType, error)
func (*LoadBalancerClient) EnsureHealthCheck ¶ added in v1.8.4
func (s *LoadBalancerClient) EnsureHealthCheck(service *v1.Service, old *PortListener, new *PortListener) (*slb.LoadBalancerType, error)
func (*LoadBalancerClient) EnsureLoadBalanceDeleted ¶ added in v1.8.4
func (s *LoadBalancerClient) EnsureLoadBalanceDeleted(service *v1.Service) error
func (*LoadBalancerClient) EnsureLoadBalancer ¶ added in v1.8.4
func (s *LoadBalancerClient) EnsureLoadBalancer(service *v1.Service, nodes []*v1.Node, vswitchid string) (*slb.LoadBalancerType, error)
func (*LoadBalancerClient) EnsureLoadBalancerListener ¶ added in v1.8.4
func (s *LoadBalancerClient) EnsureLoadBalancerListener(service *v1.Service, lb *slb.LoadBalancerType) (*slb.LoadBalancerType, error)
func (*LoadBalancerClient) EnsureSVCNotDeleted ¶ added in v1.8.4
func (s *LoadBalancerClient) EnsureSVCNotDeleted(service *v1.Service) error
ensure service resource version properly and update last known resource version to the largest one, for now only keep create and delete behavior
func (*LoadBalancerClient) SaveDeletedSVCResourceVersion ¶ added in v1.8.4
func (s *LoadBalancerClient) SaveDeletedSVCResourceVersion(service *v1.Service) error
save the deleted service's uid
func (*LoadBalancerClient) UpdateLoadBalancer ¶ added in v1.8.4
type PortListener ¶
type PortListener struct { Port int NodePort int Protocol string Bandwidth int Scheduler slb.SchedulerType StickySession slb.FlagType CertID string HealthCheck slb.FlagType HealthCheckType slb.HealthCheckType HealthCheckURI string HealthCheckConnectPort int HealthyThreshold int UnhealthyThreshold int HealthCheckInterval int HealthCheckConnectTimeout int // for tcp HealthCheckTimeout int // for https and http }
type RoutesClient ¶ added in v1.8.4
type RoutesClient struct {
// contains filtered or unexported fields
}
func (*RoutesClient) CreateRoute ¶ added in v1.8.4
func (r *RoutesClient) CreateRoute(route *cloudprovider.Route, region common.Region, vpcid string) error
CreateRoute creates the described managed route route.Name will be ignored, although the cloud-provider may use nameHint to create a more user-meaningful name.
func (*RoutesClient) DeleteRoute ¶ added in v1.8.4
func (r *RoutesClient) DeleteRoute(route *cloudprovider.Route, region common.Region, vpcid string) error
DeleteRoute deletes the specified managed route Route should be as returned by ListRoutes
func (*RoutesClient) ListRoutes ¶ added in v1.8.4
func (r *RoutesClient) ListRoutes(region common.Region, vpcs []string) ([]*cloudprovider.Route, error)
ListRoutes lists all managed routes that belong to the specified clusterName