Documentation ¶
Overview ¶
Package cloudprovider supplies interfaces and implementations for cloud service providers.
Index ¶
- Variables
- func CloudProviders() []string
- func GetLoadBalancerSourceRanges(service *v1.Service) (utilnet.IPNetSet, error)
- func GetSecurityGroupName(service *apiv1.Service) string
- func IsCloudProvider(name string) bool
- func RegisterCloudProvider(name string, cloud Factory)
- type Factory
- type Firewall
- type Interface
Constants ¶
This section is empty.
Variables ¶
var InstanceNotFound = errors.New("instance not found")
Functions ¶
func CloudProviders ¶
func CloudProviders() []string
CloudProviders returns the name of all registered cloud providers in a string slice
func GetLoadBalancerSourceRanges ¶
GetLoadBalancerSourceRanges first try to parse and verify LoadBalancerSourceRanges field from a service. If the field is not specified, turn to parse and verify the AnnotationLoadBalancerSourceRangesKey annotation from a service, extracting the source ranges to allow, and if not present returns a default (allow-all) value.
func GetSecurityGroupName ¶
TODO(#6812): Use a shorter name that's less likely to be longer than cloud providers' name length limits.
func IsCloudProvider ¶
IsCloudProvider returns true if name corresponds to an already registered cloud provider.
func RegisterCloudProvider ¶
RegisterCloudProvider registers a cloudprovider.Factory by name. This is expected to happen during app startup.
Types ¶
type Factory ¶
Factory is a function that returns a cloudprovider.Interface. The config parameter provides an io.Reader handler to the factory in order to load specific configurations. If no configuration is provided the parameter is nil.
type Firewall ¶
type Firewall interface { // EnsureFirewall creates and/or update firewall rules. // Implementations must treat the *apiv1.Service parameter as read-only and not modify it. EnsureFirewall(ctx context.Context, service *apiv1.Service, hostnames []string) error // EnsureFirewallDeleted deletes the specified firewall if it // exists, returning nil if the firewall specified either didn't exist or // was successfully deleted. // This construction is useful because many cloud providers' firewall // have multiple underlying components, meaning a Get could say that the firewall // doesn't exist even if some part of it is still laying around. // Implementations must treat the *apiv1.Service parameter as read-only and not modify it. EnsureFirewallDeleted(ctx context.Context, service *apiv1.Service) error }
Firewall is an abstract, pluggable interface for firewalls.
type Interface ¶
type Interface interface { // Firewall returns a firewall interface. Also returns true if the interface is supported, false otherwise. Firewall() (Firewall, bool) // ProviderName returns the cloud provider ID. ProviderName() string }
Interface is an abstract, pluggable interface for cloud providers.
func GetCloudProvider ¶
GetCloudProvider creates an instance of the named cloud provider, or nil if the name is not known. The error return is only used if the named provider was known but failed to initialize. The config parameter specifies the io.Reader handler of the configuration file for the cloud provider, or nil for no configuation.
Directories ¶
Path | Synopsis |
---|---|
fake
Package fake is a test-double implementation of cloudprovider Interface, LoadBalancer and Instances.
|
Package fake is a test-double implementation of cloudprovider Interface, LoadBalancer and Instances. |
gce
Package gce is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine.
|
Package gce is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine. |