Documentation ¶
Index ¶
- Constants
- Variables
- func BatchProcess(list []slb.VBackendServerType, batch func(list []slb.VBackendServerType) error) error
- func CleanUPVGroupDirect(local *vgroups) error
- func CleanUPVGroupMerged(service *v1.Service, lb *slb.LoadBalancerType, client ClientSLBSDK, ...) error
- func Contains(list []int, x int) bool
- func EnsureListeners(client ClientSLBSDK, service *v1.Service, lb *slb.LoadBalancerType, ...) error
- func EnsureListenersDeleted(client ClientSLBSDK, service *v1.Service, lb *slb.LoadBalancerType, ...) error
- func ExtractAnnotationRequest(service *v1.Service) (*AnnotationRequest, *AnnotationRequest)
- func GetLocalService() *localService
- func GetPrivateZoneRecordCache() *kvstore
- func NodeList(nodes []*v1.Node) []string
- func PrettyJson(obj interface{}) string
- func Protocol(annotation string, port v1.ServicePort) (string, error)
- func URIfromService(svc *v1.Service) string
- func WaitCreate(rc *RoutesClient, tableid string, route *ecs.CreateRouteEntryArgs) error
- func WaitDelete(rc *RoutesClient, tableid string, route *ecs.DeleteRouteEntryArgs) error
- func WaitForRouteEntryAvailable(client RouteSDK, routeid, tableid string) error
- type AnnotationRequest
- type ClientInstanceSDK
- type ClientMgr
- type ClientPVTZSDK
- type ClientSLBSDK
- 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, tableid string, ...) error
- func (c *Cloud) CurrentNodeName(hostname string) (types.NodeName, error)
- func (c *Cloud) DeleteRoute(clusterName string, tableid 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(builder ctrlclient.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, tableid 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) RouteTables(clusterName string) ([]string, error)
- 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 IListener
- type IMetaData
- type InstanceClient
- type Listener
- type Listeners
- type LoadBalancerClient
- 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) UpdateDefaultServerGroup(nodes []*v1.Node, lb *slb.LoadBalancerType) error
- func (s *LoadBalancerClient) UpdateLoadBalancer(service *v1.Service, nodes []*v1.Node, withVgroup bool) error
- type NamedKey
- type PrivateZoneClient
- type RouteSDK
- type RoutesClient
- func (r *RoutesClient) CreateRoute(tabid string, route *cloudprovider.Route, region common.Region, vpcid string) error
- func (r *RoutesClient) DeleteRoute(tabid string, route *cloudprovider.Route, region common.Region, vpcid string) error
- func (r *RoutesClient) Error(e error) string
- func (r *RoutesClient) ListRoutes(tableid string) ([]*cloudprovider.Route, error)
- func (r *RoutesClient) RouteTables() ([]string, error)
- func (r *RoutesClient) WithVPC(vpcid string, tableids string) error
- type TokenAuth
Constants ¶
const ( // ServiceAnnotationPrefix prefix of service annotation ServiceAnnotationPrefix = "service.beta.kubernetes.io/alibaba-cloud-" // ServiceAnnotationLegacyPrefix legacy prefix of service annotation ServiceAnnotationLegacyPrefix = "service.beta.kubernetes.io/alicloud-" // ServiceAnnotationLoadBalancerPrefix loadbalancer prefix ServiceAnnotationLoadBalancerPrefix = ServiceAnnotationPrefix + "loadbalancer-" // ServiceAnnotationPrivateZonePrefix private zone prefix ServiceAnnotationPrivateZonePrefix = ServiceAnnotationPrefix + "private-zone-" // ServiceAnnotationLoadBalancerProtocolPort protocol port ServiceAnnotationLoadBalancerProtocolPort = ServiceAnnotationLoadBalancerPrefix + "protocol-port" // ServiceAnnotationLoadBalancerAddressType loadbalancer address type ServiceAnnotationLoadBalancerAddressType = ServiceAnnotationLoadBalancerPrefix + "address-type" // ServiceAnnotationLoadBalancerSLBNetworkType loadbalancer network type ServiceAnnotationLoadBalancerSLBNetworkType = ServiceAnnotationLoadBalancerPrefix + "slb-network-type" // ServiceAnnotationLoadBalancerChargeType lb charge type ServiceAnnotationLoadBalancerChargeType = ServiceAnnotationLoadBalancerPrefix + "charge-type" // ServiceAnnotationLoadBalancerId lb id ServiceAnnotationLoadBalancerId = ServiceAnnotationLoadBalancerPrefix + "id" // ServiceAnnotationLoadBalancerBackendLabel backend labels ServiceAnnotationLoadBalancerBackendLabel = ServiceAnnotationLoadBalancerPrefix + "backend-label" // ServiceAnnotationLoadBalancerRegion region ServiceAnnotationLoadBalancerRegion = ServiceAnnotationLoadBalancerPrefix + "region" // ServiceAnnotationLoadBalancerMasterZoneID master zone id ServiceAnnotationLoadBalancerMasterZoneID = ServiceAnnotationLoadBalancerPrefix + "master-zoneid" // ServiceAnnotationLoadBalancerSlaveZoneID slave zone id ServiceAnnotationLoadBalancerSlaveZoneID = ServiceAnnotationLoadBalancerPrefix + "slave-zoneid" // ServiceAnnotationLoadBalancerBandwidth bandwidth ServiceAnnotationLoadBalancerBandwidth = ServiceAnnotationLoadBalancerPrefix + "bandwidth" // ServiceAnnotationLoadBalancerCertID cert id ServiceAnnotationLoadBalancerCertID = ServiceAnnotationLoadBalancerPrefix + "cert-id" // ServiceAnnotationLoadBalancerHealthCheckFlag health check flag ServiceAnnotationLoadBalancerHealthCheckFlag = ServiceAnnotationLoadBalancerPrefix + "health-check-flag" // ServiceAnnotationLoadBalancerHealthCheckType health check type ServiceAnnotationLoadBalancerHealthCheckType = ServiceAnnotationLoadBalancerPrefix + "health-check-type" // ServiceAnnotationLoadBalancerHealthCheckURI health check uri ServiceAnnotationLoadBalancerHealthCheckURI = ServiceAnnotationLoadBalancerPrefix + "health-check-uri" // ServiceAnnotationLoadBalancerHealthCheckConnectPort health check connect port ServiceAnnotationLoadBalancerHealthCheckConnectPort = ServiceAnnotationLoadBalancerPrefix + "health-check-connect-port" // ServiceAnnotationLoadBalancerHealthCheckHealthyThreshold health check healthy thresh hold ServiceAnnotationLoadBalancerHealthCheckHealthyThreshold = ServiceAnnotationLoadBalancerPrefix + "healthy-threshold" // ServiceAnnotationLoadBalancerHealthCheckUnhealthyThreshold health check unhealthy thresh hold ServiceAnnotationLoadBalancerHealthCheckUnhealthyThreshold = ServiceAnnotationLoadBalancerPrefix + "unhealthy-threshold" // ServiceAnnotationLoadBalancerHealthCheckInterval health check interval ServiceAnnotationLoadBalancerHealthCheckInterval = ServiceAnnotationLoadBalancerPrefix + "health-check-interval" // ServiceAnnotationLoadBalancerHealthCheckConnectTimeout health check connect timeout ServiceAnnotationLoadBalancerHealthCheckConnectTimeout = ServiceAnnotationLoadBalancerPrefix + "health-check-connect-timeout" // ServiceAnnotationLoadBalancerHealthCheckTimeout health check timeout ServiceAnnotationLoadBalancerHealthCheckTimeout = ServiceAnnotationLoadBalancerPrefix + "health-check-timeout" // ServiceAnnotationLoadBalancerHealthCheckDomain health check domain ServiceAnnotationLoadBalancerHealthCheckDomain = ServiceAnnotationLoadBalancerPrefix + "health-check-domain" // ServiceAnnotationLoadBalancerHealthCheckHTTPCode health check http code ServiceAnnotationLoadBalancerHealthCheckHTTPCode = ServiceAnnotationLoadBalancerPrefix + "health-check-httpcode" // ServiceAnnotationLoadBalancerAdditionalTags For example: "Key1=Val1,Key2=Val2,KeyNoVal1=,KeyNoVal2",same with aws ServiceAnnotationLoadBalancerAdditionalTags = ServiceAnnotationLoadBalancerPrefix + "additional-resource-tags" // ServiceAnnotationLoadBalancerOverrideListener force override listeners ServiceAnnotationLoadBalancerOverrideListener = ServiceAnnotationLoadBalancerPrefix + "force-override-listeners" // ServiceAnnotationLoadBalancerSpec slb spec ServiceAnnotationLoadBalancerSpec = ServiceAnnotationLoadBalancerPrefix + "spec" // ServiceAnnotationLoadBalancerSessionStick sticky session ServiceAnnotationLoadBalancerSessionStick = ServiceAnnotationLoadBalancerPrefix + "sticky-session" // ServiceAnnotationLoadBalancerSessionStickType session sticky type ServiceAnnotationLoadBalancerSessionStickType = ServiceAnnotationLoadBalancerPrefix + "sticky-session-type" // ServiceAnnotationLoadBalancerCookieTimeout cookie timeout ServiceAnnotationLoadBalancerCookieTimeout = ServiceAnnotationLoadBalancerPrefix + "cookie-timeout" //ServiceAnnotationLoadBalancerCookie lb cookie ServiceAnnotationLoadBalancerCookie = ServiceAnnotationLoadBalancerPrefix + "cookie" // ServiceAnnotationLoadBalancerPersistenceTimeout persistence timeout ServiceAnnotationLoadBalancerPersistenceTimeout = ServiceAnnotationLoadBalancerPrefix + "persistence-timeout" //ServiceAnnotationLoadBalancerIPVersion ip version ServiceAnnotationLoadBalancerIPVersion = ServiceAnnotationLoadBalancerPrefix + "ip-version" // MAX_LOADBALANCER_BACKEND max default lb backend count. MAX_LOADBALANCER_BACKEND = 18 // ServiceAnnotationLoadBalancerPrivateZoneName private zone name ServiceAnnotationLoadBalancerPrivateZoneName = ServiceAnnotationPrivateZonePrefix + "name" // ServiceAnnotationLoadBalancerPrivateZoneId private zone id ServiceAnnotationLoadBalancerPrivateZoneId = ServiceAnnotationPrivateZonePrefix + "id" // ServiceAnnotationLoadBalancerPrivateZoneRecordName private zone record name ServiceAnnotationLoadBalancerPrivateZoneRecordName = ServiceAnnotationPrivateZonePrefix + "record-name" // ServiceAnnotationLoadBalancerPrivateZoneRecordTTL private zone record ttl ServiceAnnotationLoadBalancerPrivateZoneRecordTTL = ServiceAnnotationPrivateZonePrefix + "record-ttl" )
const DEFAULT_LANG = "en"
DEFAULT_LANG default lang
const DEFAULT_SERVER_WEIGHT = 100
DEFAULT_SERVER_WEIGHT default server weight
const MAX_BACKEND_NUM = 19
MAX_BACKEND_NUM max batch backend num
const ProviderName = "alicloud"
ProviderName is the name of this cloud provider.
const TAGKEY = "kubernetes.do.not.delete"
TAGKEY Default tag key.
Variables ¶
var ( // DEFAULT_CHARGE_TYPE default charge type DEFAULT_CHARGE_TYPE = common.PayByTraffic // DEFAULT_BANDWIDTH default bandwidth DEFAULT_BANDWIDTH = 100 // DEFAULT_ADDRESS_TYPE default address type DEFAULT_ADDRESS_TYPE = slb.InternetAddressType // DEFAULT_REGION should be override in cloud initialize. DEFAULT_REGION = common.Hangzhou )
var ( // ACTION_ADD actions add ACTION_ADD = "ADD" // ACTION_UPDATE update ACTION_UPDATE = "UPDATE" // ACTION_DELETE delete ACTION_DELETE = "DELETE" )
var ASSUME_ROLE_NAME = "AliyunCSManagedKubernetesRole"
ASSUME_ROLE_NAME managed kubernetes role name
var CLUSTER_ID = "clusterid"
CLUSTER_ID default cluster id if it is not specified.
var DEFAULT_LISTENER_BANDWIDTH = -1
DEFAULT_LISTENER_BANDWIDTH default listener bandwidth
var DEFAULT_PREFIX = "k8s"
DEFAULT_PREFIX default prefix for listener
var FORMAT_ERROR = "ListenerName Format Error: k8s/${port}/${service}/${namespace}/${clusterid} format is expected"
FORMAT_ERROR format error message
var KUBERNETES_ALICLOUD_IDENTITY = fmt.Sprintf("Kubernetes.Alicloud/%s", version.Get().String())
KUBERNETES_ALICLOUD_IDENTITY is for statistic purpose.
var ROLE_NAME = "KubernetesMasterRole"
ROLE_NAME default kubernetes master role name
var STRINGS_EMPTY = ""
STRINGS_EMPTY empty string
var TOKEN_RESYNC_PERIOD = 5 * time.Minute
TOKEN_RESYNC_PERIOD default token sync period
Functions ¶
func BatchProcess ¶
func BatchProcess(list []slb.VBackendServerType, batch func(list []slb.VBackendServerType) error) error
BatchProcess batch update backend.
func CleanUPVGroupDirect ¶
func CleanUPVGroupDirect(local *vgroups) error
CleanUPVGroupDirect do clean vserver group
func CleanUPVGroupMerged ¶
func CleanUPVGroupMerged(service *v1.Service, lb *slb.LoadBalancerType, client ClientSLBSDK, local *vgroups) error
CleanUPVGroupMerged Merge with service port and do clean vserver group
func EnsureListeners ¶
func EnsureListeners(client ClientSLBSDK, service *v1.Service, lb *slb.LoadBalancerType, vgs *vgroups) error
EnsureListeners make sure listeners reconciled 1. First, build listeners config from aliyun API output. 2. Second, build listeners from k8s service object. 3. Third, Merge the up two listeners to decide whether add/update/remove is needed. 4. Do update. Clean unused vserver group.
func EnsureListenersDeleted ¶
func EnsureListenersDeleted(client ClientSLBSDK, service *v1.Service, lb *slb.LoadBalancerType, vgs *vgroups) error
EnsureListenersDeleted Only listener which owned by my service was deleted.
func ExtractAnnotationRequest ¶
func ExtractAnnotationRequest(service *v1.Service) (*AnnotationRequest, *AnnotationRequest)
ExtractAnnotationRequest extract annotations from service labels defaulted is the parameters which set by programe. request represent user defined parameters.
func GetPrivateZoneRecordCache ¶
func GetPrivateZoneRecordCache() *kvstore
GetPrivateZoneRecordCache return record cache
func Protocol ¶
func Protocol(annotation string, port v1.ServicePort) (string, error)
Protocol for protocol transform
func URIfromService ¶
URIfromService build ServiceURI from service
func WaitCreate ¶
func WaitCreate(rc *RoutesClient, tableid string, route *ecs.CreateRouteEntryArgs) error
WaitCreate create route and wait for route ready
func WaitDelete ¶
func WaitDelete(rc *RoutesClient, tableid string, route *ecs.DeleteRouteEntryArgs) error
WaitDelete delete route and wait for route ready
func WaitForRouteEntryAvailable ¶
WaitForRouteEntryAvailable wait for route entry available
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 MasterZoneID string SlaveZoneID string HealthCheck slb.FlagType HealthCheckURI string HealthCheckConnectPort int HealthyThreshold int UnhealthyThreshold int HealthCheckInterval int HealthCheckDomain string HealthCheckHttpCode slb.HealthCheckHttpCodeType HealthCheckConnectTimeout int // for tcp HealthCheckType slb.HealthCheckType // for tcp, Type could be http tcp HealthCheckTimeout int // for https and http LoadBalancerSpec slb.LoadBalancerSpecType StickySession slb.FlagType StickySessionType slb.StickySessionType Cookie string CookieTimeout int PersistenceTimeout int AddressIPVersion slb.AddressIPVersionType OverrideListeners string PrivateZoneName string PrivateZoneId string PrivateZoneRecordName string PrivateZoneRecordTTL int }
AnnotationRequest annotated parameters.
type ClientInstanceSDK ¶
type ClientInstanceSDK interface {
DescribeInstances(args *ecs.DescribeInstancesArgs) (instances []ecs.InstanceAttributesType, pagination *common.PaginationResult, err error)
}
ClientInstanceSDK instance sdk
type ClientMgr ¶
type ClientMgr struct {
// contains filtered or unexported fields
}
ClientMgr client manager for aliyun sdk
func NewClientMgr ¶
NewClientMgr return a new client manager
func (*ClientMgr) Instances ¶
func (c *ClientMgr) Instances() *InstanceClient
Instances return instance client
func (*ClientMgr) LoadBalancers ¶
func (c *ClientMgr) LoadBalancers() *LoadBalancerClient
LoadBalancers return loadbalancer client
func (*ClientMgr) PrivateZones ¶
func (c *ClientMgr) PrivateZones() *PrivateZoneClient
PrivateZones return PrivateZones client
type ClientPVTZSDK ¶
type ClientPVTZSDK interface { DescribeZones(args *pvtz.DescribeZonesArgs) (zones []pvtz.ZoneType, err error) AddZone(args *pvtz.AddZoneArgs) (response *pvtz.AddZoneResponse, err error) DeleteZone(args *pvtz.DeleteZoneArgs) (err error) CheckZoneName(args *pvtz.CheckZoneNameArgs) (bool, error) UpdateZoneRemark(args *pvtz.UpdateZoneRemarkArgs) error DescribeZoneInfo(args *pvtz.DescribeZoneInfoArgs) (response *pvtz.DescribeZoneInfoResponse, err error) BindZoneVpc(args *pvtz.BindZoneVpcArgs) (err error) DescribeRegions() (regions []pvtz.RegionType, err error) DescribeZoneRecords(args *pvtz.DescribeZoneRecordsArgs) (records []pvtz.ZoneRecordType, err error) DescribeZoneRecordsByRR(zoneId string, rr string) (records []pvtz.ZoneRecordType, err error) DeleteZoneRecordsByRR(zoneId string, rr string) error AddZoneRecord(args *pvtz.AddZoneRecordArgs) (response *pvtz.AddZoneRecordResponse, err error) UpdateZoneRecord(args *pvtz.UpdateZoneRecordArgs) (err error) DeleteZoneRecord(args *pvtz.DeleteZoneRecordArgs) (err error) SetZoneRecordStatus(args *pvtz.SetZoneRecordStatusArgs) (err error) }
ClientPVTZSDK private zone sdk interface
type ClientSLBSDK ¶
type ClientSLBSDK interface { DescribeLoadBalancers(args *slb.DescribeLoadBalancersArgs) (loadBalancers []slb.LoadBalancerType, err error) CreateLoadBalancer(args *slb.CreateLoadBalancerArgs) (response *slb.CreateLoadBalancerResponse, err error) DeleteLoadBalancer(loadBalancerId string) (err error) ModifyLoadBalancerInternetSpec(args *slb.ModifyLoadBalancerInternetSpecArgs) (err error) DescribeLoadBalancerAttribute(loadBalancerId string) (loadBalancer *slb.LoadBalancerType, err error) RemoveBackendServers(loadBalancerId string, backendServers []string) (result []slb.BackendServerType, err error) AddBackendServers(loadBalancerId string, backendServers []slb.BackendServerType) (result []slb.BackendServerType, err error) StopLoadBalancerListener(loadBalancerId string, port int) (err error) StartLoadBalancerListener(loadBalancerId string, port int) (err error) CreateLoadBalancerTCPListener(args *slb.CreateLoadBalancerTCPListenerArgs) (err error) CreateLoadBalancerUDPListener(args *slb.CreateLoadBalancerUDPListenerArgs) (err error) DeleteLoadBalancerListener(loadBalancerId string, port int) (err error) CreateLoadBalancerHTTPSListener(args *slb.CreateLoadBalancerHTTPSListenerArgs) (err error) CreateLoadBalancerHTTPListener(args *slb.CreateLoadBalancerHTTPListenerArgs) (err error) DescribeLoadBalancerHTTPSListenerAttribute(loadBalancerId string, port int) (response *slb.DescribeLoadBalancerHTTPSListenerAttributeResponse, err error) DescribeLoadBalancerTCPListenerAttribute(loadBalancerId string, port int) (response *slb.DescribeLoadBalancerTCPListenerAttributeResponse, err error) DescribeLoadBalancerUDPListenerAttribute(loadBalancerId string, port int) (response *slb.DescribeLoadBalancerUDPListenerAttributeResponse, err error) DescribeLoadBalancerHTTPListenerAttribute(loadBalancerId string, port int) (response *slb.DescribeLoadBalancerHTTPListenerAttributeResponse, err error) SetLoadBalancerHTTPListenerAttribute(args *slb.SetLoadBalancerHTTPListenerAttributeArgs) (err error) SetLoadBalancerHTTPSListenerAttribute(args *slb.SetLoadBalancerHTTPSListenerAttributeArgs) (err error) SetLoadBalancerTCPListenerAttribute(args *slb.SetLoadBalancerTCPListenerAttributeArgs) (err error) SetLoadBalancerUDPListenerAttribute(args *slb.SetLoadBalancerUDPListenerAttributeArgs) (err error) RemoveTags(args *slb.RemoveTagsArgs) error DescribeTags(args *slb.DescribeTagsArgs) (tags []slb.TagItemType, pagination *common.PaginationResult, err error) AddTags(args *slb.AddTagsArgs) error CreateVServerGroup(args *slb.CreateVServerGroupArgs) (response *slb.CreateVServerGroupResponse, err error) DescribeVServerGroups(args *slb.DescribeVServerGroupsArgs) (response *slb.DescribeVServerGroupsResponse, err error) DeleteVServerGroup(args *slb.DeleteVServerGroupArgs) (response *slb.DeleteVServerGroupResponse, err error) SetVServerGroupAttribute(args *slb.SetVServerGroupAttributeArgs) (response *slb.SetVServerGroupAttributeResponse, err error) DescribeVServerGroupAttribute(args *slb.DescribeVServerGroupAttributeArgs) (response *slb.DescribeVServerGroupAttributeResponse, err error) ModifyVServerGroupBackendServers(args *slb.ModifyVServerGroupBackendServersArgs) (response *slb.ModifyVServerGroupBackendServersResponse, err error) AddVServerGroupBackendServers(args *slb.AddVServerGroupBackendServersArgs) (response *slb.AddVServerGroupBackendServersResponse, err error) RemoveVServerGroupBackendServers(args *slb.RemoveVServerGroupBackendServersArgs) (response *slb.RemoveVServerGroupBackendServersResponse, err error) }
ClientSLBSDK client sdk for slb
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 ¶
func (c *Cloud) CreateRoute(clusterName string, nameHint string, tableid string, route *cloudprovider.Route) 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 (*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 ¶
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)
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 TODO: Break this up into different interfaces (LB, etc) when we have more than one type of service
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 ¶
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 ¶
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 ¶
HasClusterID returns true if a ClusterID is required and set
func (*Cloud) Initialize ¶
func (c *Cloud) Initialize(builder ctrlclient.ControllerClientBuilder)
Initialize passes a Kubernetes clientBuilder interface to the cloud provider
func (*Cloud) InstanceExistsByProviderID ¶
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 ¶
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) RouteTables ¶
RouteTables return route table list
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 UID string `json:"uid"` VpcID string `json:"vpcid"` Region string `json:"region"` ZoneID string `json:"zoneid"` VswitchID string `json:"vswitchid"` ClusterID string `json:"clusterID"` RouteTableIDS string `json:"routeTableIDs"` AccessKeyID string `json:"accessKeyID"` AccessKeySecret string `json:"accessKeySecret"` } }
CloudConfig wraps the settings for the Alicloud provider.
type IMetaData ¶
type IMetaData interface { HostName() (string, error) ImageID() (string, error) InstanceID() (string, error) Mac() (string, error) NetworkType() (string, error) OwnerAccountID() (string, error) PrivateIPv4() (string, error) Region() (string, error) SerialNumber() (string, error) SourceAddress() (string, error) VpcCIDRBlock() (string, error) VpcID() (string, error) VswitchCIDRBlock() (string, error) Zone() (string, error) NTPConfigServers() ([]string, error) RoleName() (string, error) RamRoleToken(role string) (metadata.RoleAuth, error) VswitchID() (string, error) }
IMetaData metadata interface
type InstanceClient ¶
type InstanceClient struct { CurrentNodeName types.NodeName // contains filtered or unexported fields }
InstanceClient wrap for instance sdk
type Listener ¶
type Listener struct { Name string // NamedKey Map between ServiceName and Listener from console view. NamedKey *NamedKey // Proto is the protocol from console view Proto string // TransforedProto is the real protocol that a listener indicated. TransforedProto string Port int32 // NodePort Backend server port NodePort int32 // ServiceName reference from k8s service Service *v1.Service // LoadBalancerID service connected SLB. LoadBalancerID string // Action indicate the operate method. ADD UPDATE DELETE Action string Client ClientSLBSDK VGroups *vgroups }
Listener loadbalancer listener
type LoadBalancerClient ¶
type LoadBalancerClient struct {
// contains filtered or unexported fields
}
LoadBalancerClient slb client wrapper
func (*LoadBalancerClient) EnsureLoadBalanceDeleted ¶
func (s *LoadBalancerClient) EnsureLoadBalanceDeleted(service *v1.Service) error
EnsureLoadBalanceDeleted make sure slb is deleted
func (*LoadBalancerClient) EnsureLoadBalancer ¶
func (s *LoadBalancerClient) EnsureLoadBalancer(service *v1.Service, nodes []*v1.Node, vswitchid string) (*slb.LoadBalancerType, error)
EnsureLoadBalancer make sure slb is reconciled
func (*LoadBalancerClient) UpdateDefaultServerGroup ¶
func (s *LoadBalancerClient) UpdateDefaultServerGroup(nodes []*v1.Node, lb *slb.LoadBalancerType) error
UpdateDefaultServerGroup update default server group
func (*LoadBalancerClient) UpdateLoadBalancer ¶
func (s *LoadBalancerClient) UpdateLoadBalancer(service *v1.Service, nodes []*v1.Node, withVgroup bool) error
UpdateLoadBalancer make sure slb backend is reconciled
type NamedKey ¶
NamedKey identify listeners on grouped attributes
func LoadNamedKey ¶
LoadNamedKey build NamedKey from string.
func (*NamedKey) ServiceURI ¶
ServiceURI service URI for the NamedKey.
type PrivateZoneClient ¶
type PrivateZoneClient struct {
// contains filtered or unexported fields
}
PrivateZoneClient private zone client wrapper
func (*PrivateZoneClient) EnsurePrivateZoneRecord ¶
func (s *PrivateZoneClient) EnsurePrivateZoneRecord(service *v1.Service, ip string) (zone *pvtz.DescribeZoneInfoResponse, record *pvtz.ZoneRecordType, err error)
EnsurePrivateZoneRecord make sure private zone record is reconciled
func (*PrivateZoneClient) EnsurePrivateZoneRecordDeleted ¶
func (s *PrivateZoneClient) EnsurePrivateZoneRecordDeleted(service *v1.Service, ip string) error
EnsurePrivateZoneRecordDeleted make sure private zone record is deleted.
type RouteSDK ¶
type RouteSDK interface { DescribeVpcs(args *ecs.DescribeVpcsArgs) (vpcs []ecs.VpcSetType, pagination *common.PaginationResult, err error) DescribeVRouters(args *ecs.DescribeVRoutersArgs) (vrouters []ecs.VRouterSetType, pagination *common.PaginationResult, err error) DescribeRouteTables(args *ecs.DescribeRouteTablesArgs) (routeTables []ecs.RouteTableSetType, pagination *common.PaginationResult, err error) DeleteRouteEntry(args *ecs.DeleteRouteEntryArgs) error CreateRouteEntry(args *ecs.CreateRouteEntryArgs) error WaitForAllRouteEntriesAvailable(vrouterId string, routeTableId string, timeout int) error }
RouteSDK define route sdk interface
type RoutesClient ¶
type RoutesClient struct {
// contains filtered or unexported fields
}
RoutesClient wrap route sdk
func (*RoutesClient) CreateRoute ¶
func (r *RoutesClient) CreateRoute(tabid string, 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 ¶
func (r *RoutesClient) DeleteRoute(tabid string, 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 ¶
func (r *RoutesClient) ListRoutes(tableid string) ([]*cloudprovider.Route, error)
ListRoutes lists all managed routes that belong to the specified clusterName
func (*RoutesClient) RouteTables ¶
func (r *RoutesClient) RouteTables() ([]string, error)
RouteTables return all the tables in the vpc network.