Skip to content

Commit dfafbc5

Browse files
authored
Merge pull request #250 from npinaeva/set-min-ports
Disallow empty port list for ANP peers.
2 parents 990c5a1 + a14d924 commit dfafbc5

6 files changed

+12
-0
lines changed

apis/v1alpha1/adminnetworkpolicy_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ type AdminNetworkPolicyIngressRule struct {
155155
// Support: Core
156156
//
157157
// +optional
158+
// +kubebuilder:validation:MinItems=1
158159
// +kubebuilder:validation:MaxItems=100
159160
Ports *[]AdminNetworkPolicyPort `json:"ports,omitempty"`
160161
}
@@ -207,6 +208,7 @@ type AdminNetworkPolicyEgressRule struct {
207208
// Support: Core
208209
//
209210
// +optional
211+
// +kubebuilder:validation:MinItems=1
210212
// +kubebuilder:validation:MaxItems=100
211213
Ports *[]AdminNetworkPolicyPort `json:"ports,omitempty"`
212214
}

apis/v1alpha1/baselineadminnetworkpolicy_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ type BaselineAdminNetworkPolicyIngressRule struct {
136136
// Support: Core
137137
//
138138
// +optional
139+
// +kubebuilder:validation:MinItems=1
139140
// +kubebuilder:validation:MaxItems=100
140141
Ports *[]AdminNetworkPolicyPort `json:"ports,omitempty"`
141142
}
@@ -181,6 +182,7 @@ type BaselineAdminNetworkPolicyEgressRule struct {
181182
// This field is a list of destination ports for the outgoing egress traffic.
182183
// If Ports is not set then the rule does not filter traffic via port.
183184
// +optional
185+
// +kubebuilder:validation:MinItems=1
184186
// +kubebuilder:validation:MaxItems=100
185187
Ports *[]AdminNetworkPolicyPort `json:"ports,omitempty"`
186188
}

config/crd/experimental/policy.networking.k8s.io_adminnetworkpolicies.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ spec:
200200
type: object
201201
type: object
202202
maxItems: 100
203+
minItems: 1
203204
type: array
204205
to:
205206
description: |-
@@ -869,6 +870,7 @@ spec:
869870
type: object
870871
type: object
871872
maxItems: 100
873+
minItems: 1
872874
type: array
873875
required:
874876
- action

config/crd/experimental/policy.networking.k8s.io_baselineadminnetworkpolicies.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ spec:
190190
type: object
191191
type: object
192192
maxItems: 100
193+
minItems: 1
193194
type: array
194195
to:
195196
description: |-
@@ -808,6 +809,7 @@ spec:
808809
type: object
809810
type: object
810811
maxItems: 100
812+
minItems: 1
811813
type: array
812814
required:
813815
- action

config/crd/standard/policy.networking.k8s.io_adminnetworkpolicies.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ spec:
190190
type: object
191191
type: object
192192
maxItems: 100
193+
minItems: 1
193194
type: array
194195
to:
195196
description: |-
@@ -704,6 +705,7 @@ spec:
704705
type: object
705706
type: object
706707
maxItems: 100
708+
minItems: 1
707709
type: array
708710
required:
709711
- action

config/crd/standard/policy.networking.k8s.io_baselineadminnetworkpolicies.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ spec:
180180
type: object
181181
type: object
182182
maxItems: 100
183+
minItems: 1
183184
type: array
184185
to:
185186
description: |-
@@ -690,6 +691,7 @@ spec:
690691
type: object
691692
type: object
692693
maxItems: 100
694+
minItems: 1
693695
type: array
694696
required:
695697
- action

0 commit comments

Comments
 (0)