Permalink
Browse files

Remove V1 endpoints and Routes (#1210)

Largely a removal job, however many tests, particularly system level
ones relied on Routes. These have been migrated to use Fns.

* Add 410 response to swagger
* No app names in log tags
* Adding constraint in GetCall for FnID
* Adding test to check FnID is required on call
* Add fn_id to call selector
* Fix text in docker mem warning
* Correct buildConfig func name
* Test fix up
* Removing CPU setting from Agent test

CPU setting has been deprecated, but the code base is still riddled
with it. This just removes it from this layer. Really we need to
remove it from Call.

* Remove fn id check on calls
* Reintroduce fn id required on call
* Adding fnID to calls for execute test
* Correct setting of app id in middleware
* Removes root middlewares ability to redirect fun invocations
* Add over sized test check
* Removing call fn id check
  • Loading branch information...
mantree authored and zootalures committed Sep 17, 2018
1 parent 6a01dae commit d56a49b321ef3eb165b2fb4d02067937c37ecf99
Showing with 562 additions and 5,548 deletions.
  1. +9 −8 api/agent/agent.go
  2. +127 −194 api/agent/agent_test.go
  3. +3 −3 api/agent/async.go
  4. +4 −112 api/agent/call.go
  5. +1 −27 api/agent/data_access.go
  6. +1 −1 api/agent/drivers/docker/docker.go
  7. +1 −1 api/agent/func_logger.go
  8. +0 −10 api/agent/hybrid/client.go
  9. +0 −6 api/agent/hybrid/nop.go
  10. +1 −1 api/agent/protocol/json.go
  11. +1 −2 api/agent/pure_runner.go
  12. +3 −3 api/agent/slots.go
  13. +3 −5 api/agent/slots_test.go
  14. +1 −5 api/const.go
  15. +0 −371 api/datastore/datastoretest/test.go
  16. +0 −30 api/datastore/internal/datastoreutil/metrics.go
  17. +0 −60 api/datastore/internal/datastoreutil/validator.go
  18. +0 −94 api/datastore/mock.go
  19. +45 −0 api/datastore/sql/migrations/20_drop_routes_table.go
  20. +28 −0 api/datastore/sql/migrations/21_drop_cols_path.go
  21. +3 −247 api/datastore/sql/sql.go
  22. +0 −12 api/logs/metrics/metrics.go
  23. +0 −42 api/logs/mock.go
  24. +6 −179 api/logs/s3/s3.go
  25. +2 −5 api/logs/testing/test.go
  26. +9 −9 api/logs/validator/validator.go
  27. +2 −7 api/models/call.go
  28. +0 −23 api/models/datastore.go
  29. +1 −73 api/models/error.go
  30. +11 −0 api/models/fn.go
  31. +1 −8 api/models/logs.go
  32. +0 −249 api/models/route.go
  33. +0 −44 api/models/route_test.go
  34. +0 −12 api/models/route_wrapper.go
  35. +2 −4 api/mqs/mock.go
  36. +1 −2 api/runnerpool/ch_placer.go
  37. +1 −1 api/server/apps_list.go
  38. +0 −39 api/server/apps_v1_create.go
  39. +0 −21 api/server/apps_v1_delete.go
  40. +0 −23 api/server/apps_v1_get.go
  41. +0 −35 api/server/apps_v1_list.go
  42. +0 −342 api/server/apps_v1_test.go
  43. +0 −47 api/server/apps_v1_update.go
  44. +15 −14 api/server/call_get.go
  45. +10 −29 api/server/call_list.go
  46. +2 −42 api/server/call_logs.go
  47. +39 −38 api/server/calls_test.go
  48. +0 −47 api/server/error_response.go
  49. +2 −47 api/server/extension_points.go
  50. +1 −1 api/server/fns_list.go
  51. +42 −52 api/server/gin_middlewares.go
  52. +0 −15 api/server/hybrid.go
  53. +8 −11 api/server/hybrid_test.go
  54. +3 −41 api/server/middleware.go
  55. +10 −15 api/server/middleware_test.go
  56. +0 −78 api/server/route_listeners.go
  57. +0 −178 api/server/routes_create_update.go
  58. +0 −28 api/server/routes_delete.go
  59. +0 −21 api/server/routes_get.go
  60. +0 −37 api/server/routes_list.go
  61. +0 −358 api/server/routes_test.go
  62. +0 −164 api/server/runner.go
  63. +0 −105 api/server/runner_async_test.go
  64. +21 −0 api/server/runner_fninvoke.go
  65. +10 −3 api/server/runner_fninvoke_test.go
  66. +2 −49 api/server/runner_httptrigger_test.go
  67. +0 −490 api/server/runner_test.go
  68. +5 −108 api/server/server.go
  69. +1 −1 api/server/server_options.go
  70. +0 −220 api/server/server_test.go
  71. +1 −1 api/server/trigger_list.go
  72. +0 −773 docs/swagger.yml
  73. +6 −0 docs/swagger_v2.yml
  74. +0 −15 examples/extensions/main.go
  75. +0 −15 fnext/api.go
  76. +1 −45 fnext/datastore.go
  77. +0 −16 fnext/listeners.go
  78. +0 −20 fnext/middleware.go
  79. +0 −4 fnext/setup.go
  80. +0 −1 test.sh
  81. +82 −101 test/fn-system-tests/{exec_route_test.go → exec_fn_test.go}
  82. +34 −8 test/fn-system-tests/exec_runner_status_test.go
View
@@ -14,6 +14,8 @@ import (
"sync"
"time"
"path/filepath"
"github.com/fnproject/fn/api/agent/drivers"
"github.com/fnproject/fn/api/agent/protocol"
"github.com/fnproject/fn/api/common"
@@ -24,7 +26,6 @@ import (
"github.com/sirupsen/logrus"
"go.opencensus.io/stats"
"go.opencensus.io/trace"
"path/filepath"
)
// TODO we should prob store async calls in db immediately since we're returning id (will 404 until post-execution)
@@ -836,8 +837,8 @@ func (a *agent) prepCold(ctx context.Context, call *call, tok ResourceToken, ch
logCfg: drivers.LoggerConfig{
URL: strings.TrimSpace(call.SyslogURL),
Tags: []drivers.LoggerTag{
{Name: "app_name", Value: call.AppName},
{Name: "func_name", Value: call.Path},
{Name: "app_id", Value: call.AppID},
{Name: "fn_id", Value: call.FnID},
},
},
stdin: call.req.Body,
@@ -902,7 +903,7 @@ func (a *agent) runHot(ctx context.Context, call *call, tok ResourceToken, state
close(udsAwait) // XXX(reed): short case first / kill this
}
logger := logrus.WithFields(logrus.Fields{"id": container.id, "app_id": call.AppID, "route": call.Path, "image": call.Image, "memory": call.Memory, "cpus": call.CPUs, "format": call.Format, "idle_timeout": call.IdleTimeout})
logger := logrus.WithFields(logrus.Fields{"id": container.id, "app_id": call.AppID, "fn_id": call.FnID, "image": call.Image, "memory": call.Memory, "cpus": call.CPUs, "format": call.Format, "idle_timeout": call.IdleTimeout})
ctx = common.WithLogger(ctx, logger)
cookie, err := a.driver.CreateCookie(ctx, container)
@@ -1239,10 +1240,10 @@ func newHotContainer(ctx context.Context, call *call, cfg *Config) (*container,
bufs = []*bytes.Buffer{buf1, buf2}
soc := &nopCloser{&logWriter{
logrus.WithFields(logrus.Fields{"tag": "stdout", "app_id": call.AppID, "path": call.Path, "image": call.Image, "container_id": id}),
logrus.WithFields(logrus.Fields{"tag": "stdout", "app_id": call.AppID, "fn_id": call.FnID, "image": call.Image, "container_id": id}),
}}
sec := &nopCloser{&logWriter{
logrus.WithFields(logrus.Fields{"tag": "stderr", "app_id": call.AppID, "path": call.Path, "image": call.Image, "container_id": id}),
logrus.WithFields(logrus.Fields{"tag": "stderr", "app_id": call.AppID, "fn_id": call.FnID, "image": call.Image, "container_id": id}),
}}
stdout.Swap(newLineWriterWithBuffer(buf1, soc))
@@ -1288,8 +1289,8 @@ func newHotContainer(ctx context.Context, call *call, cfg *Config) (*container,
logCfg: drivers.LoggerConfig{
URL: strings.TrimSpace(call.SyslogURL),
Tags: []drivers.LoggerTag{
{Name: "app_name", Value: call.AppName},
{Name: "func_name", Value: call.Path},
{Name: "app_id", Value: call.AppID},
{Name: "fn_id", Value: call.FnID},
},
},
stdin: stdin,
Oops, something went wrong.

0 comments on commit d56a49b

Please sign in to comment.