Skip to content

Commit 9b8d48e

Browse files
committed
Change to sensible path defaults
1 parent 27365fc commit 9b8d48e

File tree

3 files changed

+27
-36
lines changed

3 files changed

+27
-36
lines changed

apis/v1alpha1/wafpolicy_types.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ type WAFPolicyList struct {
3838
type WAFPolicySpec struct {
3939
// PolicySource defines the source location and configuration for the compiled WAF policy bundle.
4040
//
41-
// +kubebuilder:validation:Required
42-
PolicySource WAFPolicySource `json:"policySource"`
41+
// +optional
42+
PolicySource *WAFPolicySource `json:"policySource,omitempty"`
4343

4444
// TargetRef identifies an API object to apply the policy to.
4545
// Object must be in the same namespace as the policy.
@@ -88,7 +88,7 @@ type WAFPolicySource struct {
8888
// FileLocation defines the location of the WAF policy file.
8989
//
9090
// +kubebuilder:validation:MinLength=1
91-
// +kubebuilder:validation:MaxLength=2048
91+
// +kubebuilder:validation:MaxLength=256
9292
FileLocation string `json:"fileLocation"`
9393
}
9494

@@ -127,7 +127,7 @@ const (
127127
// WAFPolicyPolling defines the polling configuration for automatic WAF policy change detection.
128128
type WAFPolicyPolling struct {
129129
// Enabled indicates whether polling is enabled for automatic WAF policy change detection.
130-
// When enabled, NGF will periodically check for policy changes using checksum validation.
130+
// When enabled, NGINX Gateway Fabric will periodically check for policy changes using checksum validation.
131131
//
132132
// +optional
133133
// +kubebuilder:default=false
@@ -163,7 +163,6 @@ type WAFPolicyRetry struct {
163163
// Supported values: "exponential", "linear"
164164
//
165165
// +optional
166-
// +kubebuilder:validation:Enum=exponential;linear
167166
// +kubebuilder:default="exponential"
168167
Backoff *WAFPolicyRetryBackoff `json:"backoff,omitempty"`
169168

@@ -241,7 +240,7 @@ type SecurityLogDestination struct {
241240
// Type identifies the type of security log destination.
242241
//
243242
// +unionDiscriminator
244-
// +kubebuilder:default=stderr
243+
// +kubebuilder:default:=stderr
245244
Type SecurityLogDestinationType `json:"type"`
246245
}
247246

@@ -265,7 +264,7 @@ type SecurityLogFile struct {
265264
// Must be accessible to the waf-enforcer container.
266265
//
267266
// +kubebuilder:validation:MinLength=1
268-
// +kubebuilder:validation:MaxLength=4096
267+
// +kubebuilder:validation:MaxLength=256
269268
// +kubebuilder:validation:Pattern=`^/.*$`
270269
Path string `json:"path"`
271270
}
@@ -281,6 +280,7 @@ type SecurityLogSyslog struct {
281280
}
282281

283282
// LogProfile defines the built-in logging profiles available in NGINX App Protect.
283+
//
284284
// +kubebuilder:validation:Enum=log_default;log_all;log_illegal;log_blocked;log_grpc_all;log_grpc_blocked;log_grpc_illegal
285285
//
286286
//nolint:lll

apis/v1alpha1/zz_generated.deepcopy.go

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/gateway.nginx.org_wafpolicies.yaml

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ spec:
6868
- name
6969
type: object
7070
fileLocation:
71-
description: |-
72-
FileLocation defines the location of the WAF policy file.
73-
Supports various protocols: s3://, https://, http://, file://
74-
Examples: "s3://bucket/policy.tgz", "https://example.com/policy.tgz"
75-
maxLength: 2048
71+
description: FileLocation defines the location of the WAF policy
72+
file.
73+
maxLength: 256
7674
minLength: 1
7775
type: string
7876
polling:
@@ -89,7 +87,7 @@ spec:
8987
default: false
9088
description: |-
9189
Enabled indicates whether polling is enabled for automatic WAF policy change detection.
92-
When enabled, NGF will periodically check for policy changes using checksum validation.
90+
When enabled, NGINX Gateway Fabric will periodically check for policy changes using checksum validation.
9391
type: boolean
9492
interval:
9593
default: 5m
@@ -113,17 +111,13 @@ spec:
113111
minimum: 0
114112
type: integer
115113
backoff:
116-
allOf:
117-
- enum:
118-
- exponential
119-
- linear
120-
- enum:
121-
- exponential
122-
- linear
123114
default: exponential
124115
description: |-
125116
Backoff defines the backoff strategy for retry attempts.
126117
Supported values: "exponential", "linear"
118+
enum:
119+
- exponential
120+
- linear
127121
type: string
128122
maxDelay:
129123
default: 5m
@@ -180,7 +174,7 @@ spec:
180174
description: |-
181175
Path is the file path where security logs will be written.
182176
Must be accessible to the waf-enforcer container.
183-
maxLength: 4096
177+
maxLength: 256
184178
minLength: 1
185179
pattern: ^/.*$
186180
type: string
@@ -255,11 +249,9 @@ spec:
255249
- name
256250
type: object
257251
fileLocation:
258-
description: |-
259-
FileLocation defines the location of the WAF policy file.
260-
Supports various protocols: s3://, https://, http://, file://
261-
Examples: "s3://bucket/policy.tgz", "https://example.com/policy.tgz"
262-
maxLength: 2048
252+
description: FileLocation defines the location of the WAF
253+
policy file.
254+
maxLength: 256
263255
minLength: 1
264256
type: string
265257
polling:
@@ -276,7 +268,7 @@ spec:
276268
default: false
277269
description: |-
278270
Enabled indicates whether polling is enabled for automatic WAF policy change detection.
279-
When enabled, NGF will periodically check for policy changes using checksum validation.
271+
When enabled, NGINX Gateway Fabric will periodically check for policy changes using checksum validation.
280272
type: boolean
281273
interval:
282274
default: 5m
@@ -300,17 +292,13 @@ spec:
300292
minimum: 0
301293
type: integer
302294
backoff:
303-
allOf:
304-
- enum:
305-
- exponential
306-
- linear
307-
- enum:
308-
- exponential
309-
- linear
310295
default: exponential
311296
description: |-
312297
Backoff defines the backoff strategy for retry attempts.
313298
Supported values: "exponential", "linear"
299+
enum:
300+
- exponential
301+
- linear
314302
type: string
315303
maxDelay:
316304
default: 5m
@@ -396,7 +384,6 @@ spec:
396384
- message: TargetRef Group must be gateway.networking.k8s.io.
397385
rule: (self.group=='gateway.networking.k8s.io')
398386
required:
399-
- policySource
400387
- targetRef
401388
type: object
402389
status:

0 commit comments

Comments
 (0)