Documentation ¶
Index ¶
- Constants
- type Cloud
- func (c *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error
- func (c *Cloud) Clusters() (cloudprovider.Clusters, bool)
- func (c *Cloud) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, 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, name types.NodeName) (cloudprovider.Zone, error)
- func (c *Cloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)
- func (c *Cloud) HasClusterID() bool
- func (c *Cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{})
- func (c *Cloud) InstanceExists(ctx context.Context, node *v1.Node) (bool, error)
- func (c *Cloud) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)
- func (c *Cloud) InstanceID(ctx context.Context, name types.NodeName) (string, error)
- func (c *Cloud) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error)
- func (c *Cloud) InstanceShutdown(ctx context.Context, node *v1.Node) (bool, 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 (c *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool)
- func (c *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
- 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 CloudAPIClient
- type Filter
- type Instance
- type LoadBalancer
Constants ¶
const ( // ServiceAnnotationLoadBalancerNetworkVolume is the annotation that specify network volume for load balancer // valid volume is 10, 20, ..., 2000 // See https://pfs.nifcloud.com/api/rest/CreateLoadBalancer.htm ServiceAnnotationLoadBalancerNetworkVolume = "service.beta.kubernetes.io/nifcloud-load-balancer-network-volume" // ServiceAnnotationLoadBalancerAccountingType is the annotation that specify accounting type for load balancer // 1: monthly, 2: pay-per-use // See https://pfs.nifcloud.com/api/rest/CreateLoadBalancer.htm ServiceAnnotationLoadBalancerAccountingType = "service.beta.kubernetes.io/nifcloud-load-balancer-accounting-type" // ServiceAnnotationLoadBalancerPolicyType is the annotation that specify policy type for load balancer // valid values are 'standard' or 'ats' // See https://pfs.nifcloud.com/api/rest/CreateLoadBalancer.htm ServiceAnnotationLoadBalancerPolicyType = "service.beta.kubernetes.io/nifcloud-load-balancer-policy-type" // ServiceAnnotationLoadBalancerBalancingType is the annotation that specify balancing type for load balancer // 1: Round-Robin, 2: Least-Connection // See https://pfs.nifcloud.com/api/rest/CreateLoadBalancer.htm ServiceAnnotationLoadBalancerBalancingType = "service.beta.kubernetes.io/nifcloud-load-balancer-balancing-type" // ServiceAnnotationLoadBalancerHCProtocol is the annotation that specify health check protocol for load balancer // valid values are 'TCP' or 'ICMP' // See https://pfs.nifcloud.com/api/rest/ConfigureHealthCheck.htm ServiceAnnotationLoadBalancerHCProtocol = "service.beta.kubernetes.io/nifcloud-load-balancer-healthcheck-protocol" // ServiceAnnotationLoadBalancerHCUnhealthyThreshold is the annotation that specify the number of unsuccessfull // health checks count required for a backend to be considered unhealthy for traffic // See https://pfs.nifcloud.com/api/rest/ConfigureHealthCheck.htm ServiceAnnotationLoadBalancerHCUnhealthyThreshold = "service.beta.kubernetes.io/nifcloud-load-balancer-healthcheck-unhealthy-threshold" // ServiceAnnotationLoadBalancerHCInterval is the annotation that specify interval seconds for health check // See https://pfs.nifcloud.com/api/rest/ConfigureHealthCheck.htm ServiceAnnotationLoadBalancerHCInterval = "service.beta.kubernetes.io/nifcloud-load-balancer-healthcheck-interval" )
const ProviderName = "nifcloud"
ProviderName is the name of this cloud provider
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cloud ¶
type Cloud struct {
// contains filtered or unexported fields
}
Cloud is an implementation of Interface, LoadBalancer and Instances for NIFCLOUD
func (*Cloud) AddSSHKeyToAllInstances ¶
AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances
func (*Cloud) Clusters ¶
func (c *Cloud) Clusters() (cloudprovider.Clusters, bool)
Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise.
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) EnsureLoadBalancer ¶
func (c *Cloud) EnsureLoadBalancer(ctx context.Context, 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
func (*Cloud) EnsureLoadBalancerDeleted ¶
func (c *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error
EnsureLoadBalancerDeleted deletes the specified load balancer if it exists
func (*Cloud) GetLoadBalancer ¶
func (c *Cloud) GetLoadBalancer(ctx context.Context, 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
func (*Cloud) GetLoadBalancerName ¶
func (c *Cloud) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string
GetLoadBalancerName returns the name of the load balancer
func (*Cloud) GetZone ¶
GetZone returns the Zone containing the current failure zone and locality region that the program is running in
func (*Cloud) GetZoneByNodeName ¶
func (c *Cloud) GetZoneByNodeName(ctx context.Context, name types.NodeName) (cloudprovider.Zone, error)
GetZoneByNodeName returns the Zone containing the current zone and locality region of the node specified by node name
func (*Cloud) GetZoneByProviderID ¶
func (c *Cloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)
GetZoneByProviderID returns the Zone containing the current zone and locality region of the node specified by providerID
func (*Cloud) HasClusterID ¶
HasClusterID returns true if a ClusterID is required and set
func (*Cloud) Initialize ¶
func (c *Cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{})
Initialize provides the cloud with a kubernetes client builder and may spawn goroutines to perform housekeeping or run custom controllers specific to the cloud provider. Any tasks started here should be cleaned up when the stop channel closes.
func (*Cloud) InstanceExists ¶ added in v1.1.0
InstanceExists returns true if the instance for the given node exists according to the cloud provider.
func (*Cloud) InstanceExistsByProviderID ¶
InstanceExistsByProviderID returns true if the instance for the given provider exists.
func (*Cloud) InstanceID ¶
InstanceID returns the cloud provider ID of the node with the specified NodeName.
func (*Cloud) InstanceMetadata ¶ added in v1.1.0
func (c *Cloud) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error)
InstanceMetadata returns the instance's metadata.
func (*Cloud) InstanceShutdown ¶ added in v1.1.0
InstanceShutdown returns true if the instance is shutdown according to the cloud provider.
func (*Cloud) InstanceShutdownByProviderID ¶
InstanceShutdownByProviderID returns true if the instance is shutdown in cloudprovider
func (*Cloud) InstanceType ¶
InstanceType returns the type of the specified instance.
func (*Cloud) InstanceTypeByProviderID ¶
InstanceTypeByProviderID returns the type of the specified instance.
func (*Cloud) Instances ¶
func (c *Cloud) Instances() (cloudprovider.Instances, bool)
Instances returns an implementation of Instances for NIFCLOUD
func (*Cloud) InstancesV2 ¶ added in v1.1.0
func (c *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool)
func (*Cloud) LoadBalancer ¶
func (c *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
LoadBalancer returns an implementation of LoadBalancer for NIFCLOUD
func (*Cloud) NodeAddresses ¶
NodeAddresses returns the addresses of the specified instance.
func (*Cloud) NodeAddressesByProviderID ¶
func (c *Cloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)
NodeAddressesByProviderID returns the addresses of the specified instance.
func (*Cloud) ProviderName ¶
ProviderName returns the cloud provider ID.
func (*Cloud) Routes ¶
func (c *Cloud) Routes() (cloudprovider.Routes, bool)
Routes returns a routes interface along with whether the interface is supported.
type CloudAPIClient ¶
type CloudAPIClient interface { // Instance DescribeInstancesByInstanceID(ctx context.Context, instanceIDs []string) ([]Instance, error) DescribeInstancesByInstanceUniqueID(ctx context.Context, instanceUniqueIDs []string) ([]Instance, error) // LoadBalancer DescribeLoadBalancers(ctx context.Context, name string) ([]LoadBalancer, error) CreateLoadBalancer(ctx context.Context, loadBalancer *LoadBalancer) (string, error) RegisterPortWithLoadBalancer(ctx context.Context, loadBalancer *LoadBalancer) error DeleteLoadBalancer(ctx context.Context, loadBalancer *LoadBalancer) error RegisterInstancesWithLoadBalancer(ctx context.Context, loadBalancer *LoadBalancer, instances []Instance) error DeregisterInstancesFromLoadBalancer(ctx context.Context, loadBalancer *LoadBalancer, instances []Instance) error SetFilterForLoadBalancer(ctx context.Context, loadBalancer *LoadBalancer, filters []Filter) error }
CloudAPIClient is interface
type Instance ¶
type Instance struct { InstanceID string InstanceUniqueID string InstanceType string PublicIPAddress string PrivateIPAddress string Zone string State string }
Instance is instance detail
type LoadBalancer ¶
type LoadBalancer struct { Name string VIP string AccountingType string NetworkVolume int32 PolicyType string BalancingType int32 BalancingTargets []Instance LoadBalancerPort int32 InstancePort int32 HealthCheckTarget string HealthCheckInterval int32 HealthCheckUnhealthyThreshold int32 Filters []string }
LoadBalancer is load balancer detail
func (*LoadBalancer) Equals ¶
func (lb *LoadBalancer) Equals(other LoadBalancer) bool
Equals method checks whether specified load balancer is the same
func (*LoadBalancer) String ¶ added in v1.1.0
func (lb *LoadBalancer) String() string