Skip to content

Commit

Permalink
Add support for name in limit definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsnaps committed Nov 8, 2023
1 parent c172d5f commit 7e876a9
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/v1alpha1/limitador_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ type RateLimit struct {
Namespace string `json:"namespace"`
Seconds int `json:"seconds"`
Variables []string `json:"variables"`
Name string `json:"name,omitempty"`
}

// LimitadorStatus defines the observed state of Limitador
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ metadata:
"get_toy == 'yes'"
],
"max_value": 2,
"name": "toy_get_route",
"namespace": "toystore-app",
"seconds": 30,
"variables": []
Expand All @@ -36,7 +37,7 @@ metadata:
capabilities: Basic Install
categories: Integration & Delivery
containerImage: quay.io/kuadrant/limitador-operator:latest
createdAt: "2023-09-27T14:09:01Z"
createdAt: "2023-11-08T14:01:55Z"
operators.operatorframework.io/builder: operator-sdk-v1.28.1
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/Kuadrant/limitador-operator
Expand Down
2 changes: 2 additions & 0 deletions bundle/manifests/limitador.kuadrant.io_limitadors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,8 @@ spec:
type: array
max_value:
type: integer
name:
type: string
namespace:
type: string
seconds:
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/limitador.kuadrant.io_limitadors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,8 @@ spec:
type: array
max_value:
type: integer
name:
type: string
namespace:
type: string
seconds:
Expand Down
1 change: 1 addition & 0 deletions config/samples/limitador_v1alpha1_limitador.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ spec:
namespace: toystore-app
seconds: 30
variables: []
name: "toy_get_route"
1 change: 1 addition & 0 deletions controllers/limitador_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ var _ = Describe("Limitador controller", func() {
Namespace: "test-namespace",
Seconds: 60,
Variables: []string{"user_id"},
Name: "useless",
},
{
Conditions: []string{"req.method == 'POST'"},
Expand Down
1 change: 1 addition & 0 deletions pkg/limitador/k8s_objects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ func TestLimitsConfigMap(t *testing.T) {
MaxValue: 1000,
Namespace: "my-ns",
Seconds: 60,
Name: "useless",
},
{
Conditions: []string{"cond == '1'"},
Expand Down

0 comments on commit 7e876a9

Please sign in to comment.