Skip to content

Commit

Permalink
update codegen
Browse files Browse the repository at this point in the history
Signed-off-by: Haywood Shannon <[email protected]>

Signed-off-by: Haywood Shannon <[email protected]>
  • Loading branch information
haywoodsh committed Jan 31, 2025
1 parent c4b77ac commit 2a20bc5
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 4 deletions.
2 changes: 2 additions & 0 deletions config/crd/bases/k8s.nginx.org_policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ spec:
burst:
type: integer
condition:
description: RateLimitCondition defines a condition for a rate
limit policy.
properties:
default:
type: boolean
Expand Down
2 changes: 2 additions & 0 deletions deploy/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ spec:
burst:
type: integer
condition:
description: RateLimitCondition defines a condition for a rate
limit policy.
properties:
default:
type: boolean
Expand Down
8 changes: 4 additions & 4 deletions internal/configs/virtualserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6522,8 +6522,8 @@ func TestGenerateVirtualServerConfigRateLimitPolicyAuthJwt(t *testing.T) {
},
HTTPSnippets: []string{},
LimitReqZones: []version2.LimitReqZone{
{"test", "pol_rl_default_gold-rate-limit-policy_default_cafe", "10M", "10r/s"},
{"test", "pol_rl_default_silver-rate-limit-policy_default_cafe", "20M", "20r/s"},
{Key: "test", ZoneName: "pol_rl_default_gold-rate-limit-policy_default_cafe", ZoneSize: "10M", Rate: "10r/s"},
{Key: "test", ZoneName: "pol_rl_default_silver-rate-limit-policy_default_cafe", ZoneSize: "20M", Rate: "20r/s"},
},
Server: version2.Server{
JWTAuthList: nil,
Expand All @@ -6542,8 +6542,8 @@ func TestGenerateVirtualServerConfigRateLimitPolicyAuthJwt(t *testing.T) {
VSName: "cafe",
APIKeyEnabled: false,
LimitReqs: []version2.LimitReq{
{"pol_rl_default_gold-rate-limit-policy_default_cafe", 0, false, 0},
{"pol_rl_default_silver-rate-limit-policy_default_cafe", 0, false, 0},
{ZoneName: "pol_rl_default_gold-rate-limit-policy_default_cafe", Burst: 0, NoDelay: false, Delay: 0},
{ZoneName: "pol_rl_default_silver-rate-limit-policy_default_cafe", Burst: 0, NoDelay: false, Delay: 0},
},
LimitReqOptions: version2.LimitReqOptions{
DryRun: false,
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/configuration/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,15 @@ type RateLimit struct {
Condition *RateLimitCondition `json:"condition"`
}

// RateLimitCondition defines a condition for a rate limit policy.
type RateLimitCondition struct {
JWT JWTCondition `json:"jwt"`
// +kubebuilder:validation:Optional
Default bool `json:"default"`
}

// RateLimitCondition defines a condition for a rate limit by JWT claim.

type JWTCondition struct {

Check failure on line 626 in pkg/apis/configuration/v1/types.go

View workflow job for this annotation

GitHub Actions / Lint

exported: exported type JWTCondition should have comment or be unexported (revive)
// +kubebuilder:validation:Required
// +kubebuilder:validation:Pattern=`^([^$\s"'])*$`
Expand Down
38 changes: 38 additions & 0 deletions pkg/apis/configuration/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2a20bc5

Please sign in to comment.