infraflow

package
v1.58.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TagKeyName is the name tag key
	TagKeyName = "Name"
	// TagKeyClusterTemplate is the template for the cluster tag key
	TagKeyClusterTemplate = "kubernetes.io/cluster/%s"
	// TagKeyRolePublicELB is the tag key for the public ELB
	TagKeyRolePublicELB = "kubernetes.io/role/elb"
	// TagKeyRolePrivateELB is the tag key for the internal ELB
	TagKeyRolePrivateELB = "kubernetes.io/role/internal-elb"
	// TagValueCluster is the tag value for the cluster tag
	TagValueCluster = "1"
	// TagValueELB is the tag value for the ELB tag keys
	TagValueELB = "1"

	// IdentifierVPC is the key for the VPC id
	IdentifierVPC = "VPC"
	// IdentifierDHCPOptions is the key for the id of the DHCPOptions resource
	IdentifierDHCPOptions = "DHCPOptions"
	// IdentifierDefaultSecurityGroup is the key for the id of the default security group
	IdentifierDefaultSecurityGroup = "DefaultSecurityGroup"
	// IdentifierInternetGateway is the key for the id of the internet gateway resource
	IdentifierInternetGateway = "InternetGateway"
	// IdentifierEgressOnlyInternetGateway is the key for the id of the internet gateway resource
	IdentifierEgressOnlyInternetGateway = "EgressOnlyInternetGateway"
	// IdentifierMainRouteTable is the key for the id of the main route table
	IdentifierMainRouteTable = "MainRouteTable"
	// IdentifierNodesSecurityGroup is the key for the id of the nodes security group
	IdentifierNodesSecurityGroup = "NodesSecurityGroup"
	// IdentifierZoneSubnetWorkers is the key for the id of the workers subnet
	IdentifierZoneSubnetWorkers = "SubnetWorkers"
	// IdentifierZoneSubnetPublic is the key for the id of the public utility subnet
	IdentifierZoneSubnetPublic = "SubnetPublicUtility"
	// IdentifierZoneSubnetPrivate is the key for the id of the private utility subnet
	IdentifierZoneSubnetPrivate = "SubnetPrivateUtility"
	// IdentifierZoneSuffix is the key for the suffix used for a zone
	IdentifierZoneSuffix = "Suffix"
	// IdentifierZoneNATGWElasticIP is the key for the id of the elastic IP resource used for the NAT gateway
	IdentifierZoneNATGWElasticIP = "NATGatewayElasticIP"
	// IdentifierZoneNATGateway is the key for the id of the NAT gateway resource
	IdentifierZoneNATGateway = "NATGateway"
	// IdentifierZoneRouteTable is the key for the id of route table of the zone
	IdentifierZoneRouteTable = "ZoneRouteTable"
	// IdentifierZoneSubnetPublicRouteTableAssoc is the key for the id of the public route table association resource
	IdentifierZoneSubnetPublicRouteTableAssoc = "SubnetPublicRouteTableAssoc"
	// IdentifierZoneSubnetPrivateRouteTableAssoc is the key for the id of the private c route table association resource
	IdentifierZoneSubnetPrivateRouteTableAssoc = "SubnetPrivateRouteTableAssoc"
	// IdentifierZoneSubnetWorkersRouteTableAssoc is key for the id of the workers route table association resource
	IdentifierZoneSubnetWorkersRouteTableAssoc = "SubnetWorkersRouteTableAssoc"
	// IdentifierVpcIPv6CidrBlock is the IPv6 CIDR block attached to the vpc
	IdentifierVpcIPv6CidrBlock = "VPCIPv6CidrBlock"
	// IdentifierEgressCIDRs is the key for the slice containing egress CIDRs strings.
	IdentifierEgressCIDRs = "EgressCIDRs"
	// IdentifierServiceCIDR is the key for the subnet cidr reservation for the service range.
	IdentifierServiceCIDR = "ServiceCIDR"
	// NameIAMRole is the key for the name of the IAM role
	NameIAMRole = "IAMRoleName"
	// NameIAMInstanceProfile is the key for the name of the IAM instance profile
	NameIAMInstanceProfile = "IAMInstanceProfileName"
	// NameIAMRolePolicy is the key for the name of the IAM role policy
	NameIAMRolePolicy = "IAMRolePolicyName"
	// NameKeyPair is the key for the name of the EC2 key pair resource
	NameKeyPair = "KeyPair"
	// ARNIAMRole is the key for the ARN of the IAM role
	ARNIAMRole = "IAMRoleARN"
	// KeyPairFingerprint is the key to store the fingerprint of the key pair
	KeyPairFingerprint = "KeyPairFingerprint"
	// KeyPairSpecFingerprint is the key to store the fingerprint of the public key from the spec
	KeyPairSpecFingerprint = "KeyPairSpecFingerprint"

	// ChildIdVPCEndpoints is the child key for the VPC endpoints
	ChildIdVPCEndpoints = "VPCEndpoints"
	// ChildIdZones is the child key for the zones
	ChildIdZones = "Zones"

	// ObjectMainRouteTable is the object key used for caching the main route table object
	ObjectMainRouteTable = "MainRouteTable"
	// ObjectZoneRouteTable is the object key used for caching the zone route table object
	ObjectZoneRouteTable = "ZoneRouteTable"

	// MarkerMigratedFromTerraform is the key for marking the state for successful state migration from Terraformer
	MarkerMigratedFromTerraform = "MigratedFromTerraform"
	// MarkerTerraformCleanedUp is the key for marking the state for successful cleanup of Terraformer resources.
	MarkerTerraformCleanedUp = "TerraformCleanedUp"
	// MarkerLoadBalancersAndSecurityGroupsDestroyed is the key for marking the state that orphan load balancers
	// and security groups have already been destroyed
	MarkerLoadBalancersAndSecurityGroupsDestroyed = "LoadBalancersAndSecurityGroupsDestroyed"
)

Variables

View Source
var ErrorMultipleMatches = fmt.Errorf("error multiple matches")

Functions

func DestroyKubernetesLoadBalancersAndSecurityGroups

func DestroyKubernetesLoadBalancersAndSecurityGroups(ctx context.Context, awsClient awsclient.Interface, vpcID, clusterName string) error

DestroyKubernetesLoadBalancersAndSecurityGroups tries to delete orphaned load balancers and security groups.

func FindExisting added in v1.57.0

func FindExisting[T any](ctx context.Context, id *string, tags awsclient.Tags,
	getter func(ctx context.Context, id string) (*T, error),
	finder func(ctx context.Context, tags awsclient.Tags) ([]*T, error),
	selector ...func(item *T) bool) (*T, error)

func PatchProviderStatusAndState added in v1.57.0

func PatchProviderStatusAndState(
	ctx context.Context,
	runtimeClient client.Client,
	infra *extensionsv1alpha1.Infrastructure,
	status *awsv1alpha1.InfrastructureStatus,
	state *runtime.RawExtension,
	egressCIDRs []string,
	vpcIPv6CidrBlock *string,
	serviceCIDR *string,
) error

Types

type FlowContext

type FlowContext struct {
	*shared.BasicFlowContext
	// contains filtered or unexported fields
}

FlowContext contains the logic to reconcile or delete the AWS infrastructure.

func NewFlowContext

func NewFlowContext(opts Opts) (*FlowContext, error)

NewFlowContext creates a new FlowContext object

func (*FlowContext) Delete

func (c *FlowContext) Delete(ctx context.Context) error

Delete creates and runs the flow to delete the AWS infrastructure.

func (*FlowContext) GetInfrastructureConfig

func (c *FlowContext) GetInfrastructureConfig() *awsapi.InfrastructureConfig

GetInfrastructureConfig returns the InfrastructureConfig object

func (*FlowContext) Reconcile

func (c *FlowContext) Reconcile(ctx context.Context) error

Reconcile creates and runs the flow to reconcile the AWS infrastructure.

type Opts added in v1.57.0

type Opts struct {
	Log            logr.Logger
	ClientFactory  awsclient.Interface
	Infrastructure *extensionsv1alpha1.Infrastructure
	State          *awsapi.InfrastructureState
	AwsClient      awsclient.Interface
	RuntimeClient  client.Client
	IPFamilies     []v1beta1.IPFamily
}

Opts contain options to initialize a FlowContext

type ZoneSuffixHelper

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

ZoneSuffixHelper provides methods to create suffices for various resources

func (*ZoneSuffixHelper) GetSuffixElasticIP

func (h *ZoneSuffixHelper) GetSuffixElasticIP() string

GetSuffixElasticIP builds the suffix for the elastic IP of the NAT gateway

func (*ZoneSuffixHelper) GetSuffixNATGateway

func (h *ZoneSuffixHelper) GetSuffixNATGateway() string

GetSuffixNATGateway builds the suffix for the NAT gateway

func (*ZoneSuffixHelper) GetSuffixSubnetPrivate

func (h *ZoneSuffixHelper) GetSuffixSubnetPrivate() string

GetSuffixSubnetPrivate builds the suffix for the private utility subnet

func (*ZoneSuffixHelper) GetSuffixSubnetPublic

func (h *ZoneSuffixHelper) GetSuffixSubnetPublic() string

GetSuffixSubnetPublic builds the suffix for the public utility subnet

func (*ZoneSuffixHelper) GetSuffixSubnetWorkers

func (h *ZoneSuffixHelper) GetSuffixSubnetWorkers() string

GetSuffixSubnetWorkers builds the suffix for the workers subnet

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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