-
Dmitry Rozhkov authored
A mutating admission controller webhook doesn't remove object fields when instructed to. E.g. when the JSON patch [ {"op": "remove", "path": "/spec/containers/0/resources/limits/fpga-arria10"}, {"op": "add", "path": "/spec/containers/0/resources/limits/fpga-interface-id-524abcf", "value": 1} ] is applied to this pod apiVersion: v1 kind: Pod metadata: name: test-pod spec: restartPolicy: Never containers: - name: test-pod-container image: ubuntu:bionic imagePullPolicy: IfNotPresent command: [ "ls", "-l", "/" ] resources: limits: fpga-arria10: 1 in order to replace the resource name "fpga-arria10" with something understandable by the device plugin the resulting pod spec still contains the old field plus a new one. The resulting pod looks like apiVersion: v1 kind: Pod metadata: name: test-pod spec: restartPolicy: Never containers: - name: test-pod-container image: ubuntu:bionic imagePullPolicy: IfNotPresent command: [ "ls", "-l", "/" ] resources: limits: fpga-arria10: 1 fpga-interface-id-524abcf: 1 The patch unmarshals patched JSON into a new empty object instead of existing one. Otherwise JSON unmarshaling reuses existing maps, keeping existing entries as specified in the "encoding/json" standard package.4a72e17b
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| src/k8s.io | ||
| BUILD | ||
| OWNERS | ||
| README.md |