kubernetes/kops · error

controlPlaneRef.kind was %q for %v, expected KopsControlPlan

Error message

controlPlaneRef.kind was %q for %v, expected KopsControlPlane

What it means

The CAPI Cluster's spec.controlPlaneRef.kind is populated but is not 'KopsControlPlane'; the kOps controller can only reconcile control planes of that kind, so the cluster is being driven by an incompatible provider.

Source

Thrown at pkg/controllers/clusterapi/utils.go:124

	return cluster, nil
}

func getKopsControlPlaneFromCAPICluster(ctx context.Context, kube client.Client, capiCluster *unstructured.Unstructured) (*v1beta1.KopsControlPlane, error) {
	capiClusterKey := types.NamespacedName{
		Namespace: capiCluster.GetNamespace(),
		Name:      capiCluster.GetName(),
	}
	name, _, _ := unstructured.NestedString(capiCluster.Object, "spec", "controlPlaneRef", "name")
	if name == "" {
		return nil, fmt.Errorf("controlPlaneRef.name not set for %v", capiClusterKey)
	}
	kind, _, _ := unstructured.NestedString(capiCluster.Object, "spec", "controlPlaneRef", "kind")
	if kind == "" {
		return nil, fmt.Errorf("controlPlaneRef.kind not set for %v", capiClusterKey)
	}
	if kind != "KopsControlPlane" {
		return nil, fmt.Errorf("controlPlaneRef.kind was %q for %v, expected KopsControlPlane", kind, capiClusterKey)
	}

	key := types.NamespacedName{
		Namespace: capiCluster.GetNamespace(),
		Name:      name,
	}

	// TODO: Add ip addresses to status

	kopsControlPlane := &v1beta1.KopsControlPlane{}
	if err := kube.Get(ctx, key, kopsControlPlane); err != nil {
		return nil, fmt.Errorf("error fetching KopsControlPlane %v: %w", key, err)
	}

	return kopsControlPlane, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Point controlPlaneRef at the KopsControlPlane resource for this cluster
  2. Remove the foreign controlPlaneRef if this cluster is not meant to be kOps-managed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/controllers/clusterapi/utils.go:124 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/beb43107fdd29aff. Report an issue: GitHub.