{"record":{"id":"41afdd4ad9a8b448","repo":"kubernetes/kops","slug":"error-visiting-containers-w","errorCode":null,"errorMessage":"error visiting containers: %w","messagePattern":"error visiting containers: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/bootstrapchannelbuilder/bootstrapchannelbuilder.go","lineNumber":931,"sourceCode":"\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),\n\t\t\t\t\tManifest: new(location),\n\t\t\t\t\tSelector: map[string]string{\"k8s-addon\": key},\n\t\t\t\t\tId:       id,\n\t\t\t\t})\n\t\t\t\taddon.BuildPrune = true\n\t\t\t}\n\t\t}\n\t}","sourceCodeStart":913,"sourceCodeEnd":949,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/bootstrapchannelbuilder/bootstrapchannelbuilder.go#L913-L949","documentation":"After computing new args for an externally provided cloud-controller-manager addon, buildAddons walks the manifest containers with addon.VisitContainers to inject the args. This error wraps any failure from VisitContainers, typically a malformed manifest structure that cannot be traversed.","triggerScenarios":"Building a cluster with an external CCM addon whose manifest is not a valid Kubernetes pod-template structure (missing spec.template.spec.containers or unexpected shapes) causing VisitContainers to return an error.","commonSituations":"Hand-crafted or third-party CCM manifests with unusual structure; YAML that decodes but lacks expected container lists; addon channel drift after kops changes the expected schema.","solutions":["Validate the CCM addon manifest is a standard Deployment/DaemonSet with containers","Fix or regenerate the addon manifest from upstream","Remove the external addon to fall back to kops builtin CCM","Compare the manifest with the structure kops expects (spec.template.spec.containers)"],"exampleFix":"// before: nonstandard manifest\nkind: Pod\nspec:\n  containers: []\n// after: standard workload shape\nkind: DaemonSet\nspec:\n  template:\n    spec:\n      containers:\n      - name: ccm","handlingStrategy":"validation","validationCode":"// Ensure the manifest has a traversable pod template before VisitContainers\nvar addon struct { Spec struct { Template struct { Spec struct { Containers []map[string]interface{} `json:\"containers\"` } `json:\"spec\"` } `json:\"template\"` } `json:\"spec\"` }\nif err := yaml.Unmarshal(manifestBytes, &addon); err != nil || len(addon.Spec.Template.Spec.Containers) == 0 {\n    return errors.New(\"CCM manifest lacks spec.template.spec.containers\")\n}","typeGuard":null,"tryCatchPattern":"if err := addon.VisitContainers(setArgs); err != nil {\n    return fmt.Errorf(\"manifest not walkable; regenerate CCM manifest: %w\", err)\n}","preventionTips":["Use upstream CCM manifests as the base for edits","Keep workload kinds standard (Deployment/DaemonSet)","Validate manifests with kubectl before adding to a channel"],"tags":["addons","manifest","containers","kops"],"backgroundTag":"manifest-structure-invalid","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}