{"record":{"id":"2ee54e03b760c566","repo":"kubernetes/kops","slug":"in-templatefunction-cloudcontrollerconfigargv-w","errorCode":null,"errorMessage":"in TemplateFunction CloudControllerConfigArgv: %w","messagePattern":"in TemplateFunction CloudControllerConfigArgv: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/bootstrapchannelbuilder/bootstrapchannelbuilder.go","lineNumber":923,"sourceCode":"\t\t\tuseBuiltin := !b.hasExternalAddon(key)\n\n\t\t\tif !useBuiltin {\n\t\t\t\tklog.Infof(\"Found cloud-controller-manager in addons; won't use builtin\")\n\n\t\t\t\t// Until we make the manifest extensible, we still need to inject our arguments.\n\t\t\t\t// TODO(justinsb): we don't really want to do this, it limits the ability for users to override things.\n\t\t\t\t// However, this is behind a feature flag at the moment, and this way we can work towards something better.\n\t\t\t\tgkDaemonset := schema.GroupKind{Group: \"apps\", Kind: \"DaemonSet\"}\n\t\t\t\tfor _, addon := range b.ClusterAddons {\n\t\t\t\t\tif addon.GroupVersionKind().GroupKind() == gkDaemonset &&\n\t\t\t\t\t\taddon.GetName() == \"cloud-controller-manager\" &&\n\t\t\t\t\t\taddon.GetNamespace() == \"kube-system\" {\n\n\t\t\t\t\t\tklog.Infof(\"replacing arguments in externally provided cloud-controller-manager\")\n\n\t\t\t\t\t\targs, err := b.addonRenderer.CloudControllerConfigArgv()\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn nil, nil, fmt.Errorf(\"in TemplateFunction CloudControllerConfigArgv: %w\", err)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif err := addon.VisitContainers(func(container map[string]interface{}) error {\n\t\t\t\t\t\t\t// TODO: Check name?\n\t\t\t\t\t\t\tcontainer[\"args\"] = args\n\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t}); err != nil {\n\t\t\t\t\t\t\treturn nil, nil, fmt.Errorf(\"error visiting containers: %w\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif useBuiltin {\n\t\t\t\tid := \"k8s-1.23\"\n\t\t\t\tlocation := key + \"/\" + id + \".yaml\"\n\t\t\t\taddon := addons.Add(&channelsapi.AddonSpec{\n\t\t\t\t\tName:     new(key),","sourceCodeStart":905,"sourceCodeEnd":941,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/bootstrapchannelbuilder/bootstrapchannelbuilder.go#L905-L941","documentation":"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.","triggerScenarios":"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.","commonSituations":"Misconfigured cloud provider or missing cloudConfiguration in the cluster spec; external CCM addon channel incompatible with the kops version; invalid kubernetes version-derived flags.","solutions":["Read the wrapped error for which argument/config value failed","Validate cluster.spec.cloudProvider and cloudConfiguration before build","Update or remove the external CCM addon so the builtin one is used","Upgrade kops to a version with fixes for CloudControllerConfigArgv"],"exampleFix":"// before (cluster.yaml)\nspec:\n  cloudProvider: openstack\n  # cloudConfiguration omitted\n// after\nspec:\n  cloudProvider: openstack\n  cloudConfiguration:\n    kubernetesIngress: proxy","handlingStrategy":"try-catch","validationCode":"// Ensure cloud provider config is present before building CCM addons\nif b.Cluster.Spec.CloudConfig == nil && requiresCloudConfig(b.Cluster.Spec.CloudProvider) {\n    return errors.New(\"cloudConfiguration required for external CCM addon\")\n}","typeGuard":null,"tryCatchPattern":"args, err := b.addonRenderer.CloudControllerConfigArgv()\nif err != nil {\n    return fmt.Errorf(\"cannot rebuild CCM args, check cluster cloudProvider/cloudConfiguration: %w\", err)\n}","preventionTips":["Set cloudConfiguration before enabling external CCM addons","Use kops builtin CCM unless an external one is required","Keep CCM addon channel compatible with your kops/k8s version","Run `kops validate cluster` after config changes"],"tags":["cloud-controller-manager","addons","args","kops"],"backgroundTag":"template-function-error","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}