{"record":{"id":"e2ef1a883a54e82f","repo":"cilium/cilium","slug":"w-s-on-pools-s-and-s","errorCode":null,"errorMessage":"%w: %s on pools %s and %s","messagePattern":"%w: (.+?) on pools (.+?) and (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/networkdriver/config.go","lineNumber":21,"sourceCode":"\npackage networkdriver\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"slices\"\n\n\t\"github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1\"\n)\n\n// validateFilters ensures that we do not have more than one filter matching the same device.\n// 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}","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/networkdriver/config.go#L3-L39","documentation":"validateFilters rejects pool configs where the same interface name (IfName) appears in more than one CiliumNetworkDriverDevicePoolConfig. It wraps errIfNameInMultiplePools and names the offending interface and both conflicting pools. An interface can only belong to a single pool.","triggerScenarios":"Two device pools in the CiliumNetworkDriver config list the same entry in spec.pools[].filter.ifNames; validateFilters is invoked from validatePools while checking one pool against all others.","commonSituations":"Copy-pasting a pool definition and forgetting to change the ifNames filter; merging two configs where both claim e.g. eth1; typo'd ifname that coincidentally matches another pool's entry.","solutions":["Remove the duplicated ifName from one of the pools' filter.ifNames lists","Give each pool a disjoint set of interface names so filters don't overlap","Use shared fields (driver, vendor, deviceId, pfName) for grouping, but keep exclusive fields like ifName/pciAddr unique per pool"],"exampleFix":"// before\npools:\n- name: pool-a\n  filter: {ifNames: [eth1, eth2]}\n- name: pool-b\n  filter: {ifNames: [eth1, eth3]}\n// after\npools:\n- name: pool-a\n  filter: {ifNames: [eth1, eth2]}\n- name: pool-b\n  filter: {ifNames: [eth3, eth4]}","handlingStrategy":"validation","validationCode":"func ifNamesDisjoint(pools []v2alpha1.CiliumNetworkDriverDevicePoolConfig) error {\n    seen := map[string]string{}\n    for _, p := range pools {\n        for _, n := range p.Filter.IfNames {\n            if owner, ok := seen[n]; ok {\n                return fmt.Errorf(\"ifname %s in pools %s and %s\", n, owner, p.PoolName)\n            }\n            seen[n] = p.PoolName\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := validateConfig(cfg); err != nil {\n    if errors.Is(err, errIfNameInMultiplePools) {\n        // surface which pools conflict; abort apply\n    }\n    return err\n}","preventionTips":["Validate pool configs in CI before applying","Keep ifName/pciAddr filters exclusive per pool","Review copy-pasted pool blocks for overlapping filters"],"tags":["go","config","validation","networkdriver","device-pools"],"backgroundTag":"duplicate-resource-assignment","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}