diff --git a/manager/config/constants.go b/manager/config/constants.go index d1238615722..a6506847b27 100644 --- a/manager/config/constants.go +++ b/manager/config/constants.go @@ -91,10 +91,10 @@ const ( DefaultJobRateLimitFillInterval = 1 * time.Minute // DefaultJobRateLimitCapacity is the default capacity for job rate limit. - DefaultJobRateLimitCapacity = 100 + DefaultJobRateLimitCapacity = 10 // DefaultJobRateLimitQuantum is the default quantum for job rate limit. - DefaultJobRateLimitQuantum = 100 + DefaultJobRateLimitQuantum = 10 // DefaultJobPreheatRegistryTimeout is the default timeout for requesting registry to get token and manifest. DefaultJobPreheatRegistryTimeout = 1 * time.Minute diff --git a/manager/router/router.go b/manager/router/router.go index 1bf14a5f2e3..c7802734ae6 100644 --- a/manager/router/router.go +++ b/manager/router/router.go @@ -202,7 +202,7 @@ func Init(cfg *config.Config, logDir string, service service.Service, database * // TODO Add auth to the following routes and fix the tests. // Job. job := apiv1.Group("/jobs") - job.POST("", h.CreateJob) + job.POST("", middlewares.RateLimit(cfg.Job.RateLimit.FillInterval, cfg.Job.RateLimit.Capacity, cfg.Job.RateLimit.Quantum), h.CreateJob) job.DELETE(":id", h.DestroyJob) job.PATCH(":id", h.UpdateJob) job.GET(":id", h.GetJob)