-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add RateLimit CRD static validation * wip * Change group of ratelimit * draft of rate limit validation * Make tests pass * Add requeueAfter with default reconciliation period * Add RateLimiting Controller to Technical design documentation and assets. * Add spec and example to Rate Limit CR docs * Improve validation logic * Cleanup the code and tests * Add RateLimit in-code validation to the reconcile loop * Add godoc comments * Restructure packages * Refactor naming * Apply suggestions from code review Co-authored-by: Natalia Sitko <[email protected]> * Update docs/user/custom-resources/ratelimit/04-00-ratelimit.md Co-authored-by: Natalia Sitko <[email protected]> --------- Co-authored-by: Tim Riffer <[email protected]> Co-authored-by: Natalia Sitko <[email protected]>
- Loading branch information
1 parent
30afc40
commit 9632426
Showing
25 changed files
with
843 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 76 additions & 1 deletion
77
...telimit/v1alpha1/zz_generated.deepcopy.go → ...telimit/v1alpha1/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
119 changes: 119 additions & 0 deletions
119
config/crd/bases/gateway.kyma-project.io_ratelimits.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.14.0 | ||
name: ratelimits.gateway.kyma-project.io | ||
spec: | ||
group: gateway.kyma-project.io | ||
names: | ||
kind: RateLimit | ||
listKind: RateLimitList | ||
plural: ratelimits | ||
singular: ratelimit | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: RateLimit is the Schema for the ratelimits API | ||
properties: | ||
apiVersion: | ||
description: |- | ||
APIVersion defines the versioned schema of this representation of an object. | ||
Servers should convert recognized schemas to the latest internal value, and | ||
may reject unrecognized values. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | ||
type: string | ||
kind: | ||
description: |- | ||
Kind is a string value representing the REST resource this object represents. | ||
Servers may infer this from the endpoint the client submits requests to. | ||
Cannot be updated. | ||
In CamelCase. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: RateLimitSpec defines the desired state of RateLimit | ||
properties: | ||
enableResponseHeaders: | ||
type: boolean | ||
enforce: | ||
type: boolean | ||
local: | ||
description: Local represents the local rate limit configuration. | ||
properties: | ||
buckets: | ||
items: | ||
description: Bucket represents a rate limit bucket configuration. | ||
properties: | ||
bucket: | ||
description: BucketTokenSpec defines the token bucket specification. | ||
properties: | ||
fillInterval: | ||
format: duration | ||
type: string | ||
maxTokens: | ||
format: int64 | ||
type: integer | ||
tokensPerFill: | ||
format: int64 | ||
type: integer | ||
required: | ||
- fillInterval | ||
- maxTokens | ||
- tokensPerFill | ||
type: object | ||
headers: | ||
additionalProperties: | ||
type: string | ||
type: object | ||
path: | ||
type: string | ||
required: | ||
- bucket | ||
type: object | ||
x-kubernetes-validations: | ||
- message: path or headers must be set | ||
rule: ((has(self.path)?1:0)+(has(self.headers)?1:0))==1 | ||
type: array | ||
defaultBucket: | ||
description: BucketTokenSpec defines the token bucket specification. | ||
properties: | ||
fillInterval: | ||
format: duration | ||
type: string | ||
maxTokens: | ||
format: int64 | ||
type: integer | ||
tokensPerFill: | ||
format: int64 | ||
type: integer | ||
required: | ||
- fillInterval | ||
- maxTokens | ||
- tokensPerFill | ||
type: object | ||
required: | ||
- defaultBucket | ||
type: object | ||
selectorLabels: | ||
additionalProperties: | ||
type: string | ||
minProperties: 1 | ||
type: object | ||
required: | ||
- local | ||
- selectorLabels | ||
type: object | ||
status: | ||
description: RateLimitStatus defines the observed state of RateLimit | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
54 changes: 0 additions & 54 deletions
54
config/crd/bases/ratelimit.kyma-project.io_ratelimits.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.