kubernetes/kops · error

in TemplateFunction CloudControllerConfigArgv: %w

Error message

in TemplateFunction CloudControllerConfigArgv: %w

What it means

In buildAddons, when an externally provided cloud-controller-manager addon manifest targets kube-system, kops recomputes its container args via b.addonRenderer.CloudControllerConfigArgv(). If that TemplateFunction fails (e.g. cluster config fields needed to build argv are missing or invalid), the error is wrapped and addon building aborts.

Source

Thrown at upup/pkg/fi/cloudup/bootstrapchannelbuilder/bootstrapchannelbuilder.go:923

			useBuiltin := !b.hasExternalAddon(key)

			if !useBuiltin {
				klog.Infof("Found cloud-controller-manager in addons; won't use builtin")

				// Until we make the manifest extensible, we still need to inject our arguments.
				// TODO(justinsb): we don't really want to do this, it limits the ability for users to override things.
				// However, this is behind a feature flag at the moment, and this way we can work towards something better.
				gkDaemonset := schema.GroupKind{Group: "apps", Kind: "DaemonSet"}
				for _, addon := range b.ClusterAddons {
					if addon.GroupVersionKind().GroupKind() == gkDaemonset &&
						addon.GetName() == "cloud-controller-manager" &&
						addon.GetNamespace() == "kube-system" {

						klog.Infof("replacing arguments in externally provided cloud-controller-manager")

						args, err := b.addonRenderer.CloudControllerConfigArgv()
						if err != nil {
							return nil, nil, fmt.Errorf("in TemplateFunction CloudControllerConfigArgv: %w", err)
						}

						if err := addon.VisitContainers(func(container map[string]interface{}) error {
							// TODO: Check name?
							container["args"] = args
							return nil
						}); err != nil {
							return nil, nil, fmt.Errorf("error visiting containers: %w", err)
						}
					}
				}
			}

			if useBuiltin {
				id := "k8s-1.23"
				location := key + "/" + id + ".yaml"
				addon := addons.Add(&channelsapi.AddonSpec{
					Name:     new(key),

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the wrapped error for which argument/config value failed
  2. Validate cluster.spec.cloudProvider and cloudConfiguration before build
  3. Update or remove the external CCM addon so the builtin one is used
  4. Upgrade kops to a version with fixes for CloudControllerConfigArgv

Example fix

// before (cluster.yaml)
spec:
  cloudProvider: openstack
  # cloudConfiguration omitted
// after
spec:
  cloudProvider: openstack
  cloudConfiguration:
    kubernetesIngress: proxy
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure cloud provider config is present before building CCM addons
if b.Cluster.Spec.CloudConfig == nil && requiresCloudConfig(b.Cluster.Spec.CloudProvider) {
    return errors.New("cloudConfiguration required for external CCM addon")
}

Try / catch

args, err := b.addonRenderer.CloudControllerConfigArgv()
if err != nil {
    return fmt.Errorf("cannot rebuild CCM args, check cluster cloudProvider/cloudConfiguration: %w", err)
}

Prevention

When it happens

Trigger: Building a cluster with an external cloud-controller-manager addon in kube-system whose rendering triggers CloudControllerConfigArgv, and the function errors because required cluster spec fields (cloud provider, config) are invalid or unsupported.

Common situations: Misconfigured cloud provider or missing cloudConfiguration in the cluster spec; external CCM addon channel incompatible with the kops version; invalid kubernetes version-derived flags.

Related errors


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