vpc

package
v0.0.0-...-ee2d30e Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupNetworkInterfaces

func CleanupNetworkInterfaces(ctx context.Context, ec2API awsapi.EC2, spec *api.ClusterConfig) error

CleanupNetworkInterfaces finds and deletes any dangling ENIs

func DiscoverZoneTypes

func DiscoverZoneTypes(ctx context.Context, ec2API awsapi.EC2, region string) (map[string]ZoneType, error)

DiscoverZoneTypes returns a map of zone names to zone type.

func EnsureMapPublicIPOnLaunchEnabled

func EnsureMapPublicIPOnLaunchEnabled(ctx context.Context, ec2API awsapi.EC2, subnetIDs []string) error

EnsureMapPublicIPOnLaunchEnabled will enable MapPublicIpOnLaunch in EC2 for all given subnet IDs

func ImportSubnets

func ImportSubnets(ctx context.Context, ec2API awsapi.EC2, spec *api.ClusterConfig, subnetMapping api.AZSubnetMapping, subnets []ec2types.Subnet, makeSubnetAlias MakeSubnetAlias) error

ImportSubnets will update spec with subnets, if VPC ID/CIDR is unknown it will use provider to call describeVPC based on the VPC ID of the first subnet; all subnets must be in the same VPC. It imports the specified subnets into ClusterConfig and sets the AZs and local zones used by those subnets. NOTE: it does respect all fields set in spec.VPC, and will error if there is a mismatch of local vs remote states

func ImportSubnetsByIDsWithAlias

func ImportSubnetsByIDsWithAlias(ctx context.Context, ec2API awsapi.EC2, spec *api.ClusterConfig, subnetMapping api.AZSubnetMapping, subnetIDs []string, makeSubnetAlias MakeSubnetAlias) error

ImportSubnetsByIDsWithAlias is like ImportSubnetsFromIDList but allows passing a function that generates an alias for a subnet.

func ImportSubnetsFromIDList

func ImportSubnetsFromIDList(ctx context.Context, ec2API awsapi.EC2, spec *api.ClusterConfig, subnetMapping api.AZSubnetMapping, subnetIDs []string) error

ImportSubnetsFromIDList will update cluster config with subnets _only specified by ID_ then pass resulting subnets to ImportSubnets NOTE: it does respect all fields set in spec.VPC, and will error if there is a mismatch of local vs remote states

func ImportSubnetsFromSpec

func ImportSubnetsFromSpec(ctx context.Context, provider api.ClusterProvider, spec *api.ClusterConfig) error

ImportSubnetsFromSpec will update spec with subnets, it will call describeSubnets first, then pass resulting subnets to ImportSubnets NOTE: it does respect all fields set in spec.VPC, and will error if there is a mismatch of local vs remote states

func MakeExtendedSubnetAlias

func MakeExtendedSubnetAlias(az string, ordinal int) string

MakeExtendedSubnetAlias generates an alias for a subnet that was added as part of extending the VPC with Outpost subnets.

func SelectNodeGroupSubnets

func SelectNodeGroupSubnets(ctx context.Context, np api.NodePool, clusterConfig *api.ClusterConfig, ec2API awsapi.EC2) ([]string, error)

SelectNodeGroupSubnets returns the subnet IDs to use for a nodegroup from the specified availability zones, local zones, and subnets.

func SetSubnets

func SetSubnets(vpc *api.ClusterVPC, availabilityZones, localZones []string) error

SetSubnets defines CIDRs for each of the subnets, it must be called after SetAvailabilityZones.

func SplitInto

func SplitInto(parent *net.IPNet, size, networkLength int) ([]*net.IPNet, error)

func UseEndpointAccessFromCluster

func UseEndpointAccessFromCluster(ctx context.Context, provider api.ClusterProvider, spec *api.ClusterConfig) error

UseEndpointAccessFromCluster retrieves the Cluster's endpoint access configuration via the SDK as the CloudFormation Stack doesn't support that configuration currently

func UseFromClusterStack

func UseFromClusterStack(ctx context.Context, provider api.ClusterProvider, stack *types.Stack, spec *api.ClusterConfig) error

UseFromClusterStack retrieves the VPC configuration from an existing cluster based on stack outputs NOTE: it doesn't expect any fields in spec.VPC to be set, the remote state is treated as the source of truth

func ValidateExistingPublicSubnets

func ValidateExistingPublicSubnets(ctx context.Context, provider api.ClusterProvider, vpcID string, subnetIDs []string) error

ValidateExistingPublicSubnets makes sure that subnets have the property MapPublicIpOnLaunch enabled

func ValidateLegacySubnetsForNodeGroups

func ValidateLegacySubnetsForNodeGroups(ctx context.Context, spec *api.ClusterConfig, provider api.ClusterProvider) error

Types

type Importer

type Importer interface {
	VPC() *gfnt.Value
	ClusterSecurityGroup() *gfnt.Value
	ControlPlaneSecurityGroup() *gfnt.Value
	SharedNodeSecurityGroup() *gfnt.Value
	SecurityGroups() gfnt.Slice
	SubnetsPublic() *gfnt.Value
	SubnetsPrivate() *gfnt.Value
}

type MakeSubnetAlias

type MakeSubnetAlias func(*ec2types.Subnet) string

func MakeExtendedSubnetAliasFunc

func MakeExtendedSubnetAliasFunc() MakeSubnetAlias

MakeExtendedSubnetAliasFunc returns a function for creating an alias for a subnet that was added as part of extending the VPC with Outpost subnets.

type SpecConfigImporter

type SpecConfigImporter struct {
	// contains filtered or unexported fields
}

SpecConfigImporter returns VPC info based on the ClusterConfig Spec

func NewSpecConfigImporter

func NewSpecConfigImporter(securityGroup string, vpc *api.ClusterVPC) *SpecConfigImporter

NewSpecConfigImporter creates a new SpecConfigImporter instance

func (*SpecConfigImporter) ClusterSecurityGroup

func (si *SpecConfigImporter) ClusterSecurityGroup() *gfnt.Value

ClusterSecurityGroup returns the gfnt value of the default cluser security group

func (*SpecConfigImporter) ControlPlaneSecurityGroup

func (si *SpecConfigImporter) ControlPlaneSecurityGroup() *gfnt.Value

ControlPlaneSecurityGroup returns the gfnt value of the cluster config VPC securityGroup

func (*SpecConfigImporter) SecurityGroups

func (si *SpecConfigImporter) SecurityGroups() gfnt.Slice

SecurityGroups returns a gfnt slice of the ClusterSecurityGroup

func (*SpecConfigImporter) SharedNodeSecurityGroup

func (si *SpecConfigImporter) SharedNodeSecurityGroup() *gfnt.Value

SharedNodeSecurityGroup returns the gfnt value of the cluster config VPC sharedNodeSecurityGroup if it is set. If not, it returns the default cluster security group

func (*SpecConfigImporter) SubnetsPrivate

func (si *SpecConfigImporter) SubnetsPrivate() *gfnt.Value

SubnetsPrivate returns a gfnt string slice of the Private subnets from the cluster config VPC subnets spec

func (*SpecConfigImporter) SubnetsPublic

func (si *SpecConfigImporter) SubnetsPublic() *gfnt.Value

SubnetsPublic returns a gfnt string slice of the Public subnets from the cluster config VPC subnets spec

func (*SpecConfigImporter) VPC

func (si *SpecConfigImporter) VPC() *gfnt.Value

VPC returns the gfnt value of the cluster config VPC ID

type StackConfigImporter

type StackConfigImporter struct {
	// contains filtered or unexported fields
}

StackConfigImporter returns VPC info based on the Cluster Stack

func NewStackConfigImporter

func NewStackConfigImporter(clusterStackName string) *StackConfigImporter

NewStackConfigImporter creates a new StackConfigImporter instance

func (*StackConfigImporter) ClusterSecurityGroup

func (si *StackConfigImporter) ClusterSecurityGroup() *gfnt.Value

ClusterSecurityGroup returns a gfnt value based on the cluster stack name and the default security group from the cluster stack output

func (*StackConfigImporter) ControlPlaneSecurityGroup

func (si *StackConfigImporter) ControlPlaneSecurityGroup() *gfnt.Value

ControlPlaneSecurityGroup returns a gfnt value based on the cluster stack name and the control plane security group from the cluster stack output

func (*StackConfigImporter) SecurityGroups

func (si *StackConfigImporter) SecurityGroups() gfnt.Slice

SecurityGroups returns a gfnt slice based on the cluster stack name and the default security group from the cluster stack output

func (*StackConfigImporter) SharedNodeSecurityGroup

func (si *StackConfigImporter) SharedNodeSecurityGroup() *gfnt.Value

SharedNodeSecurityGroup returns a gfnt value based on the cluster stack name and the shared node security group from the cluster stack output

func (*StackConfigImporter) SubnetsPrivate

func (si *StackConfigImporter) SubnetsPrivate() *gfnt.Value

SubnetsPrivate returns a gfnt value based on the cluster stack name and the private subnets from the cluster stack output

func (*StackConfigImporter) SubnetsPublic

func (si *StackConfigImporter) SubnetsPublic() *gfnt.Value

SubnetsPublic returns a gfnt value based on the cluster stack name and the public subnets from the cluster stack output

func (*StackConfigImporter) VPC

func (si *StackConfigImporter) VPC() *gfnt.Value

VPC returns a gfnt value based on the cluster stack name and the VPC from the cluster stack output

type SubnetPair

type SubnetPair struct {
	Public  []api.AZSubnetSpec
	Private []api.AZSubnetSpec
}

A SubnetPair represents a pair of public and private subnets.

func ExtendWithOutpostSubnets

func ExtendWithOutpostSubnets(vpcCIDR net.IPNet, existingSubnetsCount int, outpostARN, outpostAZ string) (*SubnetPair, error)

ExtendWithOutpostSubnets extends the VPC by returning public and private subnet CIDRs for Outposts.

type ZoneType

type ZoneType int

ZoneType represents the AWS zone type

const (
	ZoneTypeAvailabilityZone ZoneType = iota
	ZoneTypeLocalZone
)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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