{"record":{"id":"e0f5fe5cbc091644","repo":"kubernetes/kops","slug":"building-cloud-w","errorCode":null,"errorMessage":"building cloud: %w","messagePattern":"building cloud: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/controllers/clusterapi/kopsconfig_controller.go","lineNumber":216,"sourceCode":"\t\tconfigBuilder.ClusterName = clusterInternal.Name\n\t}\n\n\tig := &kops.InstanceGroup{}\n\t{\n\t\tig.SetName(\"placeholder-ig-name\") // IG name is not used for nodeup config generation\n\t\tig.Spec.Role = kops.InstanceGroupRoleNode\n\t\t// The machine image is chosen by the CAPI infrastructure provider and is not used for\n\t\t// nodeup config generation; the placeholder avoids resolving a default from the channel.\n\t\tig.Spec.Image = \"placeholder-image\"\n\n\t\tconfigBuilder.InstanceGroup = ig\n\t\tconfigBuilder.InstanceGroupName = ig.Name\n\t}\n\n\t{\n\t\tcloud, err := cloudup.BuildCloud(clusterInternal)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"building cloud: %w\", err)\n\t\t}\n\t\tconfigBuilder.Cloud = cloud\n\t}\n\n\tbootstrapData, err := configBuilder.GetBootstrapData(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"building bootstrap data: %w\", err)\n\t}\n\n\treturn bootstrapData.NodeupScript, nil\n}\n","sourceCodeStart":198,"sourceCodeEnd":228,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/controllers/clusterapi/kopsconfig_controller.go#L198-L228","documentation":"Thrown by buildBootstrapData when cloudup.BuildCloud fails to construct the cloud provider interface from the internal kops.Cluster spec (pkg/controllers/clusterapi/kopsconfig_controller.go:214-216). BuildCloud requires the cluster spec to identify a supported cloud provider and to contain the provider-specific configuration (e.g. region for AWS) needed to instantiate a cloud client.","triggerScenarios":"The kops Cluster has no valid spec.provider/cloudConfig (e.g. empty or unrecognized cloud field), required provider settings are missing (e.g. no region/networking config), BuildCloud cannot initialize a cloud client for the provider, or the converted cluster spec is incomplete because upstream conversion dropped fields.","commonSituations":"A Cluster object created without the cloud provider field populated; a provider unsupported by the kops cluster-api integration; a Cluster spec that lost fields during conversion from a newer schema; cluster spec referencing an invalid region or provider configuration.","solutions":["Verify the Cluster spec's cloudProvider field is set to a supported provider (aws, gce, openstack, etc.) and check the wrapped error for specifics.","Ensure provider-required fields exist in the cluster spec (e.g. spec.networking type, subnets with correct region/zones).","Re-apply the Cluster object with a complete, kops-validated spec (validate with kops toolbox or kubectl apply from a kops-generated manifest).","Confirm the controller binary supports the cloud provider used (check kops version release notes for cluster-api provider support).","If BuildCloud fails due to missing credentials or API access for the provider, check that the management cluster has valid cloud credentials mounted."],"exampleFix":"// before: Cluster spec missing provider field\nspec:\n  kubernetesVersion: v1.29.0\n// after\nspec:\n  cloudProvider: aws\n  kubernetesVersion: v1.29.0\n  networkCIDR: 10.0.0.0/16\n  subnets:\n  - name: us-east-1a\n    type: Public\n    zone: us-east-1a","handlingStrategy":"validation","validationCode":"// Validate required cluster spec fields before BuildCloud is reachable\nif cluster.Spec.CloudProvider == nil || cluster.Spec.CloudProvider.Empty() {\n\treturn fmt.Errorf(\"cluster %s has no cloudProvider set; BuildCloud will fail\", cluster.Name)\n}\nif len(cluster.Spec.Subnets) == 0 {\n\treturn fmt.Errorf(\"cluster %s has no subnets; provider config incomplete\", cluster.Name)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set spec.cloudProvider (and provider-specific config like region/networkCIDR) in Cluster objects consumed by the cluster-api controllers.","Ensure the management cluster has valid cloud credentials so provider clients can initialize.","Confirm the controller build includes support for the target cloud provider.","Run kops cluster validation before registering the cluster with CAPI.","Check conversion output: after scheme conversion, log/assert the internal cluster's provider fields are populated."],"tags":["kubernetes","kops","cloud-provider","bootstrap-data","controller"],"backgroundTag":"cloud-provider-init-failed","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"}