Documentation ¶
Index ¶
- Constants
- func ResizeInstanceGroup(asg ASG, instanceGroupName string, size int) error
- type ASG
- type Backoff
- type Cloud
- func (c *Cloud) AddSSHKeyToAllInstances(user string, keyData []byte) error
- func (c *Cloud) AttachDisk(diskName string, instanceName string, readOnly bool) (string, error)
- func (c *Cloud) Clusters() (cloudprovider.Clusters, bool)
- func (c *Cloud) CreateDisk(volumeOptions *VolumeOptions) (string, error)
- func (c *Cloud) CreateRoute(clusterName string, nameHint string, route *cloudprovider.Route) error
- func (c *Cloud) CurrentNodeName(hostname string) (string, error)
- func (c *Cloud) DeleteDisk(volumeName string) (bool, error)
- func (c *Cloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error
- func (c *Cloud) DescribeInstanceGroup(instanceGroupName string) (InstanceGroupInfo, error)
- func (c *Cloud) DetachDisk(diskName string, instanceName string) (string, error)
- func (c *Cloud) DiskIsAttached(diskName, instanceID string) (bool, error)
- func (c *Cloud) EnsureLoadBalancer(apiService *api.Service, hosts []string) (*api.LoadBalancerStatus, error)
- func (c *Cloud) EnsureLoadBalancerDeleted(service *api.Service) error
- func (c *Cloud) ExternalID(name string) (string, error)
- func (c *Cloud) GetDiskPath(volumeName string) (string, error)
- func (c *Cloud) GetLoadBalancer(service *api.Service) (*api.LoadBalancerStatus, bool, error)
- func (c *Cloud) GetVolumeLabels(volumeName string) (map[string]string, error)
- func (c *Cloud) GetZone() (cloudprovider.Zone, error)
- func (c *Cloud) InstanceID(name string) (string, error)
- func (c *Cloud) InstanceType(name string) (string, error)
- func (c *Cloud) Instances() (cloudprovider.Instances, bool)
- func (c *Cloud) List(filter string) ([]string, error)
- func (c *Cloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)
- func (c *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
- func (c *Cloud) NodeAddresses(name string) ([]api.NodeAddress, error)
- func (c *Cloud) ProviderName() string
- func (c *Cloud) ResizeInstanceGroup(instanceGroupName string, size int) error
- func (c *Cloud) Routes() (cloudprovider.Routes, bool)
- func (c *Cloud) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)
- func (c *Cloud) UpdateLoadBalancer(service *api.Service, hosts []string) error
- func (c *Cloud) Zones() (cloudprovider.Zones, bool)
- type CloudConfig
- type CrossRequestRetryDelay
- type EC2
- type EC2Metadata
- type ELB
- type IPPermissionSet
- func (s IPPermissionSet) Difference(s2 IPPermissionSet) IPPermissionSet
- func (s1 IPPermissionSet) Equal(s2 IPPermissionSet) bool
- func (s IPPermissionSet) Insert(items ...*ec2.IpPermission)
- func (s1 IPPermissionSet) IsSuperset(s2 IPPermissionSet) bool
- func (s IPPermissionSet) Len() int
- func (s IPPermissionSet) List() []*ec2.IpPermission
- func (s IPPermissionSet) Ungroup() IPPermissionSet
- type InstanceGroupInfo
- type InstanceGroups
- type Services
- type VolumeOptions
- type Volumes
Constants ¶
const DefaultMaxEBSVolumes = 39
DefaultMaxEBSVolumes is the limit for volumes attached to an instance. Amazon recommends no more than 40; the system root volume uses at least one. See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_limits.html#linux-specific-volume-limits
const DefaultVolumeType = "gp2"
DefaultVolumeType specifies which storage to use for newly created Volumes TODO: Remove when user/admin can configure volume types and thus we don't need hardcoded defaults.
const MaxReadThenCreateRetries = 30
MaxReadThenCreateRetries sets the maximum number of attempts we will make when we read to see if something exists and 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
const ProviderName = "aws"
ProviderName is the name of this cloud provider.
const ProxyProtocolPolicyName = "k8s-proxyprotocol-enabled"
const ServiceAnnotationLoadBalancerBEProtocol = "service.beta.kubernetes.io/aws-load-balancer-backend-protocol"
ServiceAnnotationLoadBalancerBEProtocol is the annotation used on the service to specify the protocol spoken by the backend (pod) behind a secure listener. Only inspected when `aws-load-balancer-ssl-cert` is used. If `http` (default) or `https`, an HTTPS listener that terminates the
connection and parses headers is created.
If set to `ssl` or `tcp`, a "raw" SSL listener is used.
const ServiceAnnotationLoadBalancerCertificate = "service.beta.kubernetes.io/aws-load-balancer-ssl-cert"
ServiceAnnotationLoadBalancerCertificate is the annotation used on the service to request a secure listener. Value is a valid certificate ARN. For more, see http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/elb-listener-config.html CertARN is an IAM or CM certificate ARN, e.g. arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
const ServiceAnnotationLoadBalancerInternal = "service.beta.kubernetes.io/aws-load-balancer-internal"
ServiceAnnotationLoadBalancerInternal is the annotation used on the service to indicate that we want an internal ELB. Currently we accept only the value "0.0.0.0/0" - other values are an error. This lets us define more advanced semantics in future.
const ServiceAnnotationLoadBalancerProxyProtocol = "service.beta.kubernetes.io/aws-load-balancer-proxy-protocol"
ServiceAnnotationLoadBalancerProxyProtocol is the annotation used on the service to enable the proxy protocol on an ELB. Right now we only accept the value "*" which means enable the proxy protocol on all ELB backends. In the future we could adjust this to allow setting the proxy protocol only on certain backends.
const ServiceAnnotationLoadBalancerSSLPorts = "service.beta.kubernetes.io/aws-load-balancer-ssl-ports"
ServiceAnnotationLoadBalancerSSLPorts is the annotation used on the service to specify a comma-separated list of ports that will use SSL/HTTPS listeners. Defaults to '*' (all).
const TagNameKubernetesCluster = "KubernetesCluster"
TagNameKubernetesCluster is the tag name we use to differentiate multiple logically independent clusters running in the same AZ
const TagNameKubernetesService = "kubernetes.io/service-name"
TagNameKubernetesService is the tag name we use to differentiate multiple services. Used currently for ELBs only.
const TagNameSubnetInternalELB = "kubernetes.io/role/internal-elb"
TagNameSubnetInternalELB is the tag name used on a subnet to designate that it should be used for internal ELBs
const TagNameSubnetPublicELB = "kubernetes.io/role/elb"
TagNameSubnetPublicELB is the tag name used on a subnet to designate that it should be used for internet ELBs
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ASG ¶
type ASG interface { UpdateAutoScalingGroup(*autoscaling.UpdateAutoScalingGroupInput) (*autoscaling.UpdateAutoScalingGroupOutput, error) DescribeAutoScalingGroups(*autoscaling.DescribeAutoScalingGroupsInput) (*autoscaling.DescribeAutoScalingGroupsOutput, error) }
ASG is a simple pass-through of the Autoscaling client interface, which allows for testing.
type Backoff ¶ added in v1.2.0
type Backoff struct {
// contains filtered or unexported fields
}
Backoff manages a backoff that varies based on the recently observed failures
func (*Backoff) ComputeDelayForRequest ¶ added in v1.2.0
Computes the delay required for a request, also updating internal state to count this request
func (*Backoff) ReportError ¶ added in v1.2.0
func (b *Backoff) ReportError()
Called when we observe a throttling error
type Cloud ¶ added in v1.3.4
type Cloud struct {
// contains filtered or unexported fields
}
Cloud is an implementation of Interface, LoadBalancer and Instances for Amazon Web Services.
func (*Cloud) AddSSHKeyToAllInstances ¶ added in v1.3.4
AddSSHKeyToAllInstances is currently not implemented.
func (*Cloud) AttachDisk ¶ added in v1.3.4
AttachDisk implements Volumes.AttachDisk
func (*Cloud) Clusters ¶ added in v1.3.4
func (c *Cloud) Clusters() (cloudprovider.Clusters, bool)
Clusters returns the list of clusters.
func (*Cloud) CreateDisk ¶ added in v1.3.4
func (c *Cloud) CreateDisk(volumeOptions *VolumeOptions) (string, error)
CreateDisk implements Volumes.CreateDisk
func (*Cloud) CreateRoute ¶ added in v1.3.4
CreateRoute implements Routes.CreateRoute Create the described route
func (*Cloud) CurrentNodeName ¶ added in v1.3.4
CurrentNodeName returns the name of the current node
func (*Cloud) DeleteDisk ¶ added in v1.3.4
DeleteDisk implements Volumes.DeleteDisk
func (*Cloud) DeleteRoute ¶ added in v1.3.4
func (c *Cloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error
DeleteRoute implements Routes.DeleteRoute Delete the specified route
func (*Cloud) DescribeInstanceGroup ¶ added in v1.3.4
func (c *Cloud) DescribeInstanceGroup(instanceGroupName string) (InstanceGroupInfo, error)
Implement InstanceGroups.DescribeInstanceGroup Queries the cloud provider for information about the specified instance group
func (*Cloud) DetachDisk ¶ added in v1.3.4
DetachDisk implements Volumes.DetachDisk
func (*Cloud) DiskIsAttached ¶ added in v1.3.4
DiskIsAttached implements Volumes.DiskIsAttached
func (*Cloud) EnsureLoadBalancer ¶ added in v1.3.4
func (c *Cloud) EnsureLoadBalancer(apiService *api.Service, hosts []string) (*api.LoadBalancerStatus, error)
EnsureLoadBalancer implements LoadBalancer.EnsureLoadBalancer
func (*Cloud) EnsureLoadBalancerDeleted ¶ added in v1.3.4
EnsureLoadBalancerDeleted implements LoadBalancer.EnsureLoadBalancerDeleted.
func (*Cloud) ExternalID ¶ added in v1.3.4
ExternalID returns the cloud provider ID of the specified instance (deprecated).
func (*Cloud) GetDiskPath ¶ added in v1.3.4
GetDiskPath implements Volumes.GetDiskPath
func (*Cloud) GetLoadBalancer ¶ added in v1.3.4
GetLoadBalancer is an implementation of LoadBalancer.GetLoadBalancer
func (*Cloud) GetVolumeLabels ¶ added in v1.3.4
GetVolumeLabels implements Volumes.GetVolumeLabels
func (*Cloud) GetZone ¶ added in v1.3.4
func (c *Cloud) GetZone() (cloudprovider.Zone, error)
GetZone implements Zones.GetZone
func (*Cloud) InstanceID ¶ added in v1.3.4
InstanceID returns the cloud provider ID of the specified instance.
func (*Cloud) InstanceType ¶ added in v1.3.4
InstanceType returns the type of the specified instance.
func (*Cloud) Instances ¶ added in v1.3.4
func (c *Cloud) Instances() (cloudprovider.Instances, bool)
Instances returns an implementation of Instances for Amazon Web Services.
func (*Cloud) ListRoutes ¶ added in v1.3.4
func (c *Cloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)
ListRoutes implements Routes.ListRoutes List all routes that match the filter
func (*Cloud) LoadBalancer ¶ added in v1.3.4
func (c *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
LoadBalancer returns an implementation of LoadBalancer for Amazon Web Services.
func (*Cloud) NodeAddresses ¶ added in v1.3.4
func (c *Cloud) NodeAddresses(name string) ([]api.NodeAddress, error)
NodeAddresses is an implementation of Instances.NodeAddresses.
func (*Cloud) ProviderName ¶ added in v1.3.4
ProviderName returns the cloud provider ID.
func (*Cloud) ResizeInstanceGroup ¶ added in v1.3.4
Implement InstanceGroups.ResizeInstanceGroup Set the size to the fixed size
func (*Cloud) Routes ¶ added in v1.3.4
func (c *Cloud) Routes() (cloudprovider.Routes, bool)
Routes returns an implementation of Routes for Amazon Web Services.
func (*Cloud) UpdateLoadBalancer ¶ added in v1.3.4
UpdateLoadBalancer implements LoadBalancer.UpdateLoadBalancer
type CloudConfig ¶ added in v1.3.4
type CloudConfig struct { Global struct { // TODO: Is there any use for this? We can get it from the instance metadata service // Maybe if we're not running on AWS, e.g. bootstrap; for now it is not very useful Zone string KubernetesClusterTag string //The aws provider creates an inbound rule per load balancer on the node security //group. However, this can run into the AWS security group rule limit of 50 if //many LoadBalancers are created. // //This flag disables the automatic ingress creation. It requires that the user //has setup a rule that allows inbound traffic on kubelet ports from the //local VPC subnet (so load balancers can access it). E.g. 10.82.0.0/16 30000-32000. DisableSecurityGroupIngress bool } }
CloudConfig wraps the settings for the AWS cloud provider.
type CrossRequestRetryDelay ¶ added in v1.2.0
type CrossRequestRetryDelay struct {
// contains filtered or unexported fields
}
CrossRequestRetryDelay inserts delays before AWS calls, when we are observing RequestLimitExceeded errors Note that we share a CrossRequestRetryDelay across multiple AWS requests; this is a process-wide back-off, whereas the aws-sdk-go implements a per-request exponential backoff/retry
func NewCrossRequestRetryDelay ¶ added in v1.2.0
func NewCrossRequestRetryDelay() *CrossRequestRetryDelay
Create a new CrossRequestRetryDelay
func (*CrossRequestRetryDelay) AfterRetry ¶ added in v1.2.0
func (c *CrossRequestRetryDelay) AfterRetry(r *request.Request)
Added to the AfterRetry chain; called after any error
func (*CrossRequestRetryDelay) BeforeSign ¶ added in v1.2.0
func (c *CrossRequestRetryDelay) BeforeSign(r *request.Request)
Added to the Sign chain; called before each request
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) }
EC2 is an abstraction over AWS', to allow mocking/other implementations Note that the DescribeX functions return a list, so callers don't need to deal with paging TODO: Should we rename this to AWS (EBS & ELB are not technically part of EC2)
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) }
EC2Metadata is an 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) CreateLoadBalancerPolicy(*elb.CreateLoadBalancerPolicyInput) (*elb.CreateLoadBalancerPolicyOutput, error) SetLoadBalancerPoliciesForBackendServer(*elb.SetLoadBalancerPoliciesForBackendServerInput) (*elb.SetLoadBalancerPoliciesForBackendServerOutput, 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) }
ELB is a simple pass-through of AWS' ELB client interface, which allows for testing
type IPPermissionSet ¶ added in v1.2.0
type IPPermissionSet map[string]*ec2.IpPermission
func NewIPPermissionSet ¶ added in v1.2.0
func NewIPPermissionSet(items ...*ec2.IpPermission) IPPermissionSet
func (IPPermissionSet) Difference ¶ added in v1.2.0
func (s IPPermissionSet) Difference(s2 IPPermissionSet) IPPermissionSet
Difference returns a set of objects that are not in s2 For example: s1 = {a1, a2, a3} s2 = {a1, a2, a4, a5} s1.Difference(s2) = {a3} s2.Difference(s1) = {a4, a5}
func (IPPermissionSet) Equal ¶ added in v1.2.0
func (s1 IPPermissionSet) Equal(s2 IPPermissionSet) bool
Equal returns true if and only if s1 is equal (as a set) to s2. Two sets are equal if their membership is identical. (In practice, this means same elements, order doesn't matter)
func (IPPermissionSet) Insert ¶ added in v1.2.0
func (s IPPermissionSet) Insert(items ...*ec2.IpPermission)
Insert adds items to the set.
func (IPPermissionSet) IsSuperset ¶ added in v1.2.0
func (s1 IPPermissionSet) IsSuperset(s2 IPPermissionSet) bool
IsSuperset returns true if and only if s1 is a superset of s2.
func (IPPermissionSet) Len ¶ added in v1.2.0
func (s IPPermissionSet) Len() int
Len returns the size of the set.
func (IPPermissionSet) List ¶ added in v1.2.0
func (s IPPermissionSet) List() []*ec2.IpPermission
List returns the contents as a slice. Order is not defined.
func (IPPermissionSet) Ungroup ¶ added in v1.2.0
func (s IPPermissionSet) Ungroup() IPPermissionSet
Ungroup splits permissions out into individual permissions EC2 will combine permissions with the same port but different SourceRanges together, for example We ungroup them so we can process them
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.
func DescribeInstanceGroup ¶ added in v1.2.0
func DescribeInstanceGroup(asg ASG, instanceGroupName string) (InstanceGroupInfo, error)
DescribeInstanceGroup gets info about the specified instancegroup Exported so it can be used by the e2e tests, which don't want to instantiate a full cloudprovider.
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 Services ¶ added in v1.3.4
type Services interface { Compute(region string) (EC2, error) LoadBalancing(region string) (ELB, error) Autoscaling(region string) (ASG, error) Metadata() (EC2Metadata, error) }
Services is an abstraction over AWS, to allow mocking/other implementations
type VolumeOptions ¶
VolumeOptions specifies capacity and tags for a volume.
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(diskName string, instanceName 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" // Returns the device where the volume was attached DetachDisk(diskName string, instanceName string) (string, error) // Create a volume with the specified options CreateDisk(volumeOptions *VolumeOptions) (volumeName string, err error) // Delete the specified volume // Returns true iff the volume was deleted // If the was not found, returns (false, nil) DeleteDisk(volumeName string) (bool, error) // Get labels to apply to volume on creation GetVolumeLabels(volumeName string) (map[string]string, error) // Get volume's disk path from volume name // return the device path where the volume is attached GetDiskPath(volumeName string) (string, error) // Check if the volume is already attached to the instance DiskIsAttached(diskName, instanceID string) (bool, error) }
Volumes is an interface for managing cloud-provisioned volumes TODO: Allow other clouds to implement this