{"record":{"id":"160dd59213df1055","repo":"kubernetes/kops","slug":"applying-gcpcluster-object-to-cluster-w","errorCode":null,"errorMessage":"applying GCPCluster object to cluster: %w","messagePattern":"applying GCPCluster object to cluster: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/controllers/clusterapi/cluster_controller.go","lineNumber":161,"sourceCode":"\t\t\"metadata\": map[string]any{\n\t\t\t\"name\":      name,\n\t\t\t\"namespace\": s.namespace(),\n\t\t},\n\t\t\"spec\": map[string]any{\n\t\t\t\"project\": gcpProject,\n\t\t\t\"region\":  gcpRegion,\n\t\t\t\"network\": map[string]any{\n\t\t\t\t\"name\": gcpNetworkName,\n\t\t\t},\n\t\t},\n\t}\n\n\tu := &unstructured.Unstructured{Object: obj}\n\n\t// setOwnerRef(u, s.Cluster)\n\n\tif err := s.ssa(ctx, kube, u); err != nil {\n\t\treturn fmt.Errorf(\"applying GCPCluster object to cluster: %w\", err)\n\t}\n\n\ts.capiInfra = u\n\treturn nil\n}\n\nfunc (s *clusterScope) findSystemEndpoints(ctx context.Context) ([]capikops.SystemEndpoint, error) {\n\tcluster := s.Cluster\n\n\tclusterInternal := &kops.Cluster{}\n\tif err := kopscodecs.Scheme.Convert(cluster, clusterInternal, nil); err != nil {\n\t\treturn nil, fmt.Errorf(\"converting cluster object: %w\", err)\n\t}\n\n\tcloud, err := cloudup.BuildCloud(clusterInternal)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/controllers/clusterapi/cluster_controller.go#L143-L179","documentation":"applyGCPCluster builds an unstructured GCPCluster object and applies it to the management cluster with server-side apply (ssa). Any failure from that apply (API errors, conflicts, RBAC, invalid fields) is wrapped with this message. It means the infrastructure GCPCluster resource could not be created or updated in the management cluster.","triggerScenarios":"clusterScope.Apply() calling s.ssa(ctx, kube, u) with the constructed GCPCluster unstructured object during reconciliation.","commonSituations":"infrastructure.cluster.x-k8s.io CRDs not installed (GCPCluster kind unknown); RBAC denying the controller; field manager conflicts from another controller owning fields; invalid field values rejected by the API server.","solutions":["Install/upgrade the CAPG (Cluster API Provider GCP) CRDs in the management cluster","Check the wrapped inner error: fix RBAC or field-manager conflict it reports","Validate the generated GCPCluster fields against the CRD schema"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify CRD exists before applying\nif err := kube.Get(ctx, client.ObjectKey{}, &apiextensionsv1.CustomResourceDefinition{ObjectMeta: metav1.ObjectMeta{Name: \"gcpclusters.infrastructure.cluster.x-k8s.io\"}}); err != nil {\n\treturn fmt.Errorf(\"CAPG CRDs not installed: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := s.ssa(ctx, kube, u); err != nil {\n\tif apierrors.IsConflict(err) {\n\t\treturn retrySSAWithFreshFieldManager(ctx, kube, u)\n\t}\n\treturn fmt.Errorf(\"applying GCPCluster object to cluster: %w\", err)\n}","preventionTips":["Install Cluster API Provider GCP CRDs before reconciling GCP clusters","Grant the controller RBAC on infrastructure.cluster.x-k8s.io resources","Use distinct field managers to avoid apply ownership conflicts"],"tags":["gcp","clusterapi","server-side-apply","kubernetes"],"backgroundTag":"server-side-apply-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"}