Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
k8s: Disallow unknown fields in CNP & CCNP
Previously, the `x-kubernetes-preserve-unknown-fields` field was set to true because it was incorrectly thought to have disallowed an empty spec in a CNP / CCNP (empty rule). In reality, it is not needed at all, and actually allows additional unknown fields to be permitted. Policies such as the following would be allowed, bypassing the schema validation of the CRD (note the `toFQDNs2`). ``` apiVersion: "cilium.io/v2" kind: CiliumClusterwideNetworkPolicy metadata: name: "denylist" spec: endpointSelector: matchLabels: k8s-app.guestbook: web egress: - toEndpoints: - matchLabels: "k8s:io.kubernetes.pod.namespace": kube-system "k8s:k8s-app": kube-dns toPorts: - ports: - port: "53" protocol: ANY rules: dns: - matchPattern: "*" - toFQDNs2: - matchName: "www.google.com" ``` Fixes: 691f831 ("k8s, examples: Preserve unknown fields in {C,CC}NP") Revert "k8s, examples: Preserve unknown fields in {C,CC}NP" This reverts commit 691f831. Reported-by: André Martins <andre@cilium.io> Signed-off-by: Chris Tarazi <chris@isovalent.com>
- Loading branch information