cloudprovider

package
v0.0.0-...-607a5b3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 10 Imported by: 5

Documentation

Overview

Package cloudprovider supplies interfaces and implementations for cloud service providers.

Index

Constants

This section is empty.

Variables

View Source
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

func GetLoadBalancerSourceRanges(service *v1.Service) (utilnet.IPNetSet, error)

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

func GetSecurityGroupName(service *apiv1.Service) string

TODO(#6812): Use a shorter name that's less likely to be longer than cloud providers' name length limits.

func IsCloudProvider

func IsCloudProvider(name string) bool

IsCloudProvider returns true if name corresponds to an already registered cloud provider.

func RegisterCloudProvider

func RegisterCloudProvider(name string, cloud Factory)

RegisterCloudProvider registers a cloudprovider.Factory by name. This is expected to happen during app startup.

Types

type Factory

type Factory func(config io.Reader) (Interface, error)

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

func GetCloudProvider(name string, config io.Reader) (Interface, error)

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.

func InitCloudProvider

func InitCloudProvider(name string, configFilePath string) (Interface, error)

InitCloudProvider creates an instance of the named cloud provider.

Directories

Path Synopsis
aws
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL