Documentation ¶
Index ¶
- type AwsClient
- type AwsClientImpl
- func (a AwsClientImpl) AssignPrivateIPAddresses(request *ec2.AssignPrivateIpAddressesInput) (*ec2.AssignPrivateIpAddressesOutput, error)
- func (a AwsClientImpl) DescribeInstances(request *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
- func (a AwsClientImpl) DescribeNetworkInterfaces(request *ec2.DescribeNetworkInterfacesInput) (*ec2.DescribeNetworkInterfacesOutput, error)
- func (a AwsClientImpl) DescribeSubnets(request *ec2.DescribeSubnetsInput) (*ec2.DescribeSubnetsOutput, error)
- func (a *AwsClientImpl) GetRegion() string
- func (a AwsClientImpl) UnassignPrivateIPAddresses(request *ec2.UnassignPrivateIpAddressesInput) (*ec2.UnassignPrivateIpAddressesOutput, error)
- type AwsCloudProvider
- func (a *AwsCloudProvider) AddRandomIPs() ([]string, []*net.IP, error)
- func (a *AwsCloudProvider) AddSpecifiedIPs(ips []*net.IP) ([]string, error)
- func (a *AwsCloudProvider) ClusterTag() (string, string)
- func (a *AwsCloudProvider) Instance(instanceID string) (*CloudInstance, error)
- func (a *AwsCloudProvider) InstanceByHostName(hostname string) (*CloudInstance, error)
- func (a *AwsCloudProvider) RemoveIP(ip *net.IP) (string, error)
- func (a *AwsCloudProvider) SetAwsClient(client *AwsClient, region string, clusterName string)
- type AwsInstance
- func (a AwsInstance) FailureRegion() string
- func (a AwsInstance) FailureZone() string
- func (a AwsInstance) HostName() string
- func (a AwsInstance) ID() string
- func (a AwsInstance) NetworkInterface() string
- func (a AwsInstance) New(provider *AwsCloudProvider, data ec2.Instance) *CloudInstance
- func (a AwsInstance) PrimaryIP() *net.IP
- func (a AwsInstance) SecondaryIps() []*net.IP
- func (a AwsInstance) Tags() *map[string]string
- func (a AwsInstance) URI() string
- type AwsNetwork
- type CloudInstance
- type CloudNetwork
- type CloudProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AwsClient ¶
type AwsClient interface { AssignPrivateIPAddresses(request *ec2.AssignPrivateIpAddressesInput) (*ec2.AssignPrivateIpAddressesOutput, error) UnassignPrivateIPAddresses(request *ec2.UnassignPrivateIpAddressesInput) (*ec2.UnassignPrivateIpAddressesOutput, error) DescribeInstances(request *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error) DescribeNetworkInterfaces(request *ec2.DescribeNetworkInterfacesInput) (*ec2.DescribeNetworkInterfacesOutput, error) DescribeSubnets(request *ec2.DescribeSubnetsInput) (*ec2.DescribeSubnetsOutput, error) GetRegion() string }
AwsClient -- abstracts the direct calls to ec2 SDK since we need to mock them out for enabling testings.
func CreateAwsClient ¶
CreateAwsClient -- creates a fully initialized AwsClient for the specified region. A new session is created and used for the ec2 and autoscaling client.
type AwsClientImpl ¶
type AwsClientImpl struct {
// contains filtered or unexported fields
}
AwsClientImpl -- The production implementation of the AwsClient interface.
func (AwsClientImpl) AssignPrivateIPAddresses ¶
func (a AwsClientImpl) AssignPrivateIPAddresses(request *ec2.AssignPrivateIpAddressesInput) (*ec2.AssignPrivateIpAddressesOutput, error)
AssignPrivateIPAddresses -- Assigns IP addresses to an instance.
func (AwsClientImpl) DescribeInstances ¶
func (a AwsClientImpl) DescribeInstances(request *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
DescribeInstances -- Retrieves all information for a specific instance or all instances matching the request.
func (AwsClientImpl) DescribeNetworkInterfaces ¶
func (a AwsClientImpl) DescribeNetworkInterfaces(request *ec2.DescribeNetworkInterfacesInput) (*ec2.DescribeNetworkInterfacesOutput, error)
DescribeNetworkInterfaces -- Retrieves all information for the network interface(s) matching the request.
func (AwsClientImpl) DescribeSubnets ¶
func (a AwsClientImpl) DescribeSubnets(request *ec2.DescribeSubnetsInput) (*ec2.DescribeSubnetsOutput, error)
DescribeSubnets -- Describes the subnet(s) matching the request.
func (*AwsClientImpl) GetRegion ¶
func (a *AwsClientImpl) GetRegion() string
GetRegion -- returns the region this AwsClient is defined for.
func (AwsClientImpl) UnassignPrivateIPAddresses ¶
func (a AwsClientImpl) UnassignPrivateIPAddresses(request *ec2.UnassignPrivateIpAddressesInput) (*ec2.UnassignPrivateIpAddressesOutput, error)
UnassignPrivateIPAddresses -- Removes the IP addresses from an instance.
type AwsCloudProvider ¶
type AwsCloudProvider struct { Region string Aws AwsClient ClusterName string // name of the cluster -- will be the AWS tag key="kubernetes.io/cluster/<ClusterName>", value="owned" // contains filtered or unexported fields }
AwsCloudProvider implements the generic CloudProvider.
func AwsProvider ¶
func AwsProvider() *AwsCloudProvider
AwsProvider returns the singleton provider object
func (*AwsCloudProvider) AddRandomIPs ¶
func (a *AwsCloudProvider) AddRandomIPs() ([]string, []*net.IP, error)
AddRandomIPs adds a random IP addresses to any machine of the given machine set. It will add one ip address in every subnet used by the machine set. It will return either the instances and the new assigned IPs or an error.
func (*AwsCloudProvider) AddSpecifiedIPs ¶
func (a *AwsCloudProvider) AddSpecifiedIPs(ips []*net.IP) ([]string, error)
AddSpecifiedIPs adds the given IPs to the cloud.
func (*AwsCloudProvider) ClusterTag ¶
func (a *AwsCloudProvider) ClusterTag() (string, string)
ClusterTag returns the AWS tag and value the cluster marks all AWS resources with.
func (*AwsCloudProvider) Instance ¶
func (a *AwsCloudProvider) Instance(instanceID string) (*CloudInstance, error)
Instance -- loads an EC2 instance by its ID
func (*AwsCloudProvider) InstanceByHostName ¶
func (a *AwsCloudProvider) InstanceByHostName(hostname string) (*CloudInstance, error)
InstanceByHostName returns the instance for the given hostname
func (*AwsCloudProvider) RemoveIP ¶
func (a *AwsCloudProvider) RemoveIP(ip *net.IP) (string, error)
RemoveIP removes the IP from the AWS account
func (*AwsCloudProvider) SetAwsClient ¶
func (a *AwsCloudProvider) SetAwsClient(client *AwsClient, region string, clusterName string)
SetAwsClient -- Injector to get a special AwsClient (e.g. a mocked one) for special purposes ...
type AwsInstance ¶
type AwsInstance struct {
// contains filtered or unexported fields
}
AwsInstance The single AWS instance information
func (AwsInstance) FailureRegion ¶
func (a AwsInstance) FailureRegion() string
FailureRegion returns the failure region of the cloud instance
func (AwsInstance) FailureZone ¶
func (a AwsInstance) FailureZone() string
FailureZone returns the failure zone of the cloud instance
func (AwsInstance) HostName ¶
func (a AwsInstance) HostName() string
HostName returns the DNS hostname of the cloud instance
func (AwsInstance) NetworkInterface ¶
func (a AwsInstance) NetworkInterface() string
NetworkInterface returns the network interface id of the cloud instance
func (AwsInstance) New ¶
func (a AwsInstance) New(provider *AwsCloudProvider, data ec2.Instance) *CloudInstance
New creates a new AWS CloudInstance
func (AwsInstance) PrimaryIP ¶
func (a AwsInstance) PrimaryIP() *net.IP
PrimaryIP returns the primary ip of the cloud instance
func (AwsInstance) SecondaryIps ¶
func (a AwsInstance) SecondaryIps() []*net.IP
SecondaryIps returns the secondary IPs of the cloud instance
func (AwsInstance) Tags ¶
func (a AwsInstance) Tags() *map[string]string
Tags returns a map containing all Tags of the instance
func (AwsInstance) URI ¶
func (a AwsInstance) URI() string
URI returns the URI of the cloud instance
type AwsNetwork ¶
type AwsNetwork struct {
// contains filtered or unexported fields
}
The AwsNetwork is the AWS implementation of the CloudNetwork
func CreateNetwork ¶
func CreateNetwork(provider *AwsCloudProvider, subnet *ec2.Subnet) (*AwsNetwork, error)
CreateNetwork - creates an AWS subnet into an AwsNetwork
func (*AwsNetwork) AvailableIPCount ¶
func (n *AwsNetwork) AvailableIPCount() int64
AvailableIPCount - the available IPs. ATTENTION: since the data is cached for some minutes, the value may not be correct. Use with care.
func (*AwsNetwork) DefaultForFailureZone ¶
func (n *AwsNetwork) DefaultForFailureZone() bool
DefaultForFailureZone - This network is the default network for all instances within this failure zone
func (*AwsNetwork) FailureZone ¶
func (n *AwsNetwork) FailureZone() string
FailureZone - The failure zone this network is configured into
func (*AwsNetwork) IsIPInNetwork ¶
func (n *AwsNetwork) IsIPInNetwork(ip *net.IP) bool
IsIPInNetwork checks if the given IP is from the network.
func (*AwsNetwork) URI ¶
func (n *AwsNetwork) URI() string
URI - the cloud provider URI for referencing this network
type CloudInstance ¶
type CloudInstance interface { ID() string // InstanceId of this instance URI() string // Unique Resource Identifier -- e.g. the ARN at AWS HostName() string // Hostname of this instance FailureRegion() string // Cloud Region of this instance FailureZone() string // Failure zone this instance is located in Tags() *map[string]string // The tags of this instance NetworkInterface() string // The ids of the network interfaces of this instance PrimaryIP() *net.IP // primary IP of this instance SecondaryIps() []*net.IP // secondary IPs of this instance }
CloudInstance is a single computing instance in the cloud.
type CloudNetwork ¶
type CloudNetwork interface { IsIPInNetwork(ip *net.IP) bool Name() string URI() string // Unique Resource Identifier -- e.g. the ARN at AWS FailureZone() string DefaultForFailureZone() bool Cidr() *net.IPNet AvailableIPCount() int64 }
CloudNetwork is a defined network within the cloud.
type CloudProvider ¶
type CloudProvider interface { ClusterTag() (string, string) Instance(instanceID string) (*CloudInstance, error) InstanceByHostName(hostname string) (*CloudInstance, error) AddSpecifiedIPs(ips []*net.IP) ([]string, error) AddRandomIPs() ([]string, []*net.IP, error) RemoveIP(ip *net.IP) (string, error) }
The CloudProvider interface hides the different cloud providers. Currently only AWS is implemented though.
func CreateCloudProvider ¶
func CreateCloudProvider() *CloudProvider
CreateCloudProvider - Creates a matching cloud provider. The switch is done by reading the environment variable CLOUD_PROVIDER with a default to AWS.