{"record":{"id":"a9dd1b6681310a83","repo":"kubernetes/kops","slug":"unhandled-loadbalancer-type-q-a9dd1b","errorCode":null,"errorMessage":"unhandled LoadBalancer type %q","messagePattern":"unhandled LoadBalancer type %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/domodel/api_loadbalancer.go","lineNumber":55,"sourceCode":"func (b *APILoadBalancerModelBuilder) Build(c *fi.CloudupModelBuilderContext) error {\n\t// Configuration where a load balancer fronts the API\n\tif !b.UseLoadBalancerForAPI() {\n\t\treturn nil\n\t}\n\n\tlbSpec := b.Cluster.Spec.API.LoadBalancer\n\tif lbSpec == nil {\n\t\t// Skipping API LB creation; not requested in Spec\n\t\treturn nil\n\t}\n\n\tswitch lbSpec.Type {\n\tcase kops.LoadBalancerTypeInternal:\n\t\t// OK\n\tcase kops.LoadBalancerTypePublic:\n\t\t// OK\n\tdefault:\n\t\treturn fmt.Errorf(\"unhandled LoadBalancer type %q\", lbSpec.Type)\n\t}\n\n\tclusterName := do.SafeClusterName(b.ClusterName())\n\tloadbalancerName := \"api-\" + clusterName\n\tclusterMasterTag := do.TagKubernetesClusterMasterPrefix + \":\" + clusterName\n\n\t// Create LoadBalancer for API LB\n\tloadbalancer := &dotasks.LoadBalancer{\n\t\tName:              new(loadbalancerName),\n\t\tRegion:            new(b.Cluster.Spec.Networking.Subnets[0].Region),\n\t\tDropletTag:        new(clusterMasterTag),\n\t\tLifecycle:         b.Lifecycle,\n\t\tWellKnownServices: []wellknownservices.WellKnownService{wellknownservices.KopsController, wellknownservices.KubeAPIServer},\n\t}\n\n\tif b.Cluster.Spec.Networking.NetworkID != \"\" {\n\t\tloadbalancer.VPCUUID = new(b.Cluster.Spec.Networking.NetworkID)\n\t} else if b.Cluster.Spec.Networking.NetworkCIDR != \"\" {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/domodel/api_loadbalancer.go#L37-L73","documentation":"The DigitalOcean API load balancer model (pkg/model/domodel/api_loadbalancer.go:55) only supports LB type Internal and Public. If spec.api.loadBalancer.type in the cluster spec is any other value (empty string included, since the switch has no default case for it), Build returns 'unhandled LoadBalancer type'. It is a strict enum check against kops.LoadBalancerType.","triggerScenarios":"Setting spec.api.loadBalancer.type to a value outside {internal, public} — e.g. an empty string because the loadBalancer block was created but the type field omitted, or a copy-pasted AWS-style value.","commonSituations":"Templated cluster manifests where the type field was left blank; hand-editing the spec and using a provider-unsupported type name (e.g. 'External'); schema changes across kOps versions altering the accepted enum.","solutions":["Set spec.api.loadBalancer.type to exactly 'public' or 'internal' in the cluster spec","Remove the empty loadBalancer block entirely if you want provider defaults","Run 'kops get cluster -o yaml' to inspect the raw value for typos or casing issues","Re-run 'kops update cluster' after the fix"],"exampleFix":"// before\napi:\n  loadBalancer: {}\n// after\napi:\n  loadBalancer:\n    type: public","handlingStrategy":"validation","validationCode":"lb := cluster.Spec.API.LoadBalancer\nif lb != nil && lb.Type != \"\" && lb.Type != kops.LoadBalancerTypePublic && lb.Type != kops.LoadBalancerTypeInternal {\n\treturn fmt.Errorf(\"DO clusters only support loadBalancer type public|internal, got %q\", lb.Type)\n}\nif lb != nil && lb.Type == \"\" { return errors.New(\"api.loadBalancer.type must be set (public|internal)\") }","typeGuard":"func supportedDOLBType(t kops.LoadBalancerType) bool {\n\treturn t == kops.LoadBalancerTypePublic || t == kops.LoadBalancerTypeInternal\n}","tryCatchPattern":null,"preventionTips":["On DigitalOcean always set type: public or type: internal explicitly","Never copy loadBalancer blocks from AWS/GCP cluster specs","Run a dry-run update before applying spec edits","Keep the api.loadBalancer block empty-omitted unless you set a valid type"],"tags":["kops","digitalocean","load-balancer","configuration"],"backgroundTag":"unhandled-loadbalancer-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"}