namespace.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. package router
  2. import (
  3. "fmt"
  4. "github.com/go-chi/chi"
  5. "github.com/porter-dev/porter/api/server/handlers/job"
  6. "github.com/porter-dev/porter/api/server/handlers/namespace"
  7. "github.com/porter-dev/porter/api/server/shared"
  8. "github.com/porter-dev/porter/api/server/shared/config"
  9. "github.com/porter-dev/porter/api/types"
  10. )
  11. func NewNamespaceScopedRegisterer(children ...*Registerer) *Registerer {
  12. return &Registerer{
  13. GetRoutes: GetNamespaceScopedRoutes,
  14. Children: children,
  15. }
  16. }
  17. func GetNamespaceScopedRoutes(
  18. r chi.Router,
  19. config *config.Config,
  20. basePath *types.Path,
  21. factory shared.APIEndpointFactory,
  22. children ...*Registerer,
  23. ) []*Route {
  24. routes, projPath := getNamespaceRoutes(r, config, basePath, factory)
  25. if len(children) > 0 {
  26. r.Route(projPath.RelativePath, func(r chi.Router) {
  27. for _, child := range children {
  28. childRoutes := child.GetRoutes(r, config, basePath, factory, child.Children...)
  29. routes = append(routes, childRoutes...)
  30. }
  31. })
  32. }
  33. return routes
  34. }
  35. func getNamespaceRoutes(
  36. r chi.Router,
  37. config *config.Config,
  38. basePath *types.Path,
  39. factory shared.APIEndpointFactory,
  40. ) ([]*Route, *types.Path) {
  41. relPath := "/namespaces/{namespace}"
  42. newPath := &types.Path{
  43. Parent: basePath,
  44. RelativePath: relPath,
  45. }
  46. routes := make([]*Route, 0)
  47. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/envgroups/list -> namespace.NewListEnvGroupsHandler
  48. listEnvGroupsEndpoint := factory.NewAPIEndpoint(
  49. &types.APIRequestMetadata{
  50. Verb: types.APIVerbGet,
  51. Method: types.HTTPVerbGet,
  52. Path: &types.Path{
  53. Parent: basePath,
  54. RelativePath: relPath + "/envgroups/list",
  55. },
  56. Scopes: []types.PermissionScope{
  57. types.UserScope,
  58. types.ProjectScope,
  59. types.ClusterScope,
  60. types.NamespaceScope,
  61. },
  62. },
  63. )
  64. listEnvGroupsHandler := namespace.NewListEnvGroupsHandler(
  65. config,
  66. factory.GetResultWriter(),
  67. )
  68. routes = append(routes, &Route{
  69. Endpoint: listEnvGroupsEndpoint,
  70. Handler: listEnvGroupsHandler,
  71. Router: r,
  72. })
  73. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/envgroups/clone -> namespace.NewCloneEnvGroupHandler
  74. cloneEnvGroupEndpoint := factory.NewAPIEndpoint(
  75. &types.APIRequestMetadata{
  76. Verb: types.APIVerbGet,
  77. Method: types.HTTPVerbGet,
  78. Path: &types.Path{
  79. Parent: basePath,
  80. RelativePath: relPath + "/envgroups/clone",
  81. },
  82. Scopes: []types.PermissionScope{
  83. types.UserScope,
  84. types.ProjectScope,
  85. types.ClusterScope,
  86. types.NamespaceScope,
  87. },
  88. },
  89. )
  90. cloneEnvGroupHandler := namespace.NewCloneEnvGroupHandler(
  91. config,
  92. factory.GetDecoderValidator(),
  93. factory.GetResultWriter(),
  94. )
  95. routes = append(routes, &Route{
  96. Endpoint: cloneEnvGroupEndpoint,
  97. Handler: cloneEnvGroupHandler,
  98. Router: r,
  99. })
  100. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/envgroup -> namespace.NewGetEnvGroupHandler
  101. getEnvGroupEndpoint := factory.NewAPIEndpoint(
  102. &types.APIRequestMetadata{
  103. Verb: types.APIVerbGet,
  104. Method: types.HTTPVerbGet,
  105. Path: &types.Path{
  106. Parent: basePath,
  107. RelativePath: relPath + "/envgroup",
  108. },
  109. Scopes: []types.PermissionScope{
  110. types.UserScope,
  111. types.ProjectScope,
  112. types.ClusterScope,
  113. types.NamespaceScope,
  114. },
  115. },
  116. )
  117. getEnvGroupHandler := namespace.NewGetEnvGroupHandler(
  118. config,
  119. factory.GetDecoderValidator(),
  120. factory.GetResultWriter(),
  121. )
  122. routes = append(routes, &Route{
  123. Endpoint: getEnvGroupEndpoint,
  124. Handler: getEnvGroupHandler,
  125. Router: r,
  126. })
  127. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/envgroup/all_versions -> namespace.NewGetEnvGroupAllVersionsHandler
  128. getEnvGroupAllVersionsEndpoint := factory.NewAPIEndpoint(
  129. &types.APIRequestMetadata{
  130. Verb: types.APIVerbGet,
  131. Method: types.HTTPVerbGet,
  132. Path: &types.Path{
  133. Parent: basePath,
  134. RelativePath: relPath + "/envgroup/all_versions",
  135. },
  136. Scopes: []types.PermissionScope{
  137. types.UserScope,
  138. types.ProjectScope,
  139. types.ClusterScope,
  140. types.NamespaceScope,
  141. },
  142. },
  143. )
  144. getEnvGroupAllVersionsHandler := namespace.NewGetEnvGroupAllVersionsHandler(
  145. config,
  146. factory.GetDecoderValidator(),
  147. factory.GetResultWriter(),
  148. )
  149. routes = append(routes, &Route{
  150. Endpoint: getEnvGroupAllVersionsEndpoint,
  151. Handler: getEnvGroupAllVersionsHandler,
  152. Router: r,
  153. })
  154. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/envgroup/create -> namespace.NewCreateEnvGroupHandler
  155. createEnvGroupEndpoint := factory.NewAPIEndpoint(
  156. &types.APIRequestMetadata{
  157. Verb: types.APIVerbCreate,
  158. Method: types.HTTPVerbPost,
  159. Path: &types.Path{
  160. Parent: basePath,
  161. RelativePath: relPath + "/envgroup/create",
  162. },
  163. Scopes: []types.PermissionScope{
  164. types.UserScope,
  165. types.ProjectScope,
  166. types.ClusterScope,
  167. types.NamespaceScope,
  168. },
  169. },
  170. )
  171. createEnvGroupHandler := namespace.NewCreateEnvGroupHandler(
  172. config,
  173. factory.GetDecoderValidator(),
  174. factory.GetResultWriter(),
  175. )
  176. routes = append(routes, &Route{
  177. Endpoint: createEnvGroupEndpoint,
  178. Handler: createEnvGroupHandler,
  179. Router: r,
  180. })
  181. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/envgroup/add_application -> namespace.NewAddEnvGroupAppHandler
  182. updateEnvGroupAppsEndpoint := factory.NewAPIEndpoint(
  183. &types.APIRequestMetadata{
  184. Verb: types.APIVerbUpdate,
  185. Method: types.HTTPVerbPost,
  186. Path: &types.Path{
  187. Parent: basePath,
  188. RelativePath: relPath + "/envgroup/add_application",
  189. },
  190. Scopes: []types.PermissionScope{
  191. types.UserScope,
  192. types.ProjectScope,
  193. types.ClusterScope,
  194. types.NamespaceScope,
  195. },
  196. },
  197. )
  198. updateEnvGroupAppsHandler := namespace.NewAddEnvGroupAppHandler(
  199. config,
  200. factory.GetDecoderValidator(),
  201. factory.GetResultWriter(),
  202. )
  203. routes = append(routes, &Route{
  204. Endpoint: updateEnvGroupAppsEndpoint,
  205. Handler: updateEnvGroupAppsHandler,
  206. Router: r,
  207. })
  208. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/envgroup/remove_application -> namespace.NewRemoveEnvGroupAppHandler
  209. removeEnvGroupAppEndpoint := factory.NewAPIEndpoint(
  210. &types.APIRequestMetadata{
  211. Verb: types.APIVerbUpdate,
  212. Method: types.HTTPVerbPost,
  213. Path: &types.Path{
  214. Parent: basePath,
  215. RelativePath: relPath + "/envgroup/remove_application",
  216. },
  217. Scopes: []types.PermissionScope{
  218. types.UserScope,
  219. types.ProjectScope,
  220. types.ClusterScope,
  221. types.NamespaceScope,
  222. },
  223. },
  224. )
  225. removeEnvGroupAppHandler := namespace.NewRemoveEnvGroupAppHandler(
  226. config,
  227. factory.GetDecoderValidator(),
  228. factory.GetResultWriter(),
  229. )
  230. routes = append(routes, &Route{
  231. Endpoint: removeEnvGroupAppEndpoint,
  232. Handler: removeEnvGroupAppHandler,
  233. Router: r,
  234. })
  235. // DELETE /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/envgroup -> namespace.NewDeleteEnvGroupHandler
  236. deleteEnvGroupEndpoint := factory.NewAPIEndpoint(
  237. &types.APIRequestMetadata{
  238. Verb: types.APIVerbDelete,
  239. Method: types.HTTPVerbDelete,
  240. Path: &types.Path{
  241. Parent: basePath,
  242. RelativePath: relPath + "/envgroup",
  243. },
  244. Scopes: []types.PermissionScope{
  245. types.UserScope,
  246. types.ProjectScope,
  247. types.ClusterScope,
  248. types.NamespaceScope,
  249. },
  250. },
  251. )
  252. deleteEnvGroupHandler := namespace.NewDeleteEnvGroupHandler(
  253. config,
  254. factory.GetDecoderValidator(),
  255. factory.GetResultWriter(),
  256. )
  257. routes = append(routes, &Route{
  258. Endpoint: deleteEnvGroupEndpoint,
  259. Handler: deleteEnvGroupHandler,
  260. Router: r,
  261. })
  262. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/configmap/update -> namespace.NewUpdateConfigMapHandler
  263. updateConfigMapEndpoint := factory.NewAPIEndpoint(
  264. &types.APIRequestMetadata{
  265. Verb: types.APIVerbUpdate,
  266. Method: types.HTTPVerbPost,
  267. Path: &types.Path{
  268. Parent: basePath,
  269. RelativePath: relPath + "/configmap/update",
  270. },
  271. Scopes: []types.PermissionScope{
  272. types.UserScope,
  273. types.ProjectScope,
  274. types.ClusterScope,
  275. types.NamespaceScope,
  276. },
  277. },
  278. )
  279. updateConfigMapHandler := namespace.NewUpdateConfigMapHandler(
  280. config,
  281. factory.GetDecoderValidator(),
  282. factory.GetResultWriter(),
  283. )
  284. routes = append(routes, &Route{
  285. Endpoint: updateConfigMapEndpoint,
  286. Handler: updateConfigMapHandler,
  287. Router: r,
  288. })
  289. // DELETE /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/crd -> namespace.NewCRDDeleteHandler
  290. deleteCRDEndpoint := factory.NewAPIEndpoint(
  291. &types.APIRequestMetadata{
  292. Verb: types.APIVerbDelete,
  293. Method: types.HTTPVerbDelete,
  294. Path: &types.Path{
  295. Parent: basePath,
  296. RelativePath: relPath + "/crd",
  297. },
  298. Scopes: []types.PermissionScope{
  299. types.UserScope,
  300. types.ProjectScope,
  301. types.ClusterScope,
  302. },
  303. },
  304. )
  305. deleteCRDHandler := namespace.NewCRDDeleteHandler(
  306. config,
  307. factory.GetDecoderValidator(),
  308. factory.GetResultWriter(),
  309. )
  310. routes = append(routes, &Route{
  311. Endpoint: deleteCRDEndpoint,
  312. Handler: deleteCRDHandler,
  313. Router: r,
  314. })
  315. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases -> namespace.NewListReleasesHandler
  316. listReleasesEndpoint := factory.NewAPIEndpoint(
  317. &types.APIRequestMetadata{
  318. Verb: types.APIVerbGet,
  319. Method: types.HTTPVerbGet,
  320. Path: &types.Path{
  321. Parent: basePath,
  322. RelativePath: relPath + "/releases",
  323. },
  324. Scopes: []types.PermissionScope{
  325. types.UserScope,
  326. types.ProjectScope,
  327. types.ClusterScope,
  328. types.NamespaceScope,
  329. },
  330. },
  331. )
  332. listReleasesHandler := namespace.NewListReleasesHandler(
  333. config,
  334. factory.GetDecoderValidator(),
  335. factory.GetResultWriter(),
  336. )
  337. routes = append(routes, &Route{
  338. Endpoint: listReleasesEndpoint,
  339. Handler: listReleasesHandler,
  340. Router: r,
  341. })
  342. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/pod/{name}/logs -> namespace.NewStreamPodLogsHandler
  343. streamPodLogsEndpoint := factory.NewAPIEndpoint(
  344. &types.APIRequestMetadata{
  345. Verb: types.APIVerbGet,
  346. Method: types.HTTPVerbGet,
  347. Path: &types.Path{
  348. Parent: basePath,
  349. RelativePath: fmt.Sprintf(
  350. "%s/pod/{%s}/logs",
  351. relPath,
  352. types.URLParamPodName,
  353. ),
  354. },
  355. Scopes: []types.PermissionScope{
  356. types.UserScope,
  357. types.ProjectScope,
  358. types.ClusterScope,
  359. types.NamespaceScope,
  360. },
  361. IsWebsocket: true,
  362. },
  363. )
  364. streamPodLogsHandler := namespace.NewStreamPodLogsHandler(
  365. config,
  366. factory.GetDecoderValidator(),
  367. factory.GetResultWriter(),
  368. )
  369. routes = append(routes, &Route{
  370. Endpoint: streamPodLogsEndpoint,
  371. Handler: streamPodLogsHandler,
  372. Router: r,
  373. })
  374. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/pod/{name}/previous_logs
  375. getPreviousLogsEndpoint := factory.NewAPIEndpoint(
  376. &types.APIRequestMetadata{
  377. Verb: types.APIVerbGet,
  378. Method: types.HTTPVerbGet,
  379. Path: &types.Path{
  380. Parent: basePath,
  381. RelativePath: fmt.Sprintf(
  382. "%s/pod/{%s}/previous_logs",
  383. relPath,
  384. types.URLParamPodName,
  385. ),
  386. },
  387. Scopes: []types.PermissionScope{
  388. types.UserScope,
  389. types.ProjectScope,
  390. types.ClusterScope,
  391. types.NamespaceScope,
  392. },
  393. },
  394. )
  395. getPreviousLogsHandler := namespace.NewGetPreviousLogsHandler(
  396. config,
  397. factory.GetDecoderValidator(),
  398. factory.GetResultWriter(),
  399. )
  400. routes = append(routes, &Route{
  401. Endpoint: getPreviousLogsEndpoint,
  402. Handler: getPreviousLogsHandler,
  403. Router: r,
  404. })
  405. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/jobs/{name}/pods -> jobs.NewGetPodsHandler
  406. getJobPodsEndpoint := factory.NewAPIEndpoint(
  407. &types.APIRequestMetadata{
  408. Verb: types.APIVerbList,
  409. Method: types.HTTPVerbGet,
  410. Path: &types.Path{
  411. Parent: basePath,
  412. RelativePath: fmt.Sprintf(
  413. "%s/jobs/{%s}/pods",
  414. relPath,
  415. types.URLParamJobName,
  416. ),
  417. },
  418. Scopes: []types.PermissionScope{
  419. types.UserScope,
  420. types.ProjectScope,
  421. types.ClusterScope,
  422. types.NamespaceScope,
  423. },
  424. },
  425. )
  426. getJobPodsHandler := job.NewGetPodsHandler(
  427. config,
  428. factory.GetResultWriter(),
  429. )
  430. routes = append(routes, &Route{
  431. Endpoint: getJobPodsEndpoint,
  432. Handler: getJobPodsHandler,
  433. Router: r,
  434. })
  435. // DELETE /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/jobs/{name} -> jobs.NewDeleteHandler
  436. deleteJobEndpoint := factory.NewAPIEndpoint(
  437. &types.APIRequestMetadata{
  438. Verb: types.APIVerbDelete,
  439. Method: types.HTTPVerbDelete,
  440. Path: &types.Path{
  441. Parent: basePath,
  442. RelativePath: fmt.Sprintf(
  443. "%s/jobs/{%s}",
  444. relPath,
  445. types.URLParamJobName,
  446. ),
  447. },
  448. Scopes: []types.PermissionScope{
  449. types.UserScope,
  450. types.ProjectScope,
  451. types.ClusterScope,
  452. types.NamespaceScope,
  453. },
  454. },
  455. )
  456. deleteJobHandler := job.NewDeleteHandler(
  457. config,
  458. )
  459. routes = append(routes, &Route{
  460. Endpoint: deleteJobEndpoint,
  461. Handler: deleteJobHandler,
  462. Router: r,
  463. })
  464. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/jobs/{name}/stop -> jobs.NewStopHandler
  465. stopJobEndpoint := factory.NewAPIEndpoint(
  466. &types.APIRequestMetadata{
  467. Verb: types.APIVerbUpdate,
  468. Method: types.HTTPVerbPost,
  469. Path: &types.Path{
  470. Parent: basePath,
  471. RelativePath: fmt.Sprintf(
  472. "%s/jobs/{%s}/stop",
  473. relPath,
  474. types.URLParamJobName,
  475. ),
  476. },
  477. Scopes: []types.PermissionScope{
  478. types.UserScope,
  479. types.ProjectScope,
  480. types.ClusterScope,
  481. types.NamespaceScope,
  482. },
  483. },
  484. )
  485. stopJobHandler := job.NewStopHandler(
  486. config,
  487. )
  488. routes = append(routes, &Route{
  489. Endpoint: stopJobEndpoint,
  490. Handler: stopJobHandler,
  491. Router: r,
  492. })
  493. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/pods/{name} -> namespace.NewGetPodHandler
  494. getPodEndpoint := factory.NewAPIEndpoint(
  495. &types.APIRequestMetadata{
  496. Verb: types.APIVerbGet,
  497. Method: types.HTTPVerbGet,
  498. Path: &types.Path{
  499. Parent: basePath,
  500. RelativePath: fmt.Sprintf(
  501. "%s/pods/{%s}",
  502. relPath,
  503. types.URLParamPodName,
  504. ),
  505. },
  506. Scopes: []types.PermissionScope{
  507. types.UserScope,
  508. types.ProjectScope,
  509. types.ClusterScope,
  510. types.NamespaceScope,
  511. },
  512. },
  513. )
  514. getPodHandler := namespace.NewGetPodHandler(
  515. config,
  516. factory.GetResultWriter(),
  517. )
  518. routes = append(routes, &Route{
  519. Endpoint: getPodEndpoint,
  520. Handler: getPodHandler,
  521. Router: r,
  522. })
  523. // DELETE /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/pods/{name} -> namespace.NewDeletePodHandler
  524. deletePodEndpoint := factory.NewAPIEndpoint(
  525. &types.APIRequestMetadata{
  526. Verb: types.APIVerbDelete,
  527. Method: types.HTTPVerbDelete,
  528. Path: &types.Path{
  529. Parent: basePath,
  530. RelativePath: fmt.Sprintf(
  531. "%s/pods/{%s}",
  532. relPath,
  533. types.URLParamPodName,
  534. ),
  535. },
  536. Scopes: []types.PermissionScope{
  537. types.UserScope,
  538. types.ProjectScope,
  539. types.ClusterScope,
  540. types.NamespaceScope,
  541. },
  542. },
  543. )
  544. deletePodHandler := namespace.NewDeletePodHandler(
  545. config,
  546. )
  547. routes = append(routes, &Route{
  548. Endpoint: deletePodEndpoint,
  549. Handler: deletePodHandler,
  550. Router: r,
  551. })
  552. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/pods/{name}/events -> namespace.NewGetPodEventsHandler
  553. getPodEventsEndpoint := factory.NewAPIEndpoint(
  554. &types.APIRequestMetadata{
  555. Verb: types.APIVerbList,
  556. Method: types.HTTPVerbGet,
  557. Path: &types.Path{
  558. Parent: basePath,
  559. RelativePath: fmt.Sprintf(
  560. "%s/pods/{%s}/events",
  561. relPath,
  562. types.URLParamPodName,
  563. ),
  564. },
  565. Scopes: []types.PermissionScope{
  566. types.UserScope,
  567. types.ProjectScope,
  568. types.ClusterScope,
  569. types.NamespaceScope,
  570. },
  571. },
  572. )
  573. getPodEventsHandler := namespace.NewGetPodEventsHandler(
  574. config,
  575. factory.GetResultWriter(),
  576. )
  577. routes = append(routes, &Route{
  578. Endpoint: getPodEventsEndpoint,
  579. Handler: getPodEventsHandler,
  580. Router: r,
  581. })
  582. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/ingresses/{name} ->
  583. // release.NewGetJobsHandler
  584. getIngressEndpoint := factory.NewAPIEndpoint(
  585. &types.APIRequestMetadata{
  586. Verb: types.APIVerbGet,
  587. Method: types.HTTPVerbGet,
  588. Path: &types.Path{
  589. Parent: basePath,
  590. RelativePath: relPath + "/ingresses/{name}",
  591. },
  592. Scopes: []types.PermissionScope{
  593. types.UserScope,
  594. types.ProjectScope,
  595. types.ClusterScope,
  596. types.NamespaceScope,
  597. },
  598. },
  599. )
  600. getIngressHandler := namespace.NewGetIngressHandler(
  601. config,
  602. factory.GetResultWriter(),
  603. )
  604. routes = append(routes, &Route{
  605. Endpoint: getIngressEndpoint,
  606. Handler: getIngressHandler,
  607. Router: r,
  608. })
  609. return routes, newPath
  610. }