infraflow

package
v1.46.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0, MIT Imports: 24 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"
	// 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"
	// 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"
)
View Source
const (
	// PersistentStateVersion is the current version used for persisting the state.
	PersistentStateVersion = "v1alpha1"
	// PersistentStateAPIVersion is the APIVersion used for the persistent state
	PersistentStateAPIVersion = aws.GroupName + "/" + PersistentStateVersion
	// PersistentStateKind is the kind name for the persistent state
	PersistentStateKind = "FlowState"
)

Variables

This section is empty.

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.

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(log logr.Logger, awsClient awsclient.Interface,
	infra *extensionsv1alpha1.Infrastructure, config *awsapi.InfrastructureConfig,
	oldState shared.FlatMap, persistor shared.FlowStatePersistor) (*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 PersistentState

type PersistentState struct {
	metav1.TypeMeta

	Data map[string]string `json:"data"`
}

PersistentState is the state which is persisted as part of the infrastructure status.

func NewPersistentState

func NewPersistentState() *PersistentState

NewPersistentState creates empty PersistentState

func NewPersistentStateFromFlatMap

func NewPersistentStateFromFlatMap(flatState shared.FlatMap) *PersistentState

NewPersistentStateFromFlatMap create new PersistentState and initialises data from input.

func NewPersistentStateFromJSON

func NewPersistentStateFromJSON(raw []byte) (*PersistentState, error)

NewPersistentStateFromJSON unmarshals PersistentState from JSON or YAML. Returns nil if input contains no kind field with value "FlowState".

func (*PersistentState) HasValidVersion

func (s *PersistentState) HasValidVersion() (valid bool, err error)

HasValidVersion checks if flow version is supported.

func (*PersistentState) MigratedFromTerraform

func (s *PersistentState) MigratedFromTerraform() bool

MigratedFromTerraform returns trus if marker MarkerMigratedFromTerraform is set.

func (*PersistentState) SetMigratedFromTerraform

func (s *PersistentState) SetMigratedFromTerraform()

SetMigratedFromTerraform sets the marker MarkerMigratedFromTerraform

func (*PersistentState) SetTerraformCleanedUp

func (s *PersistentState) SetTerraformCleanedUp()

SetTerraformCleanedUp sets the marker MarkerTerraformCleanedUp

func (*PersistentState) TerraformCleanedUp

func (s *PersistentState) TerraformCleanedUp() bool

TerraformCleanedUp returns trus if marker MarkerTerraformCleanedUp is set.

func (*PersistentState) ToFlatMap

func (s *PersistentState) ToFlatMap() shared.FlatMap

ToFlatMap returns a copy of state as FlatMap

func (*PersistentState) ToJSON

func (s *PersistentState) ToJSON() ([]byte, error)

ToJSON marshals state as JSON

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