api

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxRetries = 3
	AppName    = "amazon-vpc-resource-controller-k8s"
	SourceKey  = "x-amz-source-arn"
	AccountKey = "x-amz-source-account"
)
View Source
const (
	CreateENIDescriptionPrefix = "aws-k8s-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EC2APIHelper

type EC2APIHelper interface {
	AssociateBranchToTrunk(trunkInterfaceId *string, branchInterfaceId *string, vlanId int) (*ec2.AssociateTrunkInterfaceOutput, error)
	CreateNetworkInterface(description *string, subnetId *string, securityGroups []string, tags []*ec2.Tag,
		ipResourceCount *config.IPResourceCount, interfaceType *string) (*ec2.NetworkInterface, error)
	DeleteNetworkInterface(interfaceId *string) error
	GetSubnet(subnetId *string) (*ec2.Subnet, error)
	GetBranchNetworkInterface(trunkID, subnetID *string) ([]*ec2.NetworkInterface, error)
	GetInstanceNetworkInterface(instanceId *string) ([]*ec2.InstanceNetworkInterface, error)
	DescribeNetworkInterfaces(nwInterfaceIds []*string) ([]*ec2.NetworkInterface, error)
	DescribeTrunkInterfaceAssociation(trunkInterfaceId *string) ([]*ec2.TrunkInterfaceAssociation, error)
	CreateAndAttachNetworkInterface(instanceId *string, subnetId *string, securityGroups []string, tags []*ec2.Tag, deviceIndex *int64,
		description *string, interfaceType *string, ipResourceCount *config.IPResourceCount) (*ec2.NetworkInterface, error)
	AttachNetworkInterfaceToInstance(instanceId *string, nwInterfaceId *string, deviceIndex *int64) (*string, error)
	SetDeleteOnTermination(attachmentId *string, eniId *string) error
	DetachNetworkInterfaceFromInstance(attachmentId *string) error
	DetachAndDeleteNetworkInterface(attachmentId *string, nwInterfaceId *string) error
	WaitForNetworkInterfaceStatusChange(networkInterfaceId *string, desiredStatus string) error
	GetInstanceDetails(instanceId *string) (*ec2.Instance, error)
	AssignIPv4ResourcesAndWaitTillReady(eniID string, resourceType config.ResourceType, count int) ([]string, error)
	UnassignIPv4Resources(eniID string, resourceType config.ResourceType, resources []string) error
}

func NewEC2APIHelper

func NewEC2APIHelper(ec2Wrapper EC2Wrapper, clusterName string) EC2APIHelper

type EC2Wrapper

type EC2Wrapper interface {
	DescribeInstances(input *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
	CreateNetworkInterface(input *ec2.CreateNetworkInterfaceInput) (*ec2.CreateNetworkInterfaceOutput, error)
	AttachNetworkInterface(input *ec2.AttachNetworkInterfaceInput) (*ec2.AttachNetworkInterfaceOutput, error)
	DetachNetworkInterface(input *ec2.DetachNetworkInterfaceInput) (*ec2.DetachNetworkInterfaceOutput, error)
	DeleteNetworkInterface(input *ec2.DeleteNetworkInterfaceInput) (*ec2.DeleteNetworkInterfaceOutput, error)
	AssignPrivateIPAddresses(input *ec2.AssignPrivateIpAddressesInput) (*ec2.AssignPrivateIpAddressesOutput, error)
	UnassignPrivateIPAddresses(input *ec2.UnassignPrivateIpAddressesInput) (*ec2.UnassignPrivateIpAddressesOutput, error)
	DescribeNetworkInterfaces(input *ec2.DescribeNetworkInterfacesInput) (*ec2.DescribeNetworkInterfacesOutput, error)
	CreateTags(input *ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error)
	DescribeSubnets(input *ec2.DescribeSubnetsInput) (*ec2.DescribeSubnetsOutput, error)
	AssociateTrunkInterface(input *ec2.AssociateTrunkInterfaceInput) (*ec2.AssociateTrunkInterfaceOutput, error)
	DescribeTrunkInterfaceAssociations(input *ec2.DescribeTrunkInterfaceAssociationsInput) (*ec2.DescribeTrunkInterfaceAssociationsOutput, error)
	ModifyNetworkInterfaceAttribute(input *ec2.ModifyNetworkInterfaceAttributeInput) (*ec2.ModifyNetworkInterfaceAttributeOutput, error)
	CreateNetworkInterfacePermission(input *ec2.CreateNetworkInterfacePermissionInput) (*ec2.CreateNetworkInterfacePermissionOutput, error)
}

func NewEC2Wrapper

func NewEC2Wrapper(roleARN, clusterName, region string, log logr.Logger) (EC2Wrapper, error)

NewEC2Wrapper takes the roleARN that will be assumed to make all the EC2 API Calls, if no roleARN is passed then the ec2 client will be initialized with the instance's service role account.

type ENICleaner

type ENICleaner struct {
	EC2Wrapper  EC2Wrapper
	ClusterName string
	Log         logr.Logger
	VPCID       string
	// contains filtered or unexported fields
}

func (*ENICleaner) SetupWithManager added in v1.1.0

func (e *ENICleaner) SetupWithManager(ctx context.Context, mgr ctrl.Manager, healthzHandler *rcHealthz.HealthzHandler) error

func (*ENICleaner) Start

func (e *ENICleaner) Start(ctx context.Context) error

StartENICleaner starts the ENI Cleaner routine that cleans up dangling ENIs created by the controller

Jump to

Keyboard shortcuts

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