kubernetes/kops · error
converting cluster object: %w
Error message
converting cluster object: %w
What it means
findSystemEndpoints converts the kops Cluster API object (kops.Cluster from internalclientset) into the internal kops.Cluster type using the kops codec scheme, wrapping conversion failures. A failure means the external Cluster object contains fields/data the conversion scheme cannot translate.
Source
Thrown at pkg/controllers/clusterapi/cluster_controller.go:173
u := &unstructured.Unstructured{Object: obj}
// setOwnerRef(u, s.Cluster)
if err := s.ssa(ctx, kube, u); err != nil {
return fmt.Errorf("applying GCPCluster object to cluster: %w", err)
}
s.capiInfra = u
return nil
}
func (s *clusterScope) findSystemEndpoints(ctx context.Context) ([]capikops.SystemEndpoint, error) {
cluster := s.Cluster
clusterInternal := &kops.Cluster{}
if err := kopscodecs.Scheme.Convert(cluster, clusterInternal, nil); err != nil {
return nil, fmt.Errorf("converting cluster object: %w", err)
}
cloud, err := cloudup.BuildCloud(clusterInternal)
if err != nil {
return nil, err
}
// TODO: Sync with BuildKubecfg
ingresses, err := cloud.GetApiIngressStatus(clusterInternal)
if err != nil {
return nil, fmt.Errorf("error getting ingress status: %v", err)
}
var targets []capikops.SystemEndpoint
for _, ingress := range ingresses {
var target capikops.SystemEndpointView on GitHub (pinned to 4c8573c808)
Solutions
- Ensure the CAPI controller is built against the kops API version matching the cluster manifest
- Fix malformed fields reported by the conversion error
- Recreate/normalize the Cluster object through the API server (apply via kOps tooling) rather than hand-editing
Defensive patterns
Strategy: try-catch
Validate before calling
if cluster.APIVersion == "" || cluster.Kind == "" {
return fmt.Errorf("cluster object missing apiVersion/kind; cannot convert")
} Try / catch
clusterInternal := &kops.Cluster{}
if err := kopscodecs.Scheme.Convert(cluster, clusterInternal, nil); err != nil {
return nil, fmt.Errorf("converting cluster object: %w", err)
} Prevention
- Keep controller's kops API libraries in sync with the cluster manifest version
- Avoid hand-editing stored Cluster objects; apply via supported tooling
- Check the conversion error's field path to fix the offending spec field
When it happens
Trigger: clusterScope.findSystemEndpoints() called from createKopsControlPlane when kopscodecs.Scheme.Convert(cluster, clusterInternal, nil) errors.
Common situations: Version skew between the CAPI controller's kops API libraries and the cluster spec's stored API version; invalid or out-of-range field values that fail conversion validation; hand-edited manifests with malformed fields.
Related errors
- error building annotation patch: %v
- building node patch: %w
- error building node patch: %v
- marshalling nodeupConfig: %w
- error marshaling yaml: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/47659eb898c308ac.
Report an issue: GitHub.