ec2config

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 24 Imported by: 4

README

*-------------------------------------------------------*-------------------*--------------------------------------------------*--------------------------*
|                ENVIRONMENTAL VARIABLE                 |     READ ONLY     |                       TYPE                       |         GO TYPE          |
*-------------------------------------------------------*-------------------*--------------------------------------------------*--------------------------*
| AWS_K8S_TESTER_EC2_UP                                 | read-only "false" | *ec2config.Config.Up                             | bool                     |
| AWS_K8S_TESTER_EC2_TIME_FRAME_CREATE                  | read-only "true"  | *ec2config.Config.TimeFrameCreate                | timeutil.TimeFrame       |
| AWS_K8S_TESTER_EC2_TIME_FRAME_DELETE                  | read-only "true"  | *ec2config.Config.TimeFrameDelete                | timeutil.TimeFrame       |
| AWS_K8S_TESTER_EC2_STATUS_CURRENT                     | read-only "false" | *ec2config.Config.StatusCurrent                  | string                   |
| AWS_K8S_TESTER_EC2_STATUS                             | read-only "false" | *ec2config.Config.Status                         | []ec2config.Status       |
| AWS_K8S_TESTER_EC2_DELETED_RESOURCES                  | read-only "false" | *ec2config.Config.DeletedResources               | map[string]string        |
| AWS_K8S_TESTER_EC2_NAME                               | read-only "false" | *ec2config.Config.Name                           | string                   |
| AWS_K8S_TESTER_EC2_PARTITION                          | read-only "false" | *ec2config.Config.Partition                      | string                   |
| AWS_K8S_TESTER_EC2_REGION                             | read-only "false" | *ec2config.Config.Region                         | string                   |
| AWS_K8S_TESTER_EC2_AVAILABILITY_ZONE_NAMES            | read-only "true"  | *ec2config.Config.AvailabilityZoneNames          | []string                 |
| AWS_K8S_TESTER_EC2_CONFIG_PATH                        | read-only "false" | *ec2config.Config.ConfigPath                     | string                   |
| AWS_K8S_TESTER_EC2_AWS_ACCOUNT_ID                     | read-only "true"  | *ec2config.Config.AWSAccountID                   | string                   |
| AWS_K8S_TESTER_EC2_AWS_USER_ID                        | read-only "true"  | *ec2config.Config.AWSUserID                      | string                   |
| AWS_K8S_TESTER_EC2_AWS_IAM_ROLE_ARN                   | read-only "true"  | *ec2config.Config.AWSIAMRoleARN                  | string                   |
| AWS_K8S_TESTER_EC2_AWS_CREDENTIAL_PATH                | read-only "true"  | *ec2config.Config.AWSCredentialPath              | string                   |
| AWS_K8S_TESTER_EC2_LOG_COLOR                          | read-only "false" | *ec2config.Config.LogColor                       | bool                     |
| AWS_K8S_TESTER_EC2_LOG_COLOR_OVERRIDE                 | read-only "false" | *ec2config.Config.LogColorOverride               | string                   |
| AWS_K8S_TESTER_EC2_LOG_LEVEL                          | read-only "false" | *ec2config.Config.LogLevel                       | string                   |
| AWS_K8S_TESTER_EC2_LOG_OUTPUTS                        | read-only "false" | *ec2config.Config.LogOutputs                     | []string                 |
| AWS_K8S_TESTER_EC2_ON_FAILURE_DELETE                  | read-only "false" | *ec2config.Config.OnFailureDelete                | bool                     |
| AWS_K8S_TESTER_EC2_ON_FAILURE_DELETE_WAIT_SECONDS     | read-only "false" | *ec2config.Config.OnFailureDeleteWaitSeconds     | uint64                   |
| AWS_K8S_TESTER_EC2_REMOTE_ACCESS_KEY_CREATE           | read-only "false" | *ec2config.Config.RemoteAccessKeyCreate          | bool                     |
| AWS_K8S_TESTER_EC2_REMOTE_ACCESS_KEY_NAME             | read-only "false" | *ec2config.Config.RemoteAccessKeyName            | string                   |
| AWS_K8S_TESTER_EC2_REMOTE_ACCESS_PRIVATE_KEY_PATH     | read-only "false" | *ec2config.Config.RemoteAccessPrivateKeyPath     | string                   |
| AWS_K8S_TESTER_EC2_REMOTE_ACCESS_COMMANDS_OUTPUT_PATH | read-only "false" | *ec2config.Config.RemoteAccessCommandsOutputPath | string                   |
| AWS_K8S_TESTER_EC2_ASGS_FETCH_LOGS                    | read-only "false" | *ec2config.Config.ASGsFetchLogs                  | bool                     |
| AWS_K8S_TESTER_EC2_ASGS_LOGS_DIR                      | read-only "false" | *ec2config.Config.ASGsLogsDir                    | string                   |
| AWS_K8S_TESTER_EC2_ASGS                               | read-only "false" | *ec2config.Config.ASGs                           | map[string]ec2config.ASG |
| AWS_K8S_TESTER_EC2_TOTAL_NODES                        | read-only "true"  | *ec2config.Config.TotalNodes                     | int32                    |
*-------------------------------------------------------*-------------------*--------------------------------------------------*--------------------------*


*--------------------------------------------------------*-------------------*---------------------------------------------*---------*
|                 ENVIRONMENTAL VARIABLE                 |     READ ONLY     |                    TYPE                     | GO TYPE |
*--------------------------------------------------------*-------------------*---------------------------------------------*---------*
| AWS_K8S_TESTER_EC2_S3_BUCKET_CREATE                    | read-only "false" | *ec2config.S3.BucketCreate                  | bool    |
| AWS_K8S_TESTER_EC2_S3_BUCKET_CREATE_KEEP               | read-only "false" | *ec2config.S3.BucketCreateKeep              | bool    |
| AWS_K8S_TESTER_EC2_S3_BUCKET_NAME                      | read-only "false" | *ec2config.S3.BucketName                    | string  |
| AWS_K8S_TESTER_EC2_S3_BUCKET_LIFECYCLE_EXPIRATION_DAYS | read-only "false" | *ec2config.S3.BucketLifecycleExpirationDays | int64   |
| AWS_K8S_TESTER_EC2_S3_DIR                              | read-only "false" | *ec2config.S3.Dir                           | string  |
*--------------------------------------------------------*-------------------*---------------------------------------------*---------*


*-----------------------------------------------*-------------------*-------------------------------------*----------*
|            ENVIRONMENTAL VARIABLE             |     READ ONLY     |                TYPE                 | GO TYPE  |
*-----------------------------------------------*-------------------*-------------------------------------*----------*
| AWS_K8S_TESTER_EC2_ROLE_NAME                  | read-only "false" | *ec2config.Role.Name                | string   |
| AWS_K8S_TESTER_EC2_ROLE_CREATE                | read-only "false" | *ec2config.Role.Create              | bool     |
| AWS_K8S_TESTER_EC2_ROLE_ARN                   | read-only "false" | *ec2config.Role.ARN                 | string   |
| AWS_K8S_TESTER_EC2_ROLE_SERVICE_PRINCIPALS    | read-only "false" | *ec2config.Role.ServicePrincipals   | []string |
| AWS_K8S_TESTER_EC2_ROLE_MANAGED_POLICY_ARNS   | read-only "false" | *ec2config.Role.ManagedPolicyARNs   | []string |
| AWS_K8S_TESTER_EC2_ROLE_POLICY_NAME           | read-only "true"  | *ec2config.Role.PolicyName          | string   |
| AWS_K8S_TESTER_EC2_ROLE_POLICY_ARN            | read-only "true"  | *ec2config.Role.PolicyARN           | string   |
| AWS_K8S_TESTER_EC2_ROLE_INSTANCE_PROFILE_NAME | read-only "true"  | *ec2config.Role.InstanceProfileName | string   |
| AWS_K8S_TESTER_EC2_ROLE_INSTANCE_PROFILE_ARN  | read-only "true"  | *ec2config.Role.InstanceProfileARN  | string   |
*-----------------------------------------------*-------------------*-------------------------------------*----------*


*-------------------------------------------------------------------*-------------------*------------------------------------------------------*----------*
|                      ENVIRONMENTAL VARIABLE                       |     READ ONLY     |                         TYPE                         | GO TYPE  |
*-------------------------------------------------------------------*-------------------*------------------------------------------------------*----------*
| AWS_K8S_TESTER_EC2_VPC_CREATE                                     | read-only "false" | *ec2config.VPC.Create                                | bool     |
| AWS_K8S_TESTER_EC2_VPC_ID                                         | read-only "false" | *ec2config.VPC.ID                                    | string   |
| AWS_K8S_TESTER_EC2_VPC_SECURITY_GROUP_ID                          | read-only "true"  | *ec2config.VPC.SecurityGroupID                       | string   |
| AWS_K8S_TESTER_EC2_VPC_CIDRS                                      | read-only "false" | *ec2config.VPC.CIDRs                                 | []string |
| AWS_K8S_TESTER_EC2_VPC_PUBLIC_SUBNET_CIDRS                        | read-only "false" | *ec2config.VPC.PublicSubnetCIDRs                     | []string |
| AWS_K8S_TESTER_EC2_VPC_PUBLIC_SUBNET_IDS                          | read-only "true"  | *ec2config.VPC.PublicSubnetIDs                       | []string |
| AWS_K8S_TESTER_EC2_VPC_INTERNET_GATEWAY_ID                        | read-only "true"  | *ec2config.VPC.InternetGatewayID                     | string   |
| AWS_K8S_TESTER_EC2_VPC_PUBLIC_ROUTE_TABLE_ID                      | read-only "true"  | *ec2config.VPC.PublicRouteTableID                    | string   |
| AWS_K8S_TESTER_EC2_VPC_PUBLIC_SUBNET_ROUTE_TABLE_ASSOCIATION_IDS  | read-only "true"  | *ec2config.VPC.PublicSubnetRouteTableAssociationIDs  | []string |
| AWS_K8S_TESTER_EC2_VPC_EIP_ALLOCATION_IDS                         | read-only "true"  | *ec2config.VPC.EIPAllocationIDs                      | []string |
| AWS_K8S_TESTER_EC2_VPC_NAT_GATEWAY_IDS                            | read-only "true"  | *ec2config.VPC.NATGatewayIDs                         | []string |
| AWS_K8S_TESTER_EC2_VPC_PRIVATE_SUBNET_CIDRS                       | read-only "false" | *ec2config.VPC.PrivateSubnetCIDRs                    | []string |
| AWS_K8S_TESTER_EC2_VPC_PRIVATE_SUBNET_IDS                         | read-only "true"  | *ec2config.VPC.PrivateSubnetIDs                      | []string |
| AWS_K8S_TESTER_EC2_VPC_PRIVATE_ROUTE_TABLE_IDS                    | read-only "true"  | *ec2config.VPC.PrivateRouteTableIDs                  | []string |
| AWS_K8S_TESTER_EC2_VPC_PRIVATE_SUBNET_ROUTE_TABLE_ASSOCIATION_IDS | read-only "true"  | *ec2config.VPC.PrivateSubnetRouteTableAssociationIDs | []string |
| AWS_K8S_TESTER_EC2_VPC_DHCP_OPTIONS_DOMAIN_NAME                   | read-only "false" | *ec2config.VPC.DHCPOptionsDomainName                 | string   |
| AWS_K8S_TESTER_EC2_VPC_DHCP_OPTIONS_DOMAIN_NAME_SERVERS           | read-only "false" | *ec2config.VPC.DHCPOptionsDomainNameServers          | []string |
| AWS_K8S_TESTER_EC2_VPC_DHCP_OPTIONS_ID                            | read-only "true"  | *ec2config.VPC.DHCPOptionsID                         | string   |
*-------------------------------------------------------------------*-------------------*------------------------------------------------------*----------*


Documentation

Overview

Package ec2config defines EC2 configuration.

Index

Constants

View Source
const (
	// AMITypeAL2ARM64 is the AMI type for Amazon Linux 2 AMI.
	// https://aws.amazon.com/ec2/graviton/
	AMITypeAL2ARM64 = "AL2_arm_64"
	// AMITypeBottleRocketCPU is the AMI type for Bottlerocket OS.
	// https://github.com/bottlerocket-os/bottlerocket
	AMITypeBottleRocketCPU = "BOTTLEROCKET_x86_64"
	// AMITypeAL2X8664 is the AMI type for Amazon Linux 2 AMI.
	AMITypeAL2X8664 = "AL2_x86_64"
	// AMITypeAL2X8664GPU is the AMI type for Amazon Linux 2 AMI with GPU.
	AMITypeAL2X8664GPU = "AL2_x86_64_GPU"

	// AMITypeOther is defined for all other AMI types.
	AMITypeOther = "OTHER"

	AMITypeWindowsServerCore2019X8664 = "WINDOWS_SERVER_CORE_2019_x86_64"

	// DefaultNodeInstanceTypeCPUARM is the default EC2 instance type for CPU worker node.
	// https://aws.amazon.com/ec2/instance-types/m6/
	DefaultNodeInstanceTypeCPUARM = "m6g.xlarge"
	// DefaultNodeInstanceTypeCPU is the default EC2 instance type for CPU worker node.
	DefaultNodeInstanceTypeCPU = "c5.xlarge"
	// DefaultNodeInstanceTypeGPU is the default EC2 instance type for GPU worker node.
	DefaultNodeInstanceTypeGPU = "p3.8xlarge"

	// DefaultNodeVolumeSize is the default EC2 instance volume size for a worker node.
	DefaultNodeVolumeSize = 40

	// ASGsMaxLimit is the maximum number of "Managed Node Group"s per a EKS cluster.
	ASGsMaxLimit = 10
	// ASGMaxLimit is the maximum number of nodes per a "Managed Node Group".
	ASGMaxLimit = 100
)
View Source
const AWS_K8S_TESTER_EC2_PREFIX = "AWS_K8S_TESTER_EC2_"

AWS_K8S_TESTER_EC2_PREFIX is the environment variable prefix used for "ec2config".

View Source
const StatusDELETEDORNOTEXIST = "DELETED/NOT-EXIST"

TODO: asg status

Variables

This section is empty.

Functions

This section is empty.

Types

type ASG added in v0.6.9

type ASG struct {
	// Name is the ASG name.
	Name string `json:"name"`

	TimeFrameCreate timeutil.TimeFrame `json:"time-frame-create" read-only:"true"`
	TimeFrameDelete timeutil.TimeFrame `json:"time-frame-delete" read-only:"true"`

	// RemoteAccessUserName is the user name used for running init scripts or SSH access.
	RemoteAccessUserName string `json:"remote-access-user-name"`

	// SSM defines SSM command parameters.
	SSM *SSM `json:"ssm"`

	// AMIType is the AMI type for the node group.
	// Allowed values are BOTTLEROCKET_x86_64, AL2_x86_64 and AL2_x86_64_GPU.
	// ref. https://docs.aws.amazon.com/eks/latest/userguide/launch-workers.html
	// ref. https://github.com/awslabs/amazon-eks-ami/blob/master/amazon-eks-nodegroup.yaml
	AMIType string `json:"ami-type,omitempty"`
	// ImageID is the Amazon Machine Image (AMI).
	// This value overrides any AWS Systems Manager Parameter Store value.
	// NOTE: THIS FIELD IS SET TO EMPTY IF "ImageIDSSMParameter" IS NOT EMPTY.
	ImageID string `json:"image-id"`
	// ImageIDSSMParameter is the AWS Systems Manager Parameter Store
	// parameter of the AMI ID.
	ImageIDSSMParameter string `json:"image-id-ssm-parameter"`

	// InstanceType is the EC2 instance type.
	InstanceType string `json:"instance-type"`

	// VolumeSize is the size of the default volume, in GiB.
	//
	// Constraints: 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned
	// IOPS SSD (io1), 500-16384 for Throughput Optimized HDD (st1), 500-16384 for
	// Cold HDD (sc1), and 1-1024 for Magnetic (standard) volumes. If you specify
	// a snapshot, the volume size must be equal to or larger than the snapshot
	// size.
	//
	// Default: If you're creating the volume from a snapshot and don't specify
	// a volume size, the default is the snapshot size.
	VolumeSize int32 `json:"volume-size"`

	// VolumeType is the type of volume for the underlying EBS volume.
	// See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html
	VolumeType aws_ec2_v2_types.VolumeType `json:"volume-type"`

	// ASGMinSize is the minimum size of ASG.
	ASGMinSize int32 `json:"asg-min-size,omitempty"`
	// ASGMaxSize is the maximum size of ASG.
	ASGMaxSize int32 `json:"asg-max-size,omitempty"`
	// ASGDesiredCapacity is the desired capacity of ASG.
	ASGDesiredCapacity int32 `json:"asg-desired-capacity,omitempty"`

	// Instances is a map from instance ID to instance.
	Instances map[string]Instance `json:"instanaces" read-only:"true"`
	// Logs maps each instance ID to a list of log file paths fetched via SSH access.
	Logs map[string][]string `json:"logs" read-only:"true"`

	// LaunchTemplateName is the name of the launch template.
	LaunchTemplateName string `json:"launch-template-name" read-only:"true"`
}

ASG represents one ASG.

func (*ASG) SSHCommands added in v0.6.9

func (asg *ASG) SSHCommands(region string, keyPath string, userName string) (s string)

SSHCommands returns the SSH commands.

type BlockDeviceMapping

type BlockDeviceMapping struct {
	DeviceName string `json:"device-name"`
	EBS        EBS    `json:"ebs"`
}

BlockDeviceMapping defines a block device mapping.

type CPUOptions added in v0.9.0

type CPUOptions struct {
	// CoreCount is the number of CPU cores for the instance.
	CoreCount int32 `json:"core-count"`
	// ThreadsPerCore is the number of threads per CPU core.
	ThreadsPerCore int32 `json:"threads-per-core"`
}

CPUOptions represents the CPU of an EC2 instance.

type Config

type Config struct {

	// Up is true if the cluster is up.
	Up              bool               `json:"up"`
	TimeFrameCreate timeutil.TimeFrame `json:"time-frame-create" read-only:"true"`
	TimeFrameDelete timeutil.TimeFrame `json:"time-frame-delete" read-only:"true"`
	// StatusCurrent represents the current status of the cluster.
	StatusCurrent string `json:"status-current"`
	// Status represents the status of the cluster.
	Status           []Status          `json:"status"`
	DeletedResources map[string]string `json:"deleted-resources"`

	// Name is the cluster name.
	// If empty, deployer auto-populates it.
	Name string `json:"name"`
	// Partition is the AWS partition for EC2 deployment region.
	// If empty, set default partition "aws".
	Partition string `json:"partition"`
	// Region is the AWS geographic area for EC2 deployment.
	// If empty, set default region.
	Region string `json:"region"`
	// AvailabilityZoneNames lists the availability zones for the specified region.
	// ref. https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeAvailabilityZones.html
	AvailabilityZoneNames []string `json:"availability-zone-names,omitempty" read-only:"true"`

	// ConfigPath is the configuration file path.
	// Deployer is expected to update this file with latest status.
	ConfigPath string `json:"config-path,omitempty"`

	// AWSAccountID is the account ID of the eks tester caller session.
	AWSAccountID string `json:"aws-account-id" read-only:"true"`
	// AWSUserID is the user ID of the eks tester caller session.
	AWSUserID string `json:"aws-user-id" read-only:"true"`
	// AWSIAMRoleARN is the user IAM Role ARN of the eks tester caller session.
	AWSIAMRoleARN string `json:"aws-iam-role-arn" read-only:"true"`
	// AWSCredentialPath is automatically set via AWS SDK Go.
	// And to be mounted as a volume as 'Secret' object.
	AWSCredentialPath string `json:"aws-credential-path" read-only:"true"`

	// LogColor is true to output logs in color.
	LogColor bool `json:"log-color"`
	// LogColorOverride is not empty to override "LogColor" setting.
	// If not empty, the automatic color check is not even run and use this value instead.
	// For instance, github action worker might not support color device,
	// thus exiting color check with the exit code 1.
	// Useful to output in color in HTML based log outputs (e.g., Prow).
	// Useful to skip terminal color check when there is no color device (e.g., Github action worker).
	LogColorOverride string `json:"log-color-override"`

	// LogLevel configures log level. Only supports debug, info, warn, error, panic, or fatal. Default 'info'.
	LogLevel string `json:"log-level"`
	// LogOutputs is a list of log outputs. Valid values are 'default', 'stderr', 'stdout', or file names.
	// Logs are appended to the existing file, if any.
	// Multiple values are accepted. If empty, it sets to 'default', which outputs to stderr.
	// See https://pkg.go.dev/go.uber.org/zap#Open and https://pkg.go.dev/go.uber.org/zap#Config for more details.
	LogOutputs []string `json:"log-outputs,omitempty"`

	// OnFailureDelete is true to delete all resources on creation fail.
	OnFailureDelete bool `json:"on-failure-delete"`
	// OnFailureDeleteWaitSeconds is the seconds to wait before deleting
	// all resources on creation fail.
	OnFailureDeleteWaitSeconds uint64 `json:"on-failure-delete-wait-seconds"`

	S3   *S3   `json:"s3"`
	Role *Role `json:"role"`
	VPC  *VPC  `json:"vpc"`

	// RemoteAccessKeyCreate is true to create the remote SSH access private key.
	RemoteAccessKeyCreate bool `json:"remote-access-key-create"`
	// RemoteAccessKeyName is the remote SSH access private key name.
	RemoteAccessKeyName string `json:"remote-access-key-name"`
	// RemoteAccessPrivateKeyPath is the remote SSH access private key path.
	RemoteAccessPrivateKeyPath string `json:"remote-access-private-key-path"`
	// RemoteAccessCommandsOutputPath is the output path for ssh commands.
	RemoteAccessCommandsOutputPath string `json:"remote-access-commands-output-path,omitempty"`

	// ASGsFetchLogs is true to fetch logs from remote nodes using SSH.
	ASGsFetchLogs bool `json:"asgs-fetch-logs"`
	// ASGsLogsDir is set to specify the target directory to store all remote log files.
	// If empty, it stores in the same directory as "ConfigPath".
	ASGsLogsDir string `json:"asgs-logs-dir,omitempty"`
	// ASGs is a map from each ASG name to EC2 ASG.
	ASGs map[string]ASG `json:"asgs"`

	// TotalNodes is the total number of nodes from all ASGs.
	TotalNodes int32 `json:"total-nodes" read-only:"true"`
	// contains filtered or unexported fields
}

Config defines EC2 configuration.

func Load

func Load(p string) (cfg *Config, err error)

Load loads configuration from YAML. Useful when injecting shared configuration via ConfigMap.

Example usage:

import "github.com/aws/aws-k8s-tester/eksconfig"
cfg := eksconfig.Load("test.yaml")
err := cfg.ValidateAndSetDefaults()

Do not set default values in this function. "ValidateAndSetDefaults" must be called separately, to prevent overwriting previous data when loaded from disks.

func NewDefault

func NewDefault() *Config

NewDefault returns a default configuration.

  • empty string creates a non-nil object for pointer-type field
  • omitting an entire field returns nil value
  • make sure to check both

func (Config) Colorize added in v1.4.6

func (c Config) Colorize(input string) string

func (*Config) RecordStatus added in v0.6.9

func (cfg *Config) RecordStatus(status string)

RecordStatus records cluster status.

func (*Config) SSHCommands

func (cfg *Config) SSHCommands() string

SSHCommands returns the SSH commands.

func (*Config) Sync

func (cfg *Config) Sync() (err error)

Sync persists current configuration and states to disk.

func (*Config) UpdateFromEnvs

func (cfg *Config) UpdateFromEnvs() (err error)

UpdateFromEnvs updates fields from environmental variables. Empty values are ignored and do not overwrite fields with empty values. WARNING: The environmental variable value always overwrites current field values if there's a conflict.

func (*Config) ValidateAndSetDefaults

func (cfg *Config) ValidateAndSetDefaults() error

ValidateAndSetDefaults returns an error for invalid configurations. And updates empty fields with default values. At the end, it writes populated YAML to aws-k8s-tester config path.

type EBS

type EBS struct {
	DeleteOnTermination bool   `json:"delete-on-termination"`
	Status              string `json:"status"`
	VolumeID            string `json:"volume-id"`
}

EBS defines an EBS volume.

type IAMInstanceProfile added in v0.9.0

type IAMInstanceProfile struct {
	// ARN is the Amazon Resource Name (ARN) of the instance profile.
	ARN string `json:"arn"`
	// ID is the ID of the instance profile.
	ID string `json:"id"`
}

IAMInstanceProfile is the IAM instance profile.

type Instance

type Instance struct {
	Architecture          string               `json:"architecture"`
	ImageID               string               `json:"image-id"`
	IAMInstanceProfile    IAMInstanceProfile   `json:"iam-instance-profile"`
	InstanceID            string               `json:"instance-id"`
	InstanceType          string               `json:"instance-type"`
	KeyName               string               `json:"key-name"`
	Placement             Placement            `json:"placement"`
	PrivateDNSName        string               `json:"private-dns-name"`
	PrivateIP             string               `json:"private-ip"`
	PublicDNSName         string               `json:"public-dns-name"`
	PublicIP              string               `json:"public-ip"`
	State                 State                `json:"state"`
	StateReason           StateReason          `json:"state-reason"`
	StateTransitionReason string               `json:"state-transition-reason"`
	SubnetID              string               `json:"subnet-id"`
	VPCID                 string               `json:"vpc-id"`
	CPUOptions            CPUOptions           `json:"cpu-options"`
	BlockDeviceMappings   []BlockDeviceMapping `json:"block-device-mappings"`
	EBSOptimized          bool                 `json:"ebs-optimized"`
	RootDeviceName        string               `json:"root-device-name"`
	RootDeviceType        string               `json:"root-device-type"`
	SecurityGroups        []SecurityGroup      `json:"security-groups"`
	LaunchTime            time.Time            `json:"launch-time"`
	RemoteAccessUserName  string               `json:"remote-access-user-name"`
	Hypervisor            string               `json:"hypervisor"`
	VirtualizationType    string               `json:"virtualization-type"`
}

Instance represents an EC2 instance.

func ConvertInstance added in v0.6.9

func ConvertInstance(iv aws_ec2_v2_types.Instance) (instance Instance)

ConvertInstance converts "aws ec2 describe-instances" to "config.Instance".

type Placement

type Placement struct {
	AvailabilityZone string `json:"availability-zone"`
	Tenancy          string `json:"tenancy"`
}

Placement defines EC2 placement.

type Role added in v1.6.1

type Role struct {
	// Name is the name of cluster role.
	Name string `json:"name"`
	// Create is true to auto-create and delete cluster role.
	Create bool `json:"create"`
	// ARN is the role ARN that EKS uses to create AWS resources for Kubernetes.
	// By default, it's empty which triggers tester to create one.
	ARN string `json:"arn"`

	// ServicePrincipals is the EKS Role Service Principals
	ServicePrincipals []string `json:"service-principals"`
	// ManagedPolicyARNs is EKS Role managed policy ARNs.
	ManagedPolicyARNs []string `json:"managed-policy-arns"`

	// PolicyName is the name of the policy.
	PolicyName string `json:"policy-name" read-only:"true"`
	// PolicyARN is the attached policy ARN.
	PolicyARN string `json:"policy-arn" read-only:"true"`

	// InstanceProfileName is the instance profile name for the node group.
	InstanceProfileName string `json:"instance-profile-name" read-only:"true"`
	// InstanceProfileARN is the instance profile ARN for the node group.
	InstanceProfileARN string `json:"instance-profile-arn" read-only:"true"`
}

type S3 added in v1.6.1

type S3 struct {
	// BucketCreate is true to auto-create S3 bucket.
	BucketCreate bool `json:"bucket-create"`
	// BucketCreateKeep is true to not delete auto-created S3 bucket.
	// The created S3 bucket is kept.
	BucketCreateKeep bool `json:"bucket-create-keep"`
	// BucketName is the name of cluster S3.
	BucketName string `json:"bucket-name"`
	// BucketLifecycleExpirationDays is expiration in days for the lifecycle of the object.
	BucketLifecycleExpirationDays int64 `json:"bucket-lifecycle-expiration-days"`
	// Dir is the S3 directory to store all test results.
	// It is under the bucket "eksconfig.Config.S3BucketName".
	Dir string `json:"dir"`
}

type SSM added in v1.6.1

type SSM struct {
	// DocumentCreate is true to auto-create and delete SSM document.
	DocumentCreate bool `json:"document-create"`
	// DocumentName is the name of SSM document.
	DocumentName string `json:"document-name"`
	// DocumentCommands is the commands for SSM document.
	// Only used if SSM doc is created.
	DocumentCommands string `json:"document-commands"`
	// DocumentExecutionTimeoutSeconds is the SSM document execution timeout in seconds.
	DocumentExecutionTimeoutSeconds int      `json:"document-execution-timeout-in-seconds"`
	DocumentCommandIDs              []string `json:"document-command-ids" read-only:"true"`
}

type SecurityGroup

type SecurityGroup struct {
	GroupName string `json:"group-name"`
	GroupID   string `json:"group-id"`
}

SecurityGroup defines a security group.

type State

type State struct {
	Code int32  `json:"code"`
	Name string `json:"name"`
}

State defines an EC2 state.

type StateReason added in v0.9.0

type StateReason struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

StateReason represents the EC2 state reason.

type Status added in v0.6.9

type Status struct {
	Time   time.Time `json:"time"`
	Status string    `json:"status"`
}

Status is the status.

type VPC added in v1.6.1

type VPC struct {
	// Create is true to auto-create and delete VPC.
	Create bool `json:"create"`
	// ID is the VPC ID for cluster creation.
	// If not empty, VPC is reused and not deleted.
	// If empty, VPC is created anew and deleted on cluster deletion.
	ID              string `json:"id"`
	SecurityGroupID string `json:"security-group-id" read-only:"true"`

	// CIDRs is the list of CIDR blocks with IP range (CIDR notation) for the primary VPC Block.
	// Must be a valid RFC 1918 CIDR range.
	CIDRs []string `json:"cidrs"`

	// PublicSubnetCIDRs is the CIDR blocks for public subnets.
	PublicSubnetCIDRs                    []string `json:"public-subnet-cidrs"`
	PublicSubnetIDs                      []string `json:"public-subnet-ids" read-only:"true"`
	InternetGatewayID                    string   `json:"internet-gateway-id" read-only:"true"`
	PublicRouteTableID                   string   `json:"public-route-table-id" read-only:"true"`
	PublicSubnetRouteTableAssociationIDs []string `json:"public-subnet-route-table-association-ids" read-only:"true"`
	EIPAllocationIDs                     []string `json:"eip-allocation-ids" read-only:"true"`
	NATGatewayIDs                        []string `json:"nat-gateway-ids" read-only:"true"`

	// PrivateSubnetCIDRs is the CIDR blocks for private subnets.
	PrivateSubnetCIDRs                    []string `json:"private-subnet-cidrs,omitempty"`
	PrivateSubnetIDs                      []string `json:"private-subnet-ids" read-only:"true"`
	PrivateRouteTableIDs                  []string `json:"private-route-table-ids" read-only:"true"`
	PrivateSubnetRouteTableAssociationIDs []string `json:"private-subnet-route-table-association-ids" read-only:"true"`

	// DHCPOptionsDomainName is used to complete unqualified DNS hostnames for VPC.
	// ref. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html
	// ref. https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html
	DHCPOptionsDomainName string `json:"dhcp-options-domain-name,omitempty"`
	// DHCPOptionsDomainNameServers is a list of strings.
	// The IPv4 addresses of up to four domain name servers, or AmazonProvidedDNS, for VPC.
	// ref. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html
	// ref. https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html
	DHCPOptionsDomainNameServers []string `json:"dhcp-options-domain-name-servers,omitempty"`
	DHCPOptionsID                string   `json:"dhcp-options-id,omitempty" read-only:"true"`
}

Directories

Path Synopsis
gen generates ec2config documentation.
gen generates ec2config documentation.

Jump to

Keyboard shortcuts

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