{"record":{"id":"b8991e8e83f33213","repo":"kubernetes/kops","slug":"unknown-subnet-type-q","errorCode":null,"errorMessage":"unknown subnet type %q","messagePattern":"unknown subnet type %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/awsmodel/spotinst.go","lineNumber":761,"sourceCode":"\t\tsubnetType = subnet.Type\n\t}\n\n\tvar associatePublicIP bool\n\tswitch subnetType {\n\tcase kops.SubnetTypePublic, kops.SubnetTypeUtility:\n\t\tassociatePublicIP = true\n\t\tif ig.Spec.AssociatePublicIP != nil {\n\t\t\tassociatePublicIP = *ig.Spec.AssociatePublicIP\n\t\t}\n\tcase kops.SubnetTypeDualStack, kops.SubnetTypePrivate:\n\t\tassociatePublicIP = false\n\t\tif ig.Spec.AssociatePublicIP != nil {\n\t\t\tif *ig.Spec.AssociatePublicIP {\n\t\t\t\tklog.Warningf(\"Ignoring AssociatePublicIPAddress=true for private SpotInstanceGroup %q\", ig.ObjectMeta.Name)\n\t\t\t}\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown subnet type %q\", subnetType)\n\t}\n\n\treturn new(associatePublicIP), nil\n}\n\nfunc (b *SpotInstanceGroupModelBuilder) buildRootVolumeOpts(ig *kops.InstanceGroup) (*spotinsttasks.RootVolumeOpts, error) {\n\topts := new(spotinsttasks.RootVolumeOpts)\n\n\tvar size int32\n\tvar typ string\n\tvar iops int32\n\tvar throughput int32\n\tif ig.Spec.RootVolume != nil {\n\t\t// Optimization.\n\t\t{\n\t\t\tif fi.ValueOf(ig.Spec.RootVolume.Optimization) {\n\t\t\t\topts.Optimization = ig.Spec.RootVolume.Optimization\n\t\t\t}","sourceCodeStart":743,"sourceCodeEnd":779,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/awsmodel/spotinst.go#L743-L779","documentation":"Raised by buildPublicIPOpts in its default switch branch when the resolved subnetType is not one of the recognized kops subnet types (Public, Utility, Private). This means an unrecognized subnet type value reached the public-IP decision logic.","triggerScenarios":"kops create/update where the cluster's subnet spec carries an unknown/invalid subnetType value that the Spotinst model does not handle.","commonSituations":"Hand-edited cluster YAML with a typo in subnet type, a subnetType introduced in a newer kops version used by an older binary (or vice versa), or corrupt cluster state in the state store.","solutions":["Set subnetType to a valid value: Public, Private, or Utility","Upgrade kops to the latest version if a newer subnet type is in use","Validate the cluster YAML and re-run kops update --yes"],"exampleFix":"// before\nspec:\n  subnetType: publik\n// after\nspec:\n  subnetType: Public","handlingStrategy":"validation","validationCode":"allowed := map[kops.SubnetType]bool{\"Public\": true, \"Private\": true, \"Utility\": true}\nfor _, s := range cluster.Spec.Subnets {\n  if !allowed[s.Type] {\n    return fmt.Errorf(\"subnet %q has unsupported type %q\", s.Name, s.Type)\n  }\n}","typeGuard":"func isKnownSubnetType(t kops.SubnetType) bool {\n  switch t {\n  case \"\", \"Public\", \"Private\", \"Utility\":\n    return true\n  }\n  return false\n}","tryCatchPattern":null,"preventionTips":["Only use documented subnetType values in cluster YAML","Keep kops binary and cluster spec on compatible versions","Lint cluster YAML before applying to the state store"],"tags":["aws","spotinst","subnets","cluster-config"],"backgroundTag":"unknown-subnet-type","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}