Skip to content

Commit

Permalink
Merge pull request #2485 from Krishanx92/subscription-ratelimit
Browse files Browse the repository at this point in the history
Update missing files
  • Loading branch information
CrowleyRajapakse authored Sep 25, 2024
2 parents ff7fdb0 + 9cb00e1 commit 777d37f
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 7 deletions.
40 changes: 40 additions & 0 deletions adapter/internal/operator/config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,26 @@ webhooks:
resources:
- interceptorservices
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-dp-wso2-com-v1alpha3-ratelimitpolicy
failurePolicy: Fail
name: mratelimitpolicy.kb.io
rules:
- apiGroups:
- dp.wso2.com
apiVersions:
- v1alpha3
operations:
- CREATE
- UPDATE
resources:
- ratelimitpolicies
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
Expand Down Expand Up @@ -430,6 +450,26 @@ webhooks:
resources:
- interceptorservices
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-dp-wso2-com-v1alpha3-ratelimitpolicy
failurePolicy: Fail
name: vratelimitpolicy.kb.io
rules:
- apiGroups:
- dp.wso2.com
apiVersions:
- v1alpha3
operations:
- CREATE
- UPDATE
resources:
- ratelimitpolicies
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
Expand Down
2 changes: 1 addition & 1 deletion common-controller/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/pelletier/go-toml v1.9.5
github.com/redis/go-redis/v9 v9.2.1
github.com/wso2/apk/adapter v0.0.0-20231214082511-af2c8b8a19f1
github.com/wso2/apk/common-go-libs v0.0.0-20240304050809-a382bc6b0d82
github.com/wso2/apk/common-go-libs v0.0.0-20240923143402-ff7fdb0366f9
google.golang.org/grpc v1.65.0
)

Expand Down
40 changes: 40 additions & 0 deletions common-controller/internal/operator/config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,26 @@ webhooks:
resources:
- interceptorservices
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-dp-wso2-com-v1alpha3-ratelimitpolicy
failurePolicy: Fail
name: mratelimitpolicy.kb.io
rules:
- apiGroups:
- dp.wso2.com
apiVersions:
- v1alpha3
operations:
- CREATE
- UPDATE
resources:
- ratelimitpolicies
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
Expand Down Expand Up @@ -430,6 +450,26 @@ webhooks:
resources:
- interceptorservices
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-dp-wso2-com-v1alpha3-ratelimitpolicy
failurePolicy: Fail
name: vratelimitpolicy.kb.io
rules:
- apiGroups:
- dp.wso2.com
apiVersions:
- v1alpha3
operations:
- CREATE
- UPDATE
resources:
- ratelimitpolicies
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
Expand Down
5 changes: 5 additions & 0 deletions common-controller/internal/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ func InitOperator(metricsConfig config.Metrics) {
"Unable to create webhook for Ratelimit, error: %v", err))
}

if err = (&dpv1alpha3.RateLimitPolicy{}).SetupWebhookWithManager(mgr); err != nil {
loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2637, logging.MAJOR,
"Unable to create webhook for Ratelimit, error: %v", err))
}

if err = (&dpv1alpha3.APIPolicy{}).SetupWebhookWithManager(mgr); err != nil {
loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2638, logging.MAJOR,
"Unable to create webhook for APIPolicy, error: %v", err))
Expand Down
40 changes: 40 additions & 0 deletions common-go-libs/config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,46 @@ webhooks:
resources:
- interceptorservices
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-dp-wso2-com-v1alpha3-ratelimitpolicy
failurePolicy: Fail
name: mratelimitpolicy.kb.io
rules:
- apiGroups:
- dp.wso2.com
apiVersions:
- v1alpha3
operations:
- CREATE
- UPDATE
resources:
- ratelimitpolicies
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-dp-wso2-com-v1alpha3-ratelimitpolicy
failurePolicy: Fail
name: mratelimitpolicy.kb.io
rules:
- apiGroups:
- dp.wso2.com
apiVersions:
- v1alpha3
operations:
- CREATE
- UPDATE
resources:
- ratelimitpolicies
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ webhooks:
service:
name: {{ template "apk-helm.resource.prefix" . }}-common-controller-service
namespace: {{ .Release.Namespace }}
path: /mutate-dp-wso2-com-v1alpha1-ratelimitpolicy
path: /mutate-dp-wso2-com-v1alpha3-ratelimitpolicy
failurePolicy: Fail
name: mratelimitpolicy.kb.io
rules:
- apiGroups:
- dp.wso2.com
apiVersions:
- v1alpha1
- v1alpha3
operations:
- CREATE
- UPDATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ webhooks:
service:
name: {{ template "apk-helm.resource.prefix" . }}-common-controller-service
namespace: {{ .Release.Namespace }}
path: /validate-dp-wso2-com-v1alpha1-ratelimitpolicy
path: /validate-dp-wso2-com-v1alpha3-ratelimitpolicy
failurePolicy: Fail
name: vratelimitpolicy.kb.io
rules:
- apiGroups:
- dp.wso2.com
apiVersions:
- v1alpha1
- v1alpha3
operations:
- CREATE
- UPDATE
Expand Down
24 changes: 22 additions & 2 deletions test/cucumber-tests/CRs/artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ spec:


---
apiVersion: "dp.wso2.com/v1alpha1"
apiVersion: "dp.wso2.com/v1alpha3"
kind: "RateLimitPolicy"
metadata:
name: "api-subscription-ratelimit"
Expand Down Expand Up @@ -912,10 +912,30 @@ spec:
name: "Semantic Versioning API"
version: "v\\d+(\\.\\d+)?"
ratelimitRef:
name: api-subscription-ratelimit
name: api--sem-subscription-ratelimit
level: application

---
apiVersion: "dp.wso2.com/v1alpha3"
kind: "RateLimitPolicy"
metadata:
name: "api--sem-subscription-ratelimit"
spec:
override:
subscription:
stopOnQuotaReach: true
organization: "default"
requestCount:
requestsPerUnit: 50
unit: "Minute"
burstControl:
requestsPerUnit: 50
unit: "Minute"
targetRef:
kind: Subscription
name: "7416c241a121b844392d447f00ff6709cb9c932b"
group: gateway.networking.k8s.io
---
apiVersion: cp.wso2.com/v1alpha2
kind: ApplicationMapping
metadata:
Expand Down

0 comments on commit 777d37f

Please sign in to comment.