-
Notifications
You must be signed in to change notification settings - Fork 26
feat: faas engine support for env instance #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,17 +96,21 @@ func main() { | |
| } | ||
|
|
||
| var scheduleClient service.EnvInstanceService | ||
| var envServiceController *controller.EnvServiceController | ||
| switch scheduleType { | ||
| case "k8s": | ||
| scheduleClient = service.NewScheduleClient(scheduleAddr) | ||
| envServiceController = controller.NewEnvServiceController(scheduleClient, backendClient, redisClient) | ||
| case "standard": | ||
| scheduleClient = service.NewEnvInstanceClient(scheduleAddr) | ||
| case "faas": | ||
| scheduleClient = service.NewFaaSClient(scheduleAddr) | ||
| default: | ||
| log.Fatalf("unsupported schedule type: %v", scheduleType) | ||
| } | ||
|
|
||
| envInstanceController := controller.NewEnvInstanceController(scheduleClient, backendClient, redisClient) | ||
| envServiceController := controller.NewEnvServiceController(scheduleClient, backendClient, redisClient) | ||
|
|
||
| // Main route configuration | ||
| mainRouter.POST("/env-instance", | ||
| middleware.AuthTokenMiddleware(tokenEnabled, backendClient), | ||
|
|
@@ -118,14 +122,16 @@ func main() { | |
| mainRouter.DELETE("/env-instance/:id", middleware.AuthTokenMiddleware(tokenEnabled, backendClient), envInstanceController.DeleteEnvInstance) | ||
|
|
||
| // Service routes | ||
| mainRouter.POST("/env-service", | ||
| middleware.AuthTokenMiddleware(tokenEnabled, backendClient), | ||
| middleware.RateLimit(qps), | ||
| envServiceController.CreateEnvService) | ||
| mainRouter.GET("/env-service/:id/list", middleware.AuthTokenMiddleware(tokenEnabled, backendClient), envServiceController.ListEnvServices) | ||
| mainRouter.GET("/env-service/:id", middleware.AuthTokenMiddleware(tokenEnabled, backendClient), envServiceController.GetEnvService) | ||
| mainRouter.DELETE("/env-service/:id", middleware.AuthTokenMiddleware(tokenEnabled, backendClient), envServiceController.DeleteEnvService) | ||
| mainRouter.PUT("/env-service/:id", middleware.AuthTokenMiddleware(tokenEnabled, backendClient), envServiceController.UpdateEnvService) | ||
| if envServiceController != nil { | ||
| mainRouter.POST("/env-service", | ||
| middleware.AuthTokenMiddleware(tokenEnabled, backendClient), | ||
| middleware.RateLimit(qps), | ||
| envServiceController.CreateEnvService) | ||
| mainRouter.GET("/env-service/:id/list", middleware.AuthTokenMiddleware(tokenEnabled, backendClient), envServiceController.ListEnvServices) | ||
| mainRouter.GET("/env-service/:id", middleware.AuthTokenMiddleware(tokenEnabled, backendClient), envServiceController.GetEnvService) | ||
| mainRouter.DELETE("/env-service/:id", middleware.AuthTokenMiddleware(tokenEnabled, backendClient), envServiceController.DeleteEnvService) | ||
| mainRouter.PUT("/env-service/:id", middleware.AuthTokenMiddleware(tokenEnabled, backendClient), envServiceController.UpdateEnvService) | ||
| } | ||
|
Comment on lines
+125
to
+134
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The routes for |
||
|
|
||
| mainRouter.GET("/health", healthChecker) | ||
| mainRouter.GET("/metrics", gin.WrapH(promhttp.Handler())) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it's good to avoid setting an empty TTL, this change might have an unintended side effect. If a user wants to explicitly remove a TTL by passing an empty string, this change would prevent that. The previous behavior would set the
ttlkey with an empty value. Please confirm if the intention is to disallow unsetting the TTL via an empty string.