Documentation ¶
Overview ¶
Package eksconfig defines EKS test configuration.
Index ¶
Constants ¶
const ( // EnvironmentVariablePrefix is the environment variable prefix used for setting configuration. EnvironmentVariablePrefix = "AWS_K8S_TESTER_EKS_" EnvironmentVariablePrefixParameters = "AWS_K8S_TESTER_EKS_PARAMETERS_" EnvironmentVariablePrefixAddOnNLBHelloWorld = "AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_" EnvironmentVariablePrefixAddOnALB2048 = "AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_" EnvironmentVariablePrefixAddOnJobPerl = "AWS_K8S_TESTER_EKS_ADD_ON_JOB_PERL_" EnvironmentVariablePrefixAddOnJobEcho = "AWS_K8S_TESTER_EKS_ADD_ON_JOB_ECHO_" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddOnALB2048 ¶ added in v0.5.0
type AddOnALB2048 struct { Enable bool `json:"enable"` // PolicyCFNStackID is the CloudFormation stack ID // for ALB Ingress Controller IAM policy. PolicyCFNStackID string `json:"policy-cfn-stack-id" read-only:"true"` PolicyName string `json:"policy-name"` // URL is the URL for ALB 2048 Service. URL string `json:"url" read-only:"true"` }
AddOnALB2048 defines parameters for EKS cluster add-on ALB 2048 service.
type AddOnJobEcho ¶ added in v0.5.0
type AddOnJobEcho struct { Enable bool `json:"enable"` Completes int `json:"completes"` Parallels int `json:"parallels"` // Size is the job object size. // "Request entity too large: limit is 3145728" (3.1 MB). // "The Job "echo" is invalid: metadata.annotations: Too long: must have at most 262144 characters". (0.26 MB) Size int `json:"size"` }
AddOnJobEcho defines parameters for EKS cluster add-on Job with echo.
type AddOnJobPerl ¶ added in v0.5.0
type AddOnJobPerl struct { Enable bool `json:"enable"` Completes int `json:"completes"` Parallels int `json:"parallels"` }
AddOnJobPerl defines parameters for EKS cluster add-on Job with Perl.
type AddOnNLBHelloWorld ¶ added in v0.5.0
type AddOnNLBHelloWorld struct { Enable bool `json:"enable"` URL string `json:"url" read-only:"true"` }
AddOnNLBHelloWorld defines parameters for EKS cluster add-on NLB hello-world service.
type Config ¶
type Config struct { // ConfigPath is the configuration file path. // Deployer is expected to update this file with latest status. ConfigPath string `json:"config-path,omitempty"` // Region is the AWS geographic area for EKS deployment. // If empty, set default region. Region string `json:"region,omitempty"` // Name is the cluster name. // If empty, deployer auto-populates it. Name string `json:"name,omitempty"` // 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://godoc.org/go.uber.org/zap#Open and https://godoc.org/go.uber.org/zap#Config for more details. LogOutputs []string `json:"log-outputs,omitempty"` // AWSCLIPath is the path for AWS CLI path. AWSCLIPath string `json:"aws-cli-path,omitempty"` // KubectlPath is the path to download the "kubectl". KubectlPath string `json:"kubectl-path,omitempty"` // KubectlDownloadURL is the download URL to download "kubectl" binary from. // https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html KubectlDownloadURL string `json:"kubectl-download-url,omitempty"` // KubeConfigPath is the file path of KUBECONFIG for the EKS cluster. // If empty, auto-generate one. // Deployer is expected to delete this on cluster tear down. KubeConfigPath string `json:"kubeconfig-path,omitempty"` // Parameters defines EKS cluster creation parameters. // It's ok to leave any parameters empty. // If empty, it will use default values. Parameters *Parameters `json:"parameters,omitempty"` // Status represents the current status of AWS resources. // Status is read-only. // Status cannot be configured via environmental variables. Status *Status `json:"status,omitempty"` AddOnNLBHelloWorld *AddOnNLBHelloWorld `json:"add-on-nlb-hello-world,omitempty"` AddOnALB2048 *AddOnALB2048 `json:"add-on-alb-2048,omitempty"` AddOnJobPerl *AddOnJobPerl `json:"add-on-job-perl,omitempty"` AddOnJobEcho *AddOnJobEcho `json:"add-on-job-echo,omitempty"` }
Config defines EKS test configuration.
func Load ¶
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 (*Config) KubectlCommands ¶
KubectlCommands returns the SSH commands.
func (*Config) SSHCommands ¶
SSHCommands returns the SSH commands.
func (*Config) UpdateFromEnvs ¶
UpdateFromEnvs updates fields from environmental variables. Empty values are ignored.
func (*Config) ValidateAndSetDefaults ¶
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 NodeGroup ¶ added in v0.5.0
type NodeGroup struct { // Instances maps an instance ID to an EC2 instance object. Instances map[string]ec2config.Instance `json:"instances"` }
NodeGroup is a set of EC2 instances in EC2 Auto Scaling Group.
type Parameters ¶ added in v0.5.0
type Parameters struct { // ClusterRoleServicePrincipals is the EKS Role Service Principals ClusterRoleServicePrincipals []string `json:"cluster-role-service-principals,omitempty"` // ClusterRoleManagedPolicyARNs is EKS Role managed policy ARNs. ClusterRoleManagedPolicyARNs []string `json:"cluster-role-managed-policy-arns,omitempty"` // ClusterRoleARN is the role ARN that EKS uses to create AWS resources for Kubernetes. // By default, it's empty which triggers tester to create one. ClusterRoleARN string `json:"cluster-role-arn,omitempty"` // ClusterTags defines EKS create cluster tags. ClusterTags map[string]string `json:"cluster-tags,omitempty"` // ClusterRequestHeaderKey defines EKS create cluster request header key. ClusterRequestHeaderKey string `json:"cluster-request-header-key,omitempty"` // ClusterRequestHeaderValue defines EKS create cluster request header value. ClusterRequestHeaderValue string `json:"cluster-request-header-value,omitempty"` // ClusterResolverURL defines an AWS resolver endpoint for EKS API. // Must be left empty to use production EKS service. ClusterResolverURL string `json:"cluster-resolver-url"` // ClusterSigningName is the EKS create request signing name. ClusterSigningName string `json:"cluster-signing-name"` // VpcCIDR is the IP range (CIDR notation) for VPC, must be a valid private (RFC 1918) CIDR range. VPCCIDR string `json:"vpc-cidr,omitempty"` // PrivateSubnetCIDR1 is the CIDR Block for subnet 1 within the VPC. PrivateSubnetCIDR1 string `json:"private-subnet-cidr-1,omitempty"` // PrivateSubnetCIDR2 is the CIDR Block for subnet 2 within the VPC. PrivateSubnetCIDR2 string `json:"private-subnet-cidr-2,omitempty"` // PrivateSubnetCIDR3 is the CIDR Block for subnet 3 within the VPC. PrivateSubnetCIDR3 string `json:"private-subnet-cidr-3,omitempty"` // PrivateSubnetIDs is the list of all private subnets in the VPC. // By default, it's empty which triggers tester to create a VPC. // This must be from the same VPC that configures 'SecurityGroupIDs'. PrivateSubnetIDs []string `json:"private-subnet-ids,omitempty"` // ControlPlaneSecurityGroupID is the security group ID for the cluster control // plane communication with worker nodes // By default, it's empty which triggers tester to create a VPC. // This must be from the same VPC that configures 'PrivateSubnetIDs'. ControlPlaneSecurityGroupID string `json:"control-plane-security-group-id,omitempty"` // Version is the version of Kubernetes cluster. // If empty, set default version. Version string `json:"version,omitempty"` // ManagedNodeGroupRoleName is the name of the managed node group. ManagedNodeGroupRoleName string `json:"managed-node-group-role-name,omitempty"` // ManagedNodeGroupRoleServicePrincipals is the node group Service Principals ManagedNodeGroupRoleServicePrincipals []string `json:"managed-node-group-role-service-principals,omitempty"` // ManagedNodeGroupRoleManagedPolicyARNs is node group managed policy ARNs. ManagedNodeGroupRoleManagedPolicyARNs []string `json:"managed-node-group-role-managed-policy-arns,omitempty"` // ManagedNodeGroupRoleARN is the role ARN that EKS managed node group uses to create AWS resources for Kubernetes. // By default, it's empty which triggers tester to create one. ManagedNodeGroupRoleARN string `json:"managed-node-group-role-arn,omitempty"` // ManagedNodeGroupTags defines EKS managed node group create tags. ManagedNodeGroupTags map[string]string `json:"managed-node-group-tags,omitempty"` // ManagedNodeGroupRequestHeaderKey defines EKS managed node group create cluster request header key. ManagedNodeGroupRequestHeaderKey string `json:"managed-node-group-request-header-key,omitempty"` // ManagedNodeGroupRequestHeaderValue defines EKS managed node group create cluster request header value. ManagedNodeGroupRequestHeaderValue string `json:"managed-node-group-request-header-value,omitempty"` // ManagedNodeGroupResolverURL defines an AWS resolver endpoint for EKS API. // Must be left empty to use production EKS managed node group service. ManagedNodeGroupResolverURL string `json:"managed-node-group-resolver-url"` // ManagedNodeGroupSigningName is the EKS managed node group create request signing name. ManagedNodeGroupSigningName string `json:"managed-node-group-signing-name"` // ManagedNodeGroupName is the name of the managed node group. ManagedNodeGroupName string `json:"managed-node-group-name,omitempty"` // ManagedNodeGroupSSHKeyPairName is the key name for node group SSH EC2 key pair. ManagedNodeGroupSSHKeyPairName string `json:"managed-node-group-ssh-key-pair-name,omitempty"` // ManagedNodeGroupRemoteAccessPrivateKeyPath is the file path to store node group key pair private key. // Thus, deployer must delete the private key right after node group creation. // MAKE SURE PRIVATE KEY NEVER GETS UPLOADED TO CLOUD STORAGE AND DELETE AFTER USE!!! ManagedNodeGroupRemoteAccessPrivateKeyPath string `json:"managed-node-group-remote-access-private-key-path,omitempty"` // ManagedNodeGroupRemoteAccessUserName is the user name for managed node group SSH access. ManagedNodeGroupRemoteAccessUserName string `json:"managed-node-group-remote-access-user-name,omitempty"` // ManagedNodeGroupAMIType is the AMI type for the node group. ManagedNodeGroupAMIType string `json:"managed-node-group-ami-type,omitempty"` // ManagedNodeGroupASGMinSize is the minimum size of Node Group Auto Scaling Group. ManagedNodeGroupASGMinSize int `json:"managed-node-group-asg-min-size,omitempty"` // ManagedNodeGroupASGMaxSize is the maximum size of Node Group Auto Scaling Group. ManagedNodeGroupASGMaxSize int `json:"managed-node-group-asg-max-size,omitempty"` // ManagedNodeGroupASGDesiredCapacity is the desired capacity of Node Group ASG. ManagedNodeGroupASGDesiredCapacity int `json:"managed-node-group-asg-desired-capacity,omitempty"` // ManagedNodeGroupInstanceTypes is the EC2 instance types for the node instances. ManagedNodeGroupInstanceTypes []string `json:"managed-node-group-instance-types,omitempty"` // ManagedNodeGroupVolumeSize is the node volume size. ManagedNodeGroupVolumeSize int `json:"managed-node-group-volume-size,omitempty"` }
Parameters defines parameters for EKS cluster creation.
type Status ¶ added in v0.5.0
type Status struct { // Up is true if the cluster is up. Up bool `json:"up"` AWSAccountID string `json:"aws-account-id"` // AWSCredentialPath is automatically set via AWS SDK Go. // And to be mounted as a volume as 'Secret' object. AWSCredentialPath string `json:"aws-credential-path"` ClusterRoleCFNStackID string `json:"cluster-role-cfn-stack-id"` ClusterRoleARN string `json:"cluster-role-arn"` ClusterRoleName string `json:"cluster-role-name"` VPCCFNStackID string `json:"vpc-cfn-stack-id"` VPCID string `json:"vpc-id"` PrivateSubnetIDs []string `json:"private-subnet-ids"` ControlPlaneSecurityGroupID string `json:"control-plane-security-group-id"` ClusterCFNStackID string `json:"cluster-cfn-stack-id"` ClusterARN string `json:"cluster-arn"` // ClusterAPIServerEndpoint is the cluster endpoint of the EKS cluster, required for KUBECONFIG write. ClusterAPIServerEndpoint string `json:"cluster-api-server-endpoint"` // ClusterOIDCIssuer is the issuer URL for the OpenID Connect // (https://openid.net/connect/) identity provider . ClusterOIDCIssuer string `json:"cluster-oidc-issuer"` // ClusterCA is the EKS cluster CA, required for KUBECONFIG write. ClusterCA string `json:"cluster-ca"` // ClusterCADecoded is the decoded EKS cluster CA, required for k8s.io/client-go. ClusterCADecoded string `json:"cluster-ca-decoded"` ClusterStatus string `json:"cluster-status"` // ManagedNodeGroupRoleCFNStackID is the CloudFormation stack ID for a managed node group role. ManagedNodeGroupRoleCFNStackID string `json:"managed-node-group-role-cfn-stack-id"` // ManagedNodeGroupCFNStackID is the CloudFormation stack ID for a managed node group. ManagedNodeGroupCFNStackID string `json:"managed-node-group-cfn-stack-id"` ManagedNodeGroupRemoteAccessSecurityGroupID string `json:"managed-node-group-remote-access-security-group-id"` // ManagedNodeGroupID is the Physical ID for the created "AWS::EKS::Nodegroup". ManagedNodeGroupID string `json:"managed-node-group-id"` // ManagedNodeGroups maps each Auto Scaling Group to a set of latest EC2 nodes. ManagedNodeGroups map[string]NodeGroup `json:"managed-node-groups"` // ManagedNodeGroupsLogs maps each instance ID to a list of log file paths fetched via SSH access. ManagedNodeGroupsLogs map[string][]string `json:"managed-node-groups-logs"` ManagedNodeGroupStatus string `json:"managed-node-group-status"` }
Status represents the current status of AWS resources. Read-only. Cannot be configured via environmental variables.