Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
policy: Fix CIDR json tag in CIDRRule
Without the omitempty tag, the following valid policy: ``` apiVersion: "cilium.io/v2" kind: CiliumNetworkPolicy metadata: name: "echo-ingress-from-cidr-group-ref" namespace: "default" spec: description: "Allow echo pods to receive ingress traffic from a specific CIDR Group" endpointSelector: matchLabels: kind: echo ingress: - fromCIDRSet: - cidrGroupRef: "connectivity-test-cidr-group" ``` cannot be correctly decoded from YAML: ``` CiliumNetworkPolicy.cilium.io "echo-ingress-from-cidr-group-ref" is invalid: [spec.ingress.fromCIDRSet.cidr: Invalid value: "": spec.ingress.fromCIDRSet.cidr in body should match '^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/([0-9]|[1-2][0-9]|3[0-2])$|^s*((([0-9A-Fa-f]{1,4}:){7}(:|([0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){6}:([0-9A-Fa-f]{1,4})?)|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){0,1}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){0,2}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){0,3}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){0,4}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){0,5}):([0-9A-Fa-f]{1,4})?))|(:(:|((:[0-9A-Fa-f]{1,4}){1,7}))))(%.+)?s*/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$', : Invalid value: "": "spec.ingress.fromCIDRSet" must validate one and only one schema (oneOf). Found 2 valid alternatives] ``` Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
- Loading branch information