Skip to content

Commit

Permalink
Merge pull request #26 from Kuadrant/limits-in-limitador
Browse files Browse the repository at this point in the history
Limits in limitador
  • Loading branch information
didierofrivia authored Jun 29, 2022
2 parents 40272d9 + e087ff8 commit 36d2728
Show file tree
Hide file tree
Showing 22 changed files with 414 additions and 837 deletions.
12 changes: 12 additions & 0 deletions api/v1alpha1/limitador_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ type LimitadorSpec struct {

// +optional
Listener *Listener `json:"listener,omitempty"`

// +optional
Limits []RateLimit `json:"limits,omitempty"`
}

// LimitadorStatus defines the observed state of Limitador
Expand Down Expand Up @@ -80,6 +83,15 @@ type TransportProtocol struct {
// We could describe TLS within this type
}

// RateLimit defines the desired Limitador limit
type RateLimit struct {
Conditions []string `json:"conditions"`
MaxValue int `json:"max_value"`
Namespace string `json:"namespace"`
Seconds int `json:"seconds"`
Variables []string `json:"variables"`
}

func init() {
SchemeBuilder.Register(&Limitador{}, &LimitadorList{})
}
74 changes: 0 additions & 74 deletions api/v1alpha1/ratelimit_types.go

This file was deleted.

103 changes: 10 additions & 93 deletions api/v1alpha1/zz_generated.deepcopy.go

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

52 changes: 28 additions & 24 deletions bundle/manifests/limitador-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,25 @@ metadata:
"name": "limitador-sample"
},
"spec": {
"limits": [
{
"conditions": [
"get-toy == yes"
],
"max_value": 2,
"namespace": "toystore-app",
"seconds": 30,
"variables": []
}
],
"listener": {
"grpc": {
"port": 8081
},
"http": {
"port": 8080
}
},
"replicas": 1,
"version": "latest"
}
Expand Down Expand Up @@ -60,9 +79,9 @@ spec:
clusterPermissions:
- rules:
- apiGroups:
- apps
- ""
resources:
- deployments
- configmaps
verbs:
- create
- delete
Expand All @@ -71,9 +90,9 @@ spec:
- update
- watch
- apiGroups:
- ""
- apps
resources:
- services
- deployments
verbs:
- create
- delete
Expand All @@ -82,35 +101,20 @@ spec:
- update
- watch
- apiGroups:
- limitador.kuadrant.io
- ""
resources:
- limitadors
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- limitador.kuadrant.io
resources:
- limitadors/finalizers
verbs:
- update
- apiGroups:
- limitador.kuadrant.io
resources:
- limitadors/status
verbs:
- get
- patch
- update
- apiGroups:
- limitador.kuadrant.io
resources:
- ratelimits
- limitadors
verbs:
- create
- delete
Expand All @@ -122,13 +126,13 @@ spec:
- apiGroups:
- limitador.kuadrant.io
resources:
- ratelimits/finalizers
- limitadors/finalizers
verbs:
- update
- apiGroups:
- limitador.kuadrant.io
resources:
- ratelimits/status
- limitadors/status
verbs:
- get
- patch
Expand Down
26 changes: 26 additions & 0 deletions bundle/manifests/limitador.kuadrant.io_limitadors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,32 @@ spec:
spec:
description: LimitadorSpec defines the desired state of Limitador
properties:
limits:
items:
description: RateLimit defines the desired Limitador limit
properties:
conditions:
items:
type: string
type: array
max_value:
type: integer
namespace:
type: string
seconds:
type: integer
variables:
items:
type: string
type: array
required:
- conditions
- max_value
- namespace
- seconds
- variables
type: object
type: array
listener:
properties:
grpc:
Expand Down
Loading

0 comments on commit 36d2728

Please sign in to comment.