{"record":{"id":"a07aa845348a2c56","repo":"cilium/cilium","slug":"w-s-a07aa8","errorCode":null,"errorMessage":"%w: %s","messagePattern":"%w: %s","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/networkdriver/config.go","lineNumber":33,"sourceCode":"// some filter fields can be shared among devices (ex: driver, vendor, device id, pf name), but others\n// can't (ex: ifname, pciaddr).\nfunc validateFilters(this v2alpha1.CiliumNetworkDriverDevicePoolConfig, others ...v2alpha1.CiliumNetworkDriverDevicePoolConfig) error {\n\tfor _, ifname := range this.Filter.IfNames {\n\t\tfor _, otherPool := range others {\n\t\t\tif slices.Contains(otherPool.Filter.IfNames, ifname) {\n\t\t\t\treturn fmt.Errorf(\"%w: %s on pools %s and %s\", errIfNameInMultiplePools, ifname, this.PoolName, otherPool.PoolName)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// validatePools ensures that there are not any conflicting pool definitions.\nfunc validatePools(this v2alpha1.CiliumNetworkDriverDevicePoolConfig, others ...v2alpha1.CiliumNetworkDriverDevicePoolConfig) error {\n\tfor _, p := range others {\n\t\tif this.PoolName == p.PoolName {\n\t\t\treturn fmt.Errorf(\"%w: %s\", errDuplicatedPoolName, this.PoolName)\n\t\t}\n\n\t\tif err := validateFilters(this, others...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// validateConfig ensures a configuration is sane.\nfunc validateConfig(c *v2alpha1.CiliumNetworkDriverNodeConfigSpec) error {\n\tif c == nil {\n\t\t// empty config is valid\n\t\treturn nil\n\t}\n\n\t// we dont allow pool definitions that allow matching","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/networkdriver/config.go#L15-L51","documentation":"validatePools ensures no conflicting pool definitions and wraps errDuplicatedPoolName when two pools share the same PoolName. Pool names must be unique because the DRA driver registers resources per pool name. The message includes the duplicated name.","triggerScenarios":"The CiliumNetworkDriver config contains two device pool entries with identical poolName; validatePools compares each pool against the others during validateConfig.","commonSituations":"Copy-pasted pool blocks without renaming; YAML anchors/merge producing duplicate names; automated config generation emitting the same name twice.","solutions":["Rename one of the pools so every poolName is unique in the config","Fix config templating/generation to guarantee unique names","Run validateConfig on the config before applying it to catch duplicates early"],"exampleFix":"// before\npools:\n- name: sriov-pool\n  filter: {pciAddrs: [\"0000:01:00.0\"]}\n- name: sriov-pool\n  filter: {pciAddrs: [\"0000:01:00.1\"]}\n// after\npools:\n- name: sriov-pool-0\n  filter: {pciAddrs: [\"0000:01:00.0\"]}\n- name: sriov-pool-1\n  filter: {pciAddrs: [\"0000:01:00.1\"]}","handlingStrategy":"validation","validationCode":"func uniquePoolNames(pools []v2alpha1.CiliumNetworkDriverDevicePoolConfig) error {\n    seen := map[string]bool{}\n    for _, p := range pools {\n        if seen[p.PoolName] {\n            return fmt.Errorf(\"duplicate pool name %s\", p.PoolName)\n        }\n        seen[p.PoolName] = true\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := validateConfig(cfg); err != nil {\n    if errors.Is(err, errDuplicatedPoolName) {\n        return fmt.Errorf(\"rename one of the duplicated pools: %w\", err)\n    }\n    return err\n}","preventionTips":["Enforce unique pool names at config-generation time","Lint YAML configs for duplicate keys/anchors before apply","Add a unit test asserting validateConfig rejects duplicates"],"tags":["go","config","validation","networkdriver","naming"],"backgroundTag":"duplicate-resource-assignment","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}