kubernetes/kops · error

cloud cannot be nil

Error message

cloud cannot be nil

What it means

Defensive nil-check sentinel in PerformAssignments: the cloud interface argument is nil, so no cloud-specific defaults (network CIDRs, etcd, etc.) can be applied. Indicates a programming error in the caller — all listed callers (create/update/replace cluster flows) must pass an initialized cloud implementation.

Source

Thrown at upup/pkg/fi/cloudup/defaults.go:70

	for i := range c.Spec.EtcdClusters {
		etcdCluster := &c.Spec.EtcdClusters[i]
		if etcdCluster.Manager == nil {
			etcdCluster.Manager = &kops.EtcdManagerSpec{}
		}
		if etcdCluster.Manager.BackupRetentionDays == nil {
			etcdCluster.Manager.BackupRetentionDays = new(uint32(90))
		}
	}

	// Topology support
	// TODO Kris: Unsure if this needs to be here, or if the API conversion code will handle it
	if c.Spec.Networking.Topology == nil {
		c.Spec.Networking.Topology = &kops.TopologySpec{}
	}

	if cloud == nil {
		return fmt.Errorf("cloud cannot be nil")
	}

	if cloud.ProviderID() == kops.CloudProviderGCE {
		if err := gce.PerformNetworkAssignments(ctx, c, cloud); err != nil {
			return err
		}
	}

	if cloud.ProviderID() == kops.CloudProviderAWS && c.Spec.Networking.NetworkCIDR == "" {
		if c.SharedVPC() {
			vpcInfo, err := cloud.FindVPCInfo(c.Spec.Networking.NetworkID)
			if err != nil {
				return err
			}
			if vpcInfo == nil {
				return fmt.Errorf("unable to find Network ID %q", c.Spec.Networking.NetworkID)
			}
			c.Spec.Networking.NetworkCIDR = vpcInfo.CIDR

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure BuildCloud/cloud discovery succeeded before calling PerformAssignments
  2. Check the --cloud/provider flag produced a valid cloud instance
  3. Report as a bug if a valid cloud was expected
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/defaults.go:70 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/6206c06a02b09667. Report an issue: GitHub.