aws

package
v0.8.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	EksCniAddonVersion = "v1.12.5-eksbuild.2"
	EksVersion         = "1.26"
)

Variables

View Source
var AWSProps = &AWSProvisioner{}

Functions

func ConvertQcow2ToRaw

func ConvertQcow2ToRaw(qcow2 string, raw string) error

ConvertQcow2ToRaw Converts an qcow2 image to raw. Requires `qemu-img` installed.

func NewAWSProvisioner

func NewAWSProvisioner(properties map[string]string) (pv.CloudProvisioner, error)

NewAWSProvisioner instantiates the AWS provisioner

func NewAwsInstallOverlay

func NewAwsInstallOverlay(installDir, provider string) (pv.InstallOverlay, error)

Types

type AMIImage

type AMIImage struct {
	Client          *ec2.Client
	Description     string // Image description
	DiskDescription string // Disk description
	DiskFormat      string // Disk format
	EBSSnapshotId   string // EBS disk snapshot ID
	ID              string // AMI image ID
	RootDeviceName  string // Root device name
}

AMIImage represents an AMI image

func NewAMIImage

func NewAMIImage(client *ec2.Client, properties map[string]string) *AMIImage

type AWSProvisioner

type AWSProvisioner struct {
	AwsConfig aws.Config

	Cluster Cluster

	Bucket     *S3Bucket
	PauseImage string
	Image      *AMIImage
	Vpc        *Vpc
	VxlanPort  string
	SshKpName  string
	// contains filtered or unexported fields
}

AWSProvisioner implements the CloudProvision interface.

func (*AWSProvisioner) CreateCluster

func (a *AWSProvisioner) CreateCluster(ctx context.Context, cfg *envconf.Config) error

func (*AWSProvisioner) CreateVPC

func (a *AWSProvisioner) CreateVPC(ctx context.Context, cfg *envconf.Config) error

func (*AWSProvisioner) DeleteCluster

func (aws *AWSProvisioner) DeleteCluster(ctx context.Context, cfg *envconf.Config) error

func (*AWSProvisioner) DeleteVPC

func (a *AWSProvisioner) DeleteVPC(ctx context.Context, cfg *envconf.Config) error

func (*AWSProvisioner) GetProperties

func (a *AWSProvisioner) GetProperties(ctx context.Context, cfg *envconf.Config) map[string]string

func (*AWSProvisioner) UploadPodvm

func (a *AWSProvisioner) UploadPodvm(imagePath string, ctx context.Context, cfg *envconf.Config) error

type AwsInstallOverlay

type AwsInstallOverlay struct {
	Overlay *pv.KustomizeOverlay
}

AwsInstallOverlay implements the InstallOverlay interface

func (*AwsInstallOverlay) Apply

func (a *AwsInstallOverlay) Apply(ctx context.Context, cfg *envconf.Config) error

func (*AwsInstallOverlay) Delete

func (a *AwsInstallOverlay) Delete(ctx context.Context, cfg *envconf.Config) error

func (*AwsInstallOverlay) Edit

func (a *AwsInstallOverlay) Edit(ctx context.Context, cfg *envconf.Config, properties map[string]string) error

type Cluster

type Cluster interface {
	CreateCluster() error               // Create the Kubernetes cluster
	DeleteCluster() error               // Delete the Kubernetes cluster
	GetKubeconfigFile() (string, error) // Get the path to the kubeconfig file
}

Cluster defines create/delete/access interfaces to Kubernetes clusters

type EKSCluster

type EKSCluster struct {
	AwsConfig       aws.Config
	Client          *eks.Client
	ClusterRoleName string
	IamClient       *iam.Client
	Name            string
	NodeGroupName   string
	NodesRoleName   string
	NumWorkers      int32
	SshKpName       string
	Version         string
	Vpc             *Vpc
}

EKSCluster represents an EKS cluster

func NewEKSCluster

func NewEKSCluster(cfg aws.Config, vpc *Vpc, SshKpName string) *EKSCluster

NewEKSCluster instantiates a new EKS Cluster struct. It requires a AWS configuration with access and authentication information, a VPC already instantiated and with a public subnet, and an EC2 SSH key-pair used to access the cluster's worker nodes.

func (*EKSCluster) CreateCluster

func (e *EKSCluster) CreateCluster() error

CreateCluster creates a new EKS cluster. It will create needed roles, the cluster itself, nodes group and finally install add-ons. EKS should be created with at least two subnets so a secundary will be created If it does not exist on the VPC already.

func (*EKSCluster) CreateCniAddon

func (e *EKSCluster) CreateCniAddon(addonTimeout time.Duration) error

CreateCniAddon applies the AWS CNI addon

func (*EKSCluster) CreateEKSClusterRole

func (e *EKSCluster) CreateEKSClusterRole() (string, error)

CreateEKSClusterRole creates (if not exist) the needed role for EKS creation.

func (*EKSCluster) CreateEKSNodesRole

func (e *EKSCluster) CreateEKSNodesRole() (string, error)

CreateEKSNodesRole creates (if not exist) the needed role for the managed nodes creation.

func (*EKSCluster) DeleteCluster

func (e *EKSCluster) DeleteCluster() error

func (*EKSCluster) GetKubeconfigFile

func (e *EKSCluster) GetKubeconfigFile() (string, error)

GetKubeconfig returns a kubeconfig for the EKS cluster

type OnPremCluster

type OnPremCluster struct {
}

OnPremCluster represents an existing and running cluster

func NewOnPremCluster

func NewOnPremCluster() *OnPremCluster

func (*OnPremCluster) CreateCluster

func (o *OnPremCluster) CreateCluster() error

CreateCluster does nothing as the cluster should exist already.

func (*OnPremCluster) DeleteCluster

func (o *OnPremCluster) DeleteCluster() error

DeleteCluster does nothing.

func (*OnPremCluster) GetKubeconfigFile

func (o *OnPremCluster) GetKubeconfigFile() (string, error)

GetKubeconfigFile looks for the kubeconfig on the default locations

type S3Bucket

type S3Bucket struct {
	Client *s3.Client
	Name   string // Bucket name
	Key    string // Object key
}

S3Bucket represents an S3 bucket where the podvm image should be uploaded

type Vpc

type Vpc struct {
	BaseName          string
	CidrBlock         string
	Client            *ec2.Client
	ID                string
	InternetGatewayId string
	Region            string
	RouteTableId      string
	SecurityGroupId   string
	SubnetId          string
	SecondarySubnetId string
}

Vpc represents an AWS VPC

func NewVpc

func NewVpc(client *ec2.Client, properties map[string]string) *Vpc

Jump to

Keyboard shortcuts

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