aws

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name of this builder provider
	Name                             = "aws"
	VpcID                     string = "vpc-id"
	SubnetID                  string = "subnet-id"
	InternetGwID              string = "internet-gateway-id"
	InternetGatewayAttachment string = "internet-gateway-attachment-vpc-id"
	RouteTable                string = "route-table-id"
	SecurityGroupID           string = "security-group-id"
	InstanceID                string = "instance-id"
	PublicDnsName             string = "public-dns-name"

	// Cluster networking cache keys
	PublicSubnetID        string = "public-subnet-id"
	NatGatewayID          string = "nat-gateway-id"
	PrivateRouteTable     string = "private-route-table-id"
	PublicRouteTable      string = "public-route-table-id"
	CPSecurityGroupID     string = "cp-security-group-id"
	WorkerSecurityGroupID string = "worker-security-group-id"
	EIPAllocationID       string = "eip-allocation-id"
	IAMInstanceProfileArn string = "iam-instance-profile-arn"
)

Variables

This section is empty.

Functions

func WithRetry added in v0.3.0

func WithRetry[T any](ctx context.Context, cfg RetryConfig, fn func() (T, error)) (T, error)

WithRetry executes fn with exponential backoff retry

Types

type AWS

type AWS struct {
	Vpcid                     string
	Subnetid                  string
	InternetGwid              string
	InternetGatewayAttachment string
	RouteTable                string
	SecurityGroupid           string
	Instanceid                string
	PublicDnsName             string

	// Cluster networking fields
	PublicSubnetid        string
	NatGatewayid          string
	PublicRouteTable      string
	CPSecurityGroupid     string
	WorkerSecurityGroupid string
	EIPAllocationid       string
	IAMInstanceProfileArn string
}

type ByCreationDate added in v0.2.0

type ByCreationDate []ImageInfo

func (ByCreationDate) Len added in v0.2.0

func (a ByCreationDate) Len() int

func (ByCreationDate) Less added in v0.2.0

func (a ByCreationDate) Less(i, j int) bool

func (ByCreationDate) Swap added in v0.2.0

func (a ByCreationDate) Swap(i, j int)

type ClusterCache added in v0.3.0

type ClusterCache struct {
	AWS

	// ControlPlaneInstances holds instance IDs for control-plane nodes
	ControlPlaneInstances []InstanceInfo
	// WorkerInstances holds instance IDs for worker nodes
	WorkerInstances []InstanceInfo

	// LoadBalancerArn is the ARN of the NLB for HA control plane
	LoadBalancerArn string
	// LoadBalancerDNS is the DNS name of the load balancer
	LoadBalancerDNS string
	// TargetGroupArn is the ARN of the target group for the load balancer
	TargetGroupArn string
}

ClusterCache extends AWS cache with multinode-specific resources

type ImageInfo added in v0.2.0

type ImageInfo struct {
	ImageID      string
	CreationDate string
}

type InstanceInfo added in v0.3.0

type InstanceInfo struct {
	InstanceID       string
	PublicIP         string
	PrivateIP        string
	PublicDNS        string
	NetworkInterface string
	Role             string // "control-plane" or "worker"
	Name             string
	SSHUsername      string // SSH username for this node's OS (e.g., "ubuntu", "ec2-user")
}

InstanceInfo holds information about a single instance

type NodeRole added in v0.3.0

type NodeRole string

NodeRole represents the role of a node in the cluster

const (
	NodeRoleControlPlane NodeRole = "control-plane"
	NodeRoleWorker       NodeRole = "worker"
)

type Option added in v0.3.0

type Option func(*Provider)

Option is a functional option for configuring the Provider.

func WithAMIResolver added in v0.3.0

func WithAMIResolver(resolver *ami.Resolver) Option

WithAMIResolver sets a custom AMI resolver for the Provider. This is primarily used for testing.

func WithEC2Client added in v0.3.0

func WithEC2Client(client internalaws.EC2Client) Option

WithEC2Client sets a custom EC2 client for the Provider. This is primarily used for testing to inject mock clients.

func WithELBv2Client added in v0.3.0

func WithELBv2Client(client internalaws.ELBv2Client) Option

WithELBv2Client sets a custom ELBv2 client for the Provider. This is primarily used for testing to inject mock clients.

func WithSSMClient added in v0.3.0

func WithSSMClient(client internalaws.SSMClient) Option

WithSSMClient sets a custom SSM client for the Provider. This is primarily used for testing to inject mock clients.

func WithSleep added in v0.3.0

func WithSleep(fn func(time.Duration)) Option

WithSleep sets a custom sleep function for the Provider. This is used in tests to eliminate real wall-clock delays.

type Provider added in v0.2.0

type Provider struct {
	Tags []types.Tag

	*v1alpha1.Environment
	// contains filtered or unexported fields
}

func New

func New(log *logger.FunLogger, env v1alpha1.Environment, cacheFile string,
	opts ...Option) (*Provider, error)

New creates a new AWS Provider with the given configuration. Optional functional options can be provided to customize the provider, such as injecting a mock EC2 client for testing.

func (*Provider) Create added in v0.2.0

func (p *Provider) Create() error

Create creates an EC2 instance with proper Network configuration VPC, Subnet, Internet Gateway, Route Table, Security Group If the environment specifies a cluster configuration, it delegates to CreateCluster()

func (*Provider) CreateCluster added in v0.3.0

func (p *Provider) CreateCluster() error

CreateCluster creates a multinode cluster with the specified configuration

func (*Provider) Delete added in v0.2.0

func (p *Provider) Delete() error

Delete deletes the EC2 instance and all associated resources

func (*Provider) DryRun added in v0.2.0

func (p *Provider) DryRun() error

func (*Provider) IsMultinode added in v0.3.0

func (p *Provider) IsMultinode() bool

IsMultinode returns true if the environment is configured for multinode cluster

func (*Provider) Name added in v0.2.0

func (p *Provider) Name() string

Name returns the name of the builder provisioner

func (*Provider) Status added in v0.2.4

func (p *Provider) Status() ([]metav1.Condition, error)

func (*Provider) UpdateResourcesTags added in v0.2.0

func (p *Provider) UpdateResourcesTags(tags map[string]string, resources ...string) error

Update updates an AWS resources tags

type ResolvedImage added in v0.3.0

type ResolvedImage struct {
	ImageID      string
	SSHUsername  string
	Architecture string // EC2 architecture: "x86_64" or "arm64"
}

ResolvedImage contains the resolved AMI information for instance creation.

type RetryConfig added in v0.3.0

type RetryConfig struct {
	MaxRetries     int
	InitialBackoff time.Duration
	MaxBackoff     time.Duration
}

RetryConfig configures retry behavior

func DefaultRetryConfig added in v0.3.0

func DefaultRetryConfig() RetryConfig

DefaultRetryConfig returns the default retry configuration

Jump to

Keyboard shortcuts

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