Documentation ¶
Index ¶
- Constants
- func IsAttributeEmpty(err error) bool
- func IsClientNotInitialized(err error) bool
- func IsKMSKeyAliasEmpty(err error) bool
- func IsKeyPairCannotCreateAndNotFound(err error) bool
- func IsNoBucketInBucketObject(err error) bool
- func IsNotFound(err error) bool
- func IsNotImplementedMethod(err error) bool
- func IsResourceDelete(err error) bool
- func IsTooManyResults(err error) bool
- func NewCustomExponentialBackoff() *backoff.ExponentialBackOff
- func NewNotify(logger micrologger.Logger, operationName string) func(error, time.Duration)
- type ASGStack
- type AWSEntity
- type AutoScalingGroup
- type Bucket
- type BucketObject
- type EC2StateCode
- type ELB
- type FSKeyPairProvider
- type FindInstancesInput
- type Instance
- type InstanceProfile
- type InternetGateway
- type KMSKey
- type KeyPair
- type KeyPairProvider
- type LaunchConfiguration
- type NatGateway
- type Policy
- type PortPair
- type PortPairs
- type RecordSet
- type Route
- type RouteTable
- type SecurityGroup
- type SecurityGroupRule
- type SecurityGroupRules
- type Subnet
- type VPC
- type VPCPeeringConnection
Constants ¶
const ( CloudFormationStackType resourceType = "cloud formation stack" ELBType resourceType = "elb" HostedZoneType resourceType = "hosted zone" InternetGatewayType resourceType = "internet gateway" InstanceType resourceType = "instance" LaunchConfigurationType resourceType = "launch configuration" NatGatewayType resourceType = "nat gateway" RouteTableType resourceType = "route table" RouteType resourceType = "route" SecurityGroupType resourceType = "security group" SubnetType resourceType = "subnet" VPCType resourceType = "vpc" VPCPeeringConnectionType resourceType = "vpc peering connection" )
const ( RequesterVpcFilterName = "requester-vpc-info.vpc-id" AccepterVpcFilterName = "accepter-vpc-info.vpc-id" )
const ( RoleNameTemplate = "EC2-K8S-Role" PolicyNameTemplate = "EC2-K8S-Policy" ProfileNameTemplate = "EC2-K8S-Role" AssumeRolePolicyDocument = `` /* 163-byte string literal not displayed */ MasterPolicyDocumentTempl = `` /* 688-byte string literal not displayed */ MasterPolicyType = "master" WorkerPolicyDocumentTempl = `` /* 1038-byte string literal not displayed */ WorkerPolicyType = "worker" )
const (
ASGMetricsGranularity = "1Minute"
)
const (
AutoScalingGroupType resourceType = "auto scaling group"
)
Variables ¶
This section is empty.
Functions ¶
func IsAttributeEmpty ¶
IsPortsToOpenEmpty asserts portsToOpenEmptyError.
func IsClientNotInitialized ¶
IsClientNotInitialized asserts clientNotInitializedError.
func IsKMSKeyAliasEmpty ¶
IsKMSKeyAliasEmpty asserts kmsKeyAliasEmptyError.
func IsKeyPairCannotCreateAndNotFound ¶
IsKeyPairCannotCreateAndNotFound asserts keyPairCannotCreateAndNotFoundError.
func IsNoBucketInBucketObject ¶
IsNoBucketInBucketObject asserts noBucketInBucketObjectError.
func IsNotImplementedMethod ¶
IsNotImplementedMethod asserts notImplementedMethodError.
func IsResourceDelete ¶
IsResourceDelete asserts resourceDeleteError.
func IsTooManyResults ¶
IsTooManyResults asserts tooManyResultsError.
func NewCustomExponentialBackoff ¶
func NewCustomExponentialBackoff() *backoff.ExponentialBackOff
NewCustomExponentialBackoff returns pointer to a backoff.ExponentialBackOff, initialized with custom values. At the moment, we only override the MaxElapsedTime.
Types ¶
type ASGStack ¶
type ASGStack struct { Client *cloudformation.CloudFormation // Settings. ASGMaxSize int ASGMinSize int ASGType string AssociatePublicIPAddress bool AvailabilityZone string ClusterID string HealthCheckGracePeriod int IAMInstanceProfileName string ImageID string LoadBalancerName string InstanceType string KeyName string Name string SecurityGroupID string SmallCloudConfig string SubnetID string // TemplateURL is the S3 URL where the CloudFormation template is stored. TemplateURL string VPCID string }
ASGStack represents a CloudFormation stack for an Auto Scaling Group.
func (*ASGStack) CheckIfExists ¶
CheckIfExists checks if there is an autoscaling group stack in Cloud Formation with the provided name.
func (*ASGStack) CreateOrFail ¶
CreateOrFail creates the autoscaling group stack in Cloud Formation or returns the error.
type AutoScalingGroup ¶
type AutoScalingGroup struct { // AvailabilityZone is the AZ the instances will be placed in. AvailabilityZone string // ClusterID is the ID of the cluster. ClusterID string // HealthCheckGracePeriod is the time, in seconds, that the instances are // given after boot before the healthchecks start. HealthCheckGracePeriod int // LaunchConfigurationName is the name of the Launch Configuration used for the instances. LaunchConfigurationName string // LoadBalancerName is the name of the existing ELB that will be placed in // the ASG to front the instances. LoadBalancerName string // MaxSize is the maximum amount of instances that will be created in this ASG. MaxSize int // MinSize is the minimum amount of instances in this ASG. There will never be // less than MinSize instances running. MinSize int // Name is the ASG name. Name string // VPCZoneIdentifier is the Subnet ID of the subnet the instances should be // placed in. VPCZoneIdentifier string // Dependencies. Client *autoscaling.AutoScaling }
func (*AutoScalingGroup) CreateIfNotExists ¶
func (asg *AutoScalingGroup) CreateIfNotExists() (bool, error)
func (*AutoScalingGroup) CreateOrFail ¶
func (asg *AutoScalingGroup) CreateOrFail() error
func (*AutoScalingGroup) Delete ¶
func (asg *AutoScalingGroup) Delete() error
func (*AutoScalingGroup) Update ¶
func (asg *AutoScalingGroup) Update() error
type BucketObject ¶
func (*BucketObject) CreateIfNotExists ¶
func (bo *BucketObject) CreateIfNotExists() (bool, error)
CreateIfNotExists is not implemeted because S3 overwrites bucket objects in case of name clashes. This means that a newer CloudConfig with the same name as an old one will always overwrite it. If we decide to use the S3 bucket for other types of files, we might have to revisit this.
func (*BucketObject) CreateOrFail ¶
func (bo *BucketObject) CreateOrFail() error
func (*BucketObject) Delete ¶
func (bo *BucketObject) Delete() error
type EC2StateCode ¶
type EC2StateCode int
const ( // http://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#InstanceState EC2PendingState EC2StateCode = 0 EC2RunningState EC2StateCode = 16 EC2ShuttingDownState EC2StateCode = 32 EC2TerminatedState EC2StateCode = 48 EC2StoppingState EC2StateCode = 64 EC2StoppedState EC2StateCode = 80 )
type ELB ¶
type ELB struct { AZ string Client *elb.ELB IdleTimeoutSeconds int Name string PortsToOpen PortPairs Scheme string SecurityGroup string SubnetID string Tags []string // contains filtered or unexported fields }
ELB is an Elastic Load Balancer
func NewELBFromExisting ¶
NewELBFromExisting initializes an ELB struct with some fields retrieved from the API, such as its FQDN and its Hosted Zone ID. We need these fields when deleting a Record Set. This method doesn't create a new ELB on AWS.
func (*ELB) AssignProxyProtocolPolicy ¶
AssignProxyProtocolPolicy creates a ProxyProtocol policy and assigns it to the Load Balancer. This is needed for ELBs that listen/forward over TCP, in order to add a header with the address, port of the source and destination. Without this, `kubectl log/exec` don't work. See https://github.com/kubernetes/ingress/tree/4601775c18f5c6968e56e1eeaa26efc629590bb0/controllers/nginx#proxy-protocol
func (*ELB) CreateIfNotExists ¶
func (*ELB) CreateOrFail ¶
func (ELB) HostedZoneID ¶
func (*ELB) RegisterInstances ¶
type FSKeyPairProvider ¶
type FSKeyPairProvider struct {
// contains filtered or unexported fields
}
func NewFSKeyPairProvider ¶
func NewFSKeyPairProvider(pubKeyFile string) *FSKeyPairProvider
type FindInstancesInput ¶
type FindInstancesInput struct { Clients awsutil.Clients Logger micrologger.Logger Pattern string }
type Instance ¶
type Instance struct { Name string ClusterName string ImageID string InstanceType string KeyName string MinCount int MaxCount int UserData string SmallCloudconfig string IamInstanceProfileName string PlacementAZ string SecurityGroupID string SubnetID string PrivateIpAddress string // Dependencies. Logger micrologger.Logger AWSEntity // contains filtered or unexported fields }
func FindInstances ¶
func FindInstances(input FindInstancesInput) ([]*Instance, error)
func (*Instance) CreateIfNotExists ¶
func (*Instance) CreateOrFail ¶
type InstanceProfile ¶
type InstanceProfile struct { ClusterID string AWSEntity // contains filtered or unexported fields }
func (*InstanceProfile) CreateIfNotExists ¶
func (ip *InstanceProfile) CreateIfNotExists() (bool, error)
func (*InstanceProfile) CreateOrFail ¶
func (ip *InstanceProfile) CreateOrFail() error
func (*InstanceProfile) Delete ¶
func (ip *InstanceProfile) Delete() error
func (InstanceProfile) GetName ¶
func (ip InstanceProfile) GetName() string
type InternetGateway ¶
type InternetGateway struct { Name string VpcID string // Dependencies. Logger micrologger.Logger AWSEntity // contains filtered or unexported fields }
func (*InternetGateway) CreateIfNotExists ¶
func (g *InternetGateway) CreateIfNotExists() (bool, error)
func (*InternetGateway) CreateOrFail ¶
func (g *InternetGateway) CreateOrFail() error
func (*InternetGateway) Delete ¶
func (g *InternetGateway) Delete() error
func (InternetGateway) GetID ¶
func (g InternetGateway) GetID() (string, error)
type KeyPair ¶
type KeyPair struct { ClusterName string Provider KeyPairProvider AWSEntity }
func (*KeyPair) CreateIfNotExists ¶
func (*KeyPair) CreateOrFail ¶
type KeyPairProvider ¶
type KeyPairProvider interface {
// contains filtered or unexported methods
}
type LaunchConfiguration ¶
type LaunchConfiguration struct { AssociatePublicIpAddress bool EBSStorage bool IamInstanceProfileName string ImageID string InstanceType string KeyName string Name string SecurityGroupID string SmallCloudConfig string // Dependencies Client *autoscaling.AutoScaling }
LaunchConfiguration is a template for launching EC2 instances into an auto scaling group.
func (*LaunchConfiguration) CreateIfNotExists ¶
func (lc *LaunchConfiguration) CreateIfNotExists() (bool, error)
CreateIfNotExists creates the launch config if it doesn't exist.
func (*LaunchConfiguration) CreateOrFail ¶
func (lc *LaunchConfiguration) CreateOrFail() error
CreateOrFail creates the launch config or returns the error.
func (*LaunchConfiguration) Delete ¶
func (lc *LaunchConfiguration) Delete() error
Delete deletes the launch config.
type NatGateway ¶
type NatGateway struct { Name string Subnet *Subnet // Dependencies. Logger micrologger.Logger AWSEntity // contains filtered or unexported fields }
func (*NatGateway) CreateIfNotExists ¶
func (g *NatGateway) CreateIfNotExists() (bool, error)
func (*NatGateway) CreateOrFail ¶
func (g *NatGateway) CreateOrFail() error
func (*NatGateway) Delete ¶
func (g *NatGateway) Delete() error
func (NatGateway) GetID ¶
func (g NatGateway) GetID() (string, error)
type Policy ¶
type Policy struct { ClusterID string KMSKeyArn string PolicyType string S3Bucket string AWSEntity // contains filtered or unexported fields }
func (*Policy) CreateIfNotExists ¶
func (*Policy) CreateOrFail ¶
type PortPair ¶
type PortPair struct { // PortELB is the port the ELB should listen on. PortELB int // PortInstance is the port on the instance the ELB forwards traffic to. PortInstance int }
PortPair is a pair of ports.
type RecordSet ¶
type RecordSet struct { // Domain is the domain name for the record. Domain string // HostedZoneID is the ID of the Hosted Zone the record should be created in. HostedZoneID string Type string // Client is the AWS client. Client *route53.Route53 // Resource is the AWS resource the record should be created for. Resource resources.DNSNamedResource Value string }
func (RecordSet) CreateIfNotExists ¶
CreateIfNotExists is not implemented because AWS provides UPSERT functionality for DNS records
func (RecordSet) CreateOrFail ¶
type Route ¶
type Route struct { DestinationCidrBlock string VpcPeeringConnectionID string RouteTable RouteTable AWSEntity }
func (*Route) CreateIfNotExists ¶
func (*Route) CreateOrFail ¶
type RouteTable ¶
type RouteTable struct { Name string VpcID string // Dependencies. Client *ec2.EC2 Logger micrologger.Logger // contains filtered or unexported fields }
func (*RouteTable) CreateIfNotExists ¶
func (r *RouteTable) CreateIfNotExists() (bool, error)
func (RouteTable) CreateNatGatewayRoute ¶
func (r RouteTable) CreateNatGatewayRoute(natGatewayID string) (bool, error)
CreateNatGatewayRoute creates a default route to the NAT gateway for the private subnet. Retry is needed due to a delay while the gateway is created.
func (*RouteTable) CreateOrFail ¶
func (r *RouteTable) CreateOrFail() error
func (*RouteTable) Delete ¶
func (r *RouteTable) Delete() error
func (RouteTable) GetID ¶
func (r RouteTable) GetID() (string, error)
func (RouteTable) MakePublic ¶
func (r RouteTable) MakePublic() error
MakePublic creates a route that allows traffic from outside the VPC. To do that, it needs to add a route on the Internet Gateway of the VPC.
type SecurityGroup ¶
type SecurityGroup struct { Description string GroupName string VpcID string Rules []SecurityGroupRule // Dependencies. Logger micrologger.Logger AWSEntity // contains filtered or unexported fields }
SecurityGroup is an AWS security group.
func (SecurityGroup) ApplyRules ¶
func (s SecurityGroup) ApplyRules(rules []SecurityGroupRule) error
ApplyRules creates the security group rules.
func (*SecurityGroup) CreateIfNotExists ¶
func (s *SecurityGroup) CreateIfNotExists() (bool, error)
CreateIfNotExists creates the security group if it does not exist.
func (*SecurityGroup) CreateOrFail ¶
func (s *SecurityGroup) CreateOrFail() error
CreateOrFail creates the security group or returns an error.
func (*SecurityGroup) Delete ¶
func (s *SecurityGroup) Delete() error
Delete deletes the security group. A security group cannot be deleted if it references another securty group. So first we delete any rules referencing other groups.
func (SecurityGroup) GetID ¶
func (s SecurityGroup) GetID() (string, error)
GetID gets the AWS security group ID.
type SecurityGroupRule ¶
type SecurityGroupRule struct { // Port is the port to open. Port int // Protocol is the IP protocol. Protocol string // SourceCIDR is the CIDR of the source. SourceCIDR string // SecurityGroupID is the ID of the source Security Group. SecurityGroupID string }
SecurityGroupRule is an AWS security group rule.
type SecurityGroupRules ¶
SecurityGroupRules allows AWS security group rules to be deleted. Any rules referencing other security groups must be deleted before the group can be deleted.
func (SecurityGroupRules) Delete ¶
func (s SecurityGroupRules) Delete() error
Delete deletes any security group rules that reference other groups. This must happen before the security group can be deleted. Rules using a CIDR do not need to be deleted.
type Subnet ¶
type Subnet struct { AvailabilityZone string CidrBlock string Name string VpcID string ClusterName string // Dependencies. Logger micrologger.Logger AWSEntity // contains filtered or unexported fields }
func (*Subnet) AssociateRouteTable ¶
func (s *Subnet) AssociateRouteTable(routeTable *RouteTable) error
func (*Subnet) CreateIfNotExists ¶
func (*Subnet) CreateOrFail ¶
func (*Subnet) MakePublic ¶
type VPC ¶
type VPC struct { CidrBlock string InstallationName string Name string // Dependencies. Logger micrologger.Logger AWSEntity // contains filtered or unexported fields }
func (*VPC) CreateIfNotExists ¶
func (*VPC) CreateOrFail ¶
type VPCPeeringConnection ¶
type VPCPeeringConnection struct { VPCId string // VPCId is the ID of the VPC in the guest cluster. PeerVPCId string // PeerVPCId the ID of the VPC in the host cluster. AWSEntity Logger micrologger.Logger // contains filtered or unexported fields }
func (*VPCPeeringConnection) CreateIfNotExists ¶
func (v *VPCPeeringConnection) CreateIfNotExists() (bool, error)
func (*VPCPeeringConnection) CreateOrFail ¶
func (v *VPCPeeringConnection) CreateOrFail() error
func (*VPCPeeringConnection) Delete ¶
func (v *VPCPeeringConnection) Delete() error
func (VPCPeeringConnection) FindExisting ¶
func (v VPCPeeringConnection) FindExisting() (*ec2.VpcPeeringConnection, error)
func (*VPCPeeringConnection) GetID ¶
func (v *VPCPeeringConnection) GetID() (string, error)
Source Files ¶
- asg_stack.go
- auto_scaling_group.go
- backoff.go
- bucket.go
- bucket_object.go
- common.go
- consts.go
- elb.go
- errors.go
- instance.go
- internet_gateway.go
- key_pair.go
- kms.go
- launch_configuration.go
- nat_gateway.go
- peering.go
- policy.go
- profile.go
- record_set.go
- route.go
- route_table.go
- security_group.go
- security_group_rules.go
- subnet.go
- vpc.go