From d9c1d27b4473f1e2fb8616d97f12ec052297a14f Mon Sep 17 00:00:00 2001 From: Andrea Panattoni Date: Fri, 4 Oct 2024 10:24:15 +0200 Subject: [PATCH] Add EndPort to `v1beta1` Add `EndPort` field to `scheme.yml` and `MultiNetworkPolicyPort` Go type. Signed-off-by: Andrea Panattoni --- pkg/apis/k8s.cni.cncf.io/v1beta1/types.go | 3 +++ .../v1beta1/zz_generated.deepcopy.go | 5 +++++ scheme.yml | 16 ++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/pkg/apis/k8s.cni.cncf.io/v1beta1/types.go b/pkg/apis/k8s.cni.cncf.io/v1beta1/types.go index 14f65b4..29d0d33 100644 --- a/pkg/apis/k8s.cni.cncf.io/v1beta1/types.go +++ b/pkg/apis/k8s.cni.cncf.io/v1beta1/types.go @@ -98,6 +98,9 @@ type MultiNetworkPolicyPort struct { // +optional Port *intstr.IntOrString `json:"port,omitempty"` + + // +optional + EndPort *int32 `json:"endPort,omitempty"` } // IPBlock ... diff --git a/pkg/apis/k8s.cni.cncf.io/v1beta1/zz_generated.deepcopy.go b/pkg/apis/k8s.cni.cncf.io/v1beta1/zz_generated.deepcopy.go index 91b464a..12ed1c7 100644 --- a/pkg/apis/k8s.cni.cncf.io/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/k8s.cni.cncf.io/v1beta1/zz_generated.deepcopy.go @@ -213,6 +213,11 @@ func (in *MultiNetworkPolicyPort) DeepCopyInto(out *MultiNetworkPolicyPort) { *out = new(intstr.IntOrString) **out = **in } + if in.EndPort != nil { + in, out := &in.EndPort, &out.EndPort + *out = new(int32) + **out = **in + } return } diff --git a/scheme.yml b/scheme.yml index 65cf6be..96ebcd7 100644 --- a/scheme.yml +++ b/scheme.yml @@ -59,6 +59,14 @@ spec: be a numerical or named port on a pod. If this field is not provided, this matches all port names and numbers." x-kubernetes-int-or-string: true + endPort: + type: integer + format: int32 + description: "If set, indicates that the range of ports from + port to endPort, inclusive, should be allowed by the policy. + This field cannot be defined if the port field is not + defined or if the port field is defined as a named (string) + port. The endPort must be equal or greater than port." protocol: description: "The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP." @@ -373,6 +381,14 @@ spec: be a numerical or named port on a pod. If this field is not provided, this matches all port names and numbers." x-kubernetes-int-or-string: true + endPort: + type: integer + format: int32 + description: "If set, indicates that the range of ports from + port to endPort, inclusive, should be allowed by the policy. + This field cannot be defined if the port field is not + defined or if the port field is defined as a named (string) + port. The endPort must be equal or greater than port." protocol: description: "The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP."