{"record":{"id":"88d0f66b3f3977d6","repo":"kubernetes/kops","slug":"error-configuring-cluster-capi-objects-w","errorCode":null,"errorMessage":"error configuring cluster CAPI objects: %w","messagePattern":"error configuring cluster CAPI objects: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/controllers/clusterapi/cluster_controller.go","lineNumber":71,"sourceCode":"\tclient client.Client\n}\n\n// +kubebuilder:rbac:groups=,resources=nodes,verbs=get;list;watch;patch\n// Reconcile is the main reconciler function that observes node changes.\nfunc (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tcluster := &kopsapi.Cluster{}\n\tif err := r.client.Get(ctx, req.NamespacedName, cluster); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tclusterScope := &clusterScope{\n\t\tCluster: cluster,\n\t}\n\tif err := clusterScope.Apply(ctx, r.client); err != nil {\n\t\treturn ctrl.Result{}, fmt.Errorf(\"error configuring cluster CAPI objects: %w\", err)\n\t}\n\n\treturn ctrl.Result{}, nil\n}\n\ntype clusterScope struct {\n\tCluster *kopsapi.Cluster\n\n\tcapiCluster      *unstructured.Unstructured\n\tcapiInfra        *unstructured.Unstructured\n\tcapiControlPlane *unstructured.Unstructured\n}\n\nfunc (s *clusterScope) namespace() string {\n\treturn \"kube-system\"\n}\n\nfunc (s *clusterScope) ssa(ctx context.Context, kube client.Client, u *unstructured.Unstructured) error {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/controllers/clusterapi/cluster_controller.go#L53-L89","documentation":"The CAPI cluster controller wraps any error returned by clusterScope.Apply when configuring Cluster API objects for a kops-managed cluster. The message is a wrapper whose inner error carries the real cause (e.g. GCP validation failures or server-side apply errors). Seeing it means reconciliation of a Cluster object failed while applying CAPI objects.","triggerScenarios":"Reconcile() on a Cluster with CAPI configured calls clusterScope.Apply(ctx, client), which internally dispatches to per-cloud apply functions; any error from those is wrapped here.","commonSituations":"GCP clusters missing project/region/network fields; server-side apply failures against the management cluster; cloudgrpclient errors when contacting GCP APIs.","solutions":["Inspect the wrapped inner error ('%w' chain) in the controller log for the root cause","Fix the cluster spec fields indicated by the inner error (project, region, networkID, subnets)","Re-run the controller / trigger reconciliation after correcting the spec"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if cluster.Spec.Project == \"\" && hasGCPSubnets(cluster) {\n\treturn fmt.Errorf(\"spec.project must be set for GCP CAPI clusters\")\n}","typeGuard":null,"tryCatchPattern":"if err := clusterScope.Apply(ctx, r.client); err != nil {\n\treturn ctrl.Result{}, fmt.Errorf(\"error configuring cluster CAPI objects: %w\", err)\n}","preventionTips":["Read the full wrapped error chain, not just the wrapper message","Validate cluster spec before reconciliation (project, region, networkID)","Keep CAPI provider CRDs installed and RBAC correct"],"tags":["clusterapi","controller","reconcile"],"backgroundTag":"capi-reconcile-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}