EdgeApplication resource override fails for qualified resource names
What happened:
ResourcesOverrider.ApplyOverrides fails when replacing an existing resource key that contains /, such as nvidia.com/gpu. For a Deployment container with requests["nvidia.com/gpu"] = "1", overriding the request to "2" returns:
replace operation does not apply: doc is missing path:
/spec/template/spec/containers/0/resources/requests/nvidia.com/gpuThe corresponding limits override fails in the same way. This affects EdgeApplication resource overrides for qualified resource names.
What you expected to happen:
The resource name should remain one map key, so the override changes requests["nvidia.com/gpu"] from "1" to "2". The same should work for limits.
How to reproduce it (as minimally and precisely as possible):
- At
mastercommitceb5eacd15ecd7c4c92907542c205f4a5f464108, construct an unstructured Deployment with one container namedinferenceand existingrequestsandlimitsmaps containing"nvidia.com/gpu": "1". - Call
ResourcesOverrider.ApplyOverridesfor that container with aResourcesOverridervalue ofresource.MustParse("2")for the request, the limit, or both. - Each qualified-name case returns a missing-path error. The corresponding ordinary
cpuandmemorycases succeed.
This is reproducible in a focused Go unit test without a Kubernetes cluster or EdgeCore process.
Anything else we need to know?:
The resource name is inserted verbatim into a JSON Patch path as .../requests/nvidia.com/gpu, where / splits it into two path segments. RFC 6901 requires the slash inside the resource-name token to be encoded as ~1 (.../requests/nvidia.com~1gpu).
Environment:
Kubernetes version (use
kubectl version): Not applicable to the focused unit reproduction.KubeEdge version(e.g.
cloudcore --versionandedgecore --version):masteratceb5eacd15ecd7c4c92907542c205f4a5f464108; no CloudCore or EdgeCore process was required.- Cloud nodes Environment:
- Hardware configuration (e.g.
lscpu): x86_64, Intel Core i9-14900HX, 32 logical CPUs. - OS (e.g.
cat /etc/os-release): Ubuntu 22.04.5 LTS in WSL2. - Kernel (e.g.
uname -a): Linux 6.6.87.2-microsoft-standard-WSL2 x86_64. - Go version (e.g.
go version): go1.25.14 linux/amd64. - Others: Focused Go unit reproduction against an unstructured Deployment object.
- Hardware configuration (e.g.
- Edge nodes Environment:
- edgecore version (e.g.
edgecore --version): Not applicable to the focused unit reproduction. - Hardware configuration (e.g.
lscpu): Not applicable to the focused unit reproduction. - OS (e.g.
cat /etc/os-release): Not applicable to the focused unit reproduction. - Kernel (e.g.
uname -a): Not applicable to the focused unit reproduction. - Go version (e.g.
go version): Not applicable to the focused unit reproduction. - Others: No edge node was used.
- edgecore version (e.g.
Source: kubeedge/kubeedge