kubernetes/kops · error
invalid instance type %q specified
Error message
invalid instance type %q specified
What it means
Guard error from the MockAWSCloud test double: DescribeInstanceType was asked for an instance type that the mock's fixed table does not contain. The %q value is the unsupported instance type; this only occurs in tests, never against real AWS.
Source
Thrown at upup/pkg/fi/cloudup/awsup/mock_aws_cloud.go:306
// DefaultInstanceType determines an instance type for the specified cluster & instance group
func (c *MockAWSCloud) DefaultInstanceType(cluster *kops.Cluster, ig *kops.InstanceGroup) (string, error) {
switch {
case ig.Spec.Role.IsControlPlaneType():
return "m3.medium", nil
case ig.Spec.Role.HasNode():
return "t2.medium", nil
case ig.Spec.Role.HasBastion():
return "t2.micro", nil
default:
return "", fmt.Errorf("MockAWSCloud DefaultInstanceType does not handle %s", ig.Spec.Role)
}
}
// DescribeInstanceType calls ec2.DescribeInstanceType to get information for a particular instance type
func (c *MockAWSCloud) DescribeInstanceType(instanceType string) (*ec2types.InstanceTypeInfo, error) {
if instanceType == "t2.invalidType" {
return nil, fmt.Errorf("invalid instance type %q specified", "t2.invalidType")
}
info := &ec2types.InstanceTypeInfo{
NetworkInfo: &ec2types.NetworkInfo{
MaximumNetworkInterfaces: aws.Int32(1),
Ipv4AddressesPerInterface: aws.Int32(1),
},
MemoryInfo: &ec2types.MemoryInfo{
SizeInMiB: aws.Int64(1024),
},
VCpuInfo: &ec2types.VCpuInfo{
DefaultVCpus: aws.Int32(2),
},
}
if instanceType == "m3.medium" {
info.InstanceStorageInfo = &ec2types.InstanceStorageInfo{
Disks: []ec2types.DiskInfo{
{
Count: aws.Int32(1),View on GitHub (pinned to 4c8573c808)
Solutions
- Extend the mock's instance type table to cover the type used by the test
- Change the test to use one of the instance types already known to the mock
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at upup/pkg/fi/cloudup/awsup/mock_aws_cloud.go:306 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/441ae2eab3c0a2b5.
Report an issue: GitHub.