vpc

package
v0.155.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 22 Imported by: 20

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 added in v0.97.0

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 added in v0.112.0

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 added in v0.39.0

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 added in v0.39.0

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 added in v0.112.0

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 added in v0.112.0

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 added in v0.40.0

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 added in v0.40.0

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 added in v0.112.0

type MakeSubnetAlias func(*ec2types.Subnet) string

func MakeExtendedSubnetAliasFunc added in v0.112.0

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 added in v0.40.0

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

SpecConfigImporter returns VPC info based on the ClusterConfig Spec

func NewSpecConfigImporter added in v0.40.0

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

NewSpecConfigImporter creates a new SpecConfigImporter instance

func (*SpecConfigImporter) ClusterSecurityGroup added in v0.40.0

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

ClusterSecurityGroup returns the gfnt value of the default cluser security group

func (*SpecConfigImporter) ControlPlaneSecurityGroup added in v0.40.0

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

ControlPlaneSecurityGroup returns the gfnt value of the cluster config VPC securityGroup

func (*SpecConfigImporter) SecurityGroups added in v0.40.0

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

SecurityGroups returns a gfnt slice of the ClusterSecurityGroup

func (*SpecConfigImporter) SharedNodeSecurityGroup added in v0.40.0

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 added in v0.40.0

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 added in v0.40.0

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 added in v0.40.0

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

VPC returns the gfnt value of the cluster config VPC ID

type StackConfigImporter added in v0.40.0

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

StackConfigImporter returns VPC info based on the Cluster Stack

func NewStackConfigImporter added in v0.40.0

func NewStackConfigImporter(clusterStackName string) *StackConfigImporter

NewStackConfigImporter creates a new StackConfigImporter instance

func (*StackConfigImporter) ClusterSecurityGroup added in v0.40.0

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 added in v0.40.0

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 added in v0.40.0

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 added in v0.40.0

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 added in v0.40.0

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 added in v0.40.0

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 added in v0.40.0

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 added in v0.112.0

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

A SubnetPair represents a pair of public and private subnets.

func ExtendWithOutpostSubnets added in v0.112.0

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 added in v0.97.0

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