Documentation ¶
Index ¶
- Constants
- type ASG
- type AWSCloud
- func (self *AWSCloud) AddSSHKeyToAllInstances(user string, keyData []byte) error
- func (c *AWSCloud) AttachDisk(instanceName string, diskName string, readOnly bool) (string, error)
- func (aws *AWSCloud) Clusters() (cloudprovider.Clusters, bool)
- func (v *AWSCloud) Configure(name string, spec *api.NodeSpec) error
- func (s *AWSCloud) CreateRoute(clusterName string, nameHint string, route *cloudprovider.Route) error
- func (s *AWSCloud) CreateVolume(volumeOptions *VolumeOptions) (string, error)
- func (a *AWSCloud) CurrentNodeName(hostname string) (string, error)
- func (s *AWSCloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error
- func (aws *AWSCloud) DeleteVolume(volumeName string) error
- func (a *AWSCloud) DescribeInstanceGroup(instanceGroupName string) (InstanceGroupInfo, error)
- func (aws *AWSCloud) DetachDisk(instanceName string, diskName string) error
- func (s *AWSCloud) EnsureLoadBalancer(name, region string, publicIP net.IP, ports []*api.ServicePort, hosts []string, ...) (*api.LoadBalancerStatus, error)
- func (s *AWSCloud) EnsureLoadBalancerDeleted(name, region string) error
- func (aws *AWSCloud) ExternalID(name string) (string, error)
- func (s *AWSCloud) GetLoadBalancer(name, region string) (*api.LoadBalancerStatus, bool, error)
- func (c *AWSCloud) GetVolumeLabels(volumeName string) (map[string]string, error)
- func (self *AWSCloud) GetZone() (cloudprovider.Zone, error)
- func (aws *AWSCloud) InstanceID(name string) (string, error)
- func (aws *AWSCloud) Instances() (cloudprovider.Instances, bool)
- func (aws *AWSCloud) List(filter string) ([]string, error)
- func (s *AWSCloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)
- func (s *AWSCloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
- func (aws *AWSCloud) NodeAddresses(name string) ([]api.NodeAddress, error)
- func (aws *AWSCloud) ProviderName() string
- func (v *AWSCloud) Release(name string) error
- func (a *AWSCloud) ResizeInstanceGroup(instanceGroupName string, size int) error
- func (aws *AWSCloud) Routes() (cloudprovider.Routes, bool)
- func (aws *AWSCloud) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)
- func (s *AWSCloud) UpdateLoadBalancer(name, region string, hosts []string) error
- func (aws *AWSCloud) Zones() (cloudprovider.Zones, bool)
- type AWSCloudConfig
- type AWSServices
- type EC2
- type EC2Metadata
- type ELB
- type InstanceGroupInfo
- type InstanceGroups
- type VolumeOptions
- type Volumes
Constants ¶
const DefaultVolumeType = "gp2"
Default volume type for newly created Volumes TODO: Remove when user/admin can configure volume types and thus we don't need hardcoded defaults.
const MaxReadThenCreateRetries = 30
We sometimes read to see if something exists; then try to create it if we didn't find it This can fail once in a consistent system if done in parallel In an eventually consistent system, it could fail unboundedly MaxReadThenCreateRetries sets the maximum number of attempts we will make
const ProviderName = "aws"
const TagNameKubernetesCluster = "KubernetesCluster"
The tag name we use to differentiate multiple logically independent clusters running in the same AZ
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ASG ¶
type ASG interface { UpdateAutoScalingGroup(*autoscaling.UpdateAutoScalingGroupInput) (*autoscaling.UpdateAutoScalingGroupOutput, error) DescribeAutoScalingGroups(*autoscaling.DescribeAutoScalingGroupsInput) (*autoscaling.DescribeAutoScalingGroupsOutput, error) }
This is a simple pass-through of the Autoscaling client interface, which allows for testing
type AWSCloud ¶
type AWSCloud struct {
// contains filtered or unexported fields
}
AWSCloud is an implementation of Interface, LoadBalancer and Instances for Amazon Web Services.
func (*AWSCloud) AddSSHKeyToAllInstances ¶
func (*AWSCloud) AttachDisk ¶
Implements Volumes.AttachDisk
func (*AWSCloud) CreateRoute ¶
func (s *AWSCloud) CreateRoute(clusterName string, nameHint string, route *cloudprovider.Route) error
CreateRoute implements Routes.CreateRoute Create the described route
func (*AWSCloud) CreateVolume ¶
func (s *AWSCloud) CreateVolume(volumeOptions *VolumeOptions) (string, error)
Implements Volumes.CreateVolume
func (*AWSCloud) CurrentNodeName ¶
func (*AWSCloud) DeleteRoute ¶
func (s *AWSCloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error
DeleteRoute implements Routes.DeleteRoute Delete the specified route
func (*AWSCloud) DeleteVolume ¶
Implements Volumes.DeleteVolume
func (*AWSCloud) DescribeInstanceGroup ¶
func (a *AWSCloud) DescribeInstanceGroup(instanceGroupName string) (InstanceGroupInfo, error)
Implement InstanceGroups.DescribeInstanceGroup Queries the cloud provider for information about the specified instance group
func (*AWSCloud) DetachDisk ¶
Implements Volumes.DetachDisk
func (*AWSCloud) EnsureLoadBalancer ¶
func (s *AWSCloud) EnsureLoadBalancer(name, region string, publicIP net.IP, ports []*api.ServicePort, hosts []string, affinity api.ServiceAffinity) (*api.LoadBalancerStatus, error)
EnsureTCPLoadBalancer implements TCPLoadBalancer.EnsureTCPLoadBalancer TODO(justinsb) It is weird that these take a region. I suspect it won't work cross-region anyway.
func (*AWSCloud) EnsureLoadBalancerDeleted ¶
EnsureLoadBalancerDeleted implements LoadBalancer.EnsureLoadBalancerDeleted.
func (*AWSCloud) ExternalID ¶
ExternalID returns the cloud provider ID of the specified instance (deprecated). Note that if the instance does not exist or is no longer running, we must return ("", cloudprovider.InstanceNotFound)
func (*AWSCloud) GetLoadBalancer ¶
GetLoadBalancer is an implementation of LoadBalancer.GetLoadBalancer
func (*AWSCloud) GetVolumeLabels ¶
Implements Volumes.GetVolumeLabels
func (*AWSCloud) GetZone ¶
func (self *AWSCloud) GetZone() (cloudprovider.Zone, error)
GetZone implements Zones.GetZone
func (*AWSCloud) InstanceID ¶
InstanceID returns the cloud provider ID of the specified instance.
func (*AWSCloud) Instances ¶
func (aws *AWSCloud) Instances() (cloudprovider.Instances, bool)
Instances returns an implementation of Instances for Amazon Web Services.
func (*AWSCloud) ListRoutes ¶
func (s *AWSCloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)
ListRoutes implements Routes.ListRoutes List all routes that match the filter
func (*AWSCloud) LoadBalancer ¶
func (s *AWSCloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
LoadBalancer returns an implementation of LoadBalancer for Amazon Web Services.
func (*AWSCloud) NodeAddresses ¶
func (aws *AWSCloud) NodeAddresses(name string) ([]api.NodeAddress, error)
NodeAddresses is an implementation of Instances.NodeAddresses.
func (*AWSCloud) ProviderName ¶
ProviderName returns the cloud provider ID.
func (*AWSCloud) ResizeInstanceGroup ¶
Implement InstanceGroups.ResizeInstanceGroup Set the size to the fixed size
func (*AWSCloud) Routes ¶
func (aws *AWSCloud) Routes() (cloudprovider.Routes, bool)
Routes returns an implementation of Routes for Amazon Web Services.
func (*AWSCloud) UpdateLoadBalancer ¶
UpdateLoadBalancer implements LoadBalancer.UpdateLoadBalancer
type AWSCloudConfig ¶
type AWSServices ¶
type AWSServices interface { Compute(region string) (EC2, error) LoadBalancing(region string) (ELB, error) Autoscaling(region string) (ASG, error) Metadata() (EC2Metadata, error) }
Abstraction over AWS, to allow mocking/other implementations
type EC2 ¶
type EC2 interface { // Query EC2 for instances matching the filter DescribeInstances(request *ec2.DescribeInstancesInput) ([]*ec2.Instance, error) // Attach a volume to an instance AttachVolume(*ec2.AttachVolumeInput) (*ec2.VolumeAttachment, error) // Detach a volume from an instance it is attached to DetachVolume(request *ec2.DetachVolumeInput) (resp *ec2.VolumeAttachment, err error) // Lists volumes DescribeVolumes(request *ec2.DescribeVolumesInput) ([]*ec2.Volume, error) // Create an EBS volume CreateVolume(request *ec2.CreateVolumeInput) (resp *ec2.Volume, err error) // Delete an EBS volume DeleteVolume(*ec2.DeleteVolumeInput) (*ec2.DeleteVolumeOutput, error) DescribeSecurityGroups(request *ec2.DescribeSecurityGroupsInput) ([]*ec2.SecurityGroup, error) CreateSecurityGroup(*ec2.CreateSecurityGroupInput) (*ec2.CreateSecurityGroupOutput, error) DeleteSecurityGroup(request *ec2.DeleteSecurityGroupInput) (*ec2.DeleteSecurityGroupOutput, error) AuthorizeSecurityGroupIngress(*ec2.AuthorizeSecurityGroupIngressInput) (*ec2.AuthorizeSecurityGroupIngressOutput, error) RevokeSecurityGroupIngress(*ec2.RevokeSecurityGroupIngressInput) (*ec2.RevokeSecurityGroupIngressOutput, error) DescribeSubnets(*ec2.DescribeSubnetsInput) ([]*ec2.Subnet, error) CreateTags(*ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error) DescribeRouteTables(request *ec2.DescribeRouteTablesInput) ([]*ec2.RouteTable, error) CreateRoute(request *ec2.CreateRouteInput) (*ec2.CreateRouteOutput, error) DeleteRoute(request *ec2.DeleteRouteInput) (*ec2.DeleteRouteOutput, error) ModifyInstanceAttribute(request *ec2.ModifyInstanceAttributeInput) (*ec2.ModifyInstanceAttributeOutput, error) }
TODO: Should we rename this to AWS (EBS & ELB are not technically part of EC2) Abstraction over EC2, to allow mocking/other implementations Note that the DescribeX functions return a list, so callers don't need to deal with paging
type EC2Metadata ¶ added in v1.1.1
type EC2Metadata interface { // Query the EC2 metadata service (used to discover instance-id etc) GetMetadata(path string) (string, error) }
Abstraction over the AWS metadata service
type ELB ¶
type ELB interface { CreateLoadBalancer(*elb.CreateLoadBalancerInput) (*elb.CreateLoadBalancerOutput, error) DeleteLoadBalancer(*elb.DeleteLoadBalancerInput) (*elb.DeleteLoadBalancerOutput, error) DescribeLoadBalancers(*elb.DescribeLoadBalancersInput) (*elb.DescribeLoadBalancersOutput, error) RegisterInstancesWithLoadBalancer(*elb.RegisterInstancesWithLoadBalancerInput) (*elb.RegisterInstancesWithLoadBalancerOutput, error) DeregisterInstancesFromLoadBalancer(*elb.DeregisterInstancesFromLoadBalancerInput) (*elb.DeregisterInstancesFromLoadBalancerOutput, error) DetachLoadBalancerFromSubnets(*elb.DetachLoadBalancerFromSubnetsInput) (*elb.DetachLoadBalancerFromSubnetsOutput, error) AttachLoadBalancerToSubnets(*elb.AttachLoadBalancerToSubnetsInput) (*elb.AttachLoadBalancerToSubnetsOutput, error) CreateLoadBalancerListeners(*elb.CreateLoadBalancerListenersInput) (*elb.CreateLoadBalancerListenersOutput, error) DeleteLoadBalancerListeners(*elb.DeleteLoadBalancerListenersInput) (*elb.DeleteLoadBalancerListenersOutput, error) ApplySecurityGroupsToLoadBalancer(*elb.ApplySecurityGroupsToLoadBalancerInput) (*elb.ApplySecurityGroupsToLoadBalancerOutput, error) ConfigureHealthCheck(*elb.ConfigureHealthCheckInput) (*elb.ConfigureHealthCheckOutput, error) }
This is a simple pass-through of the ELB client interface, which allows for testing
type InstanceGroupInfo ¶
type InstanceGroupInfo interface { // The number of instances currently running under control of this group CurrentSize() (int, error) }
InstanceGroupInfo is returned by InstanceGroups.Describe, and exposes information about the group.
type InstanceGroups ¶
type InstanceGroups interface { // Set the size to the fixed size ResizeInstanceGroup(instanceGroupName string, size int) error // Queries the cloud provider for information about the specified instance group DescribeInstanceGroup(instanceGroupName string) (InstanceGroupInfo, error) }
InstanceGroups is an interface for managing cloud-managed instance groups / autoscaling instance groups TODO: Allow other clouds to implement this
type VolumeOptions ¶
type Volumes ¶
type Volumes interface { // Attach the disk to the specified instance // instanceName can be empty to mean "the instance on which we are running" // Returns the device (e.g. /dev/xvdf) where we attached the volume AttachDisk(instanceName string, volumeName string, readOnly bool) (string, error) // Detach the disk from the specified instance // instanceName can be empty to mean "the instance on which we are running" DetachDisk(instanceName string, volumeName string) error // Create a volume with the specified options CreateVolume(volumeOptions *VolumeOptions) (volumeName string, err error) DeleteVolume(volumeName string) error // Get labels to apply to volume on creation GetVolumeLabels(volumeName string) (map[string]string, error) }
Volumes is an interface for managing cloud-provisioned volumes TODO: Allow other clouds to implement this