Page MenuHomePhabricator

Configure REST Gateway
Closed, ResolvedPublic

Description

Based on conversations in T322152, it has been decided to implement a gateway for REST routing. To remove ambiguity and to standardise, from now on I will be calling this the "REST gateway".

Notes on reasoning etc:

  • A dedicated gateway for a separation of concerns - API gateway has thousands of lines of generalised config, REST gateway will have ~hundreds specific to restbase work.
  • The API gateway is in theory _only_ for api.wikimedia.org. The REST gateway is for requests coming for /rest_v1/ on multiple domains.
  • Global settings - HTTP headers can be set for all requests so as to ensure RESTbase compatibility, this would involve conditionals etc within the API gatway
  • Separation of concerns - ideally the API gateway will be a self service platform for teams configuring new services themselves, the REST gateway will not be and will only be managed by people with direct needs and experience with RESTbase and the REST gateway
  • A component to be deprecated - we are building the gateway with an eye to ultimately removing it once it is no longer needed. This is of course a risky assumption as these kinds of things stick around historically, but we do not plan on the REST gateway being a component we keep in place.
  • Custom rate limiting configuration - we can create a new, independent system of rate limiting within the REST gateway as opposed to living alongside or customising the existing API gateway rest config.

The REST gateway's main function is to map requests that would usually be aimed at restbase to requests that services expect. This will mostly be via simple URL reformatting, header setting and other forms of polish.

Ideally we can reuse the existing chart for the api-gateway with a custom configuration set for the REST gateway. This configuration should be in an independent file within the chart so as to avoid any cross-impact from changes to the traditional API gateway. Envoy limitations unfortunately oblige us to include this template rather than make it a real individual file so we'll need a clear toggle for this, and probably also to move the existing API gateway configuration to a dedicate file for include purposes also.

  • Move API gateway configuration to include
  • Create REST configuration file and configuration toggles
  • Implement URL mangling configurations from ATS, Varnish and within RESTbase in Gateway config (needs a dedicated ticket)
  • Add RESTbase security headers (T326321)
  • Handle edge cache invalidation (T324200)
  • Create Helm definition for REST gateway
  • Create LVS service

Open questions:

  • Ratelimiting configuration and criteria - probably needs its own ticket

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptFeb 7 2023, 1:34 PM

Change 887991 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/deployment-charts@master] api-gateway: reformat templates

https://gerrit.wikimedia.org/r/887991

Change 887991 merged by jenkins-bot:

[operations/deployment-charts@master] api-gateway: reformat templates

https://gerrit.wikimedia.org/r/887991

Change 890012 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/deployment-charts@master] api-gateway: add rest gateway configuration

https://gerrit.wikimedia.org/r/890012

Change 890887 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/deployment-charts@master] api-gateway: add REST gateway LUA CSP handler

https://gerrit.wikimedia.org/r/890887

Change 890012 merged by jenkins-bot:

[operations/deployment-charts@master] api-gateway: add rest gateway configuration

https://gerrit.wikimedia.org/r/890012

Change 891510 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/puppet@production] service, k8s: Add service definitions for rest-gateway

https://gerrit.wikimedia.org/r/891510

hnowlan changed the task status from Open to In Progress.Mar 23 2023, 3:22 PM
hnowlan triaged this task as High priority.

Change 904511 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[labs/private@master] kubernetes: add dummy tokens for rest-gateway

https://gerrit.wikimedia.org/r/904511

Change 891510 merged by Hnowlan:

[operations/puppet@production] service, k8s: Add service definitions for rest-gateway

https://gerrit.wikimedia.org/r/891510

Change 904511 merged by Hnowlan:

[labs/private@master] kubernetes: add dummy tokens for rest-gateway

https://gerrit.wikimedia.org/r/904511

Change 920664 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/puppet@production] service: move rest-gateway to lvs_setup

https://gerrit.wikimedia.org/r/920664

Change 920667 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/puppet@production] service: move rest-gateway to production

https://gerrit.wikimedia.org/r/920667

Change 920710 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/deployment-charts@master] rest-gateway: add citoid support

https://gerrit.wikimedia.org/r/920710

Change 920664 merged by Hnowlan:

[operations/puppet@production] service: move rest-gateway to lvs_setup

https://gerrit.wikimedia.org/r/920664

Mentioned in SAL (#wikimedia-operations) [2023-05-31T11:18:55Z] <hnowlan@cumin1001> START - Cookbook sre.loadbalancer.restart-pybal rolling-restart of pybal on P{lvs1020*,lvs2010*} and A:lvs (T329049)

Mentioned in SAL (#wikimedia-operations) [2023-05-31T11:36:43Z] <hnowlan@cumin1001> END (PASS) - Cookbook sre.loadbalancer.restart-pybal (exit_code=0) rolling-restart of pybal on P{lvs1020*,lvs2010*} and A:lvs (T329049)

Mentioned in SAL (#wikimedia-operations) [2023-05-31T13:46:28Z] <hnowlan@cumin1001> START - Cookbook sre.loadbalancer.restart-pybal rolling-restart of pybal on P{lvs1019*,lvs2009*} and A:lvs (T329049)

Mentioned in SAL (#wikimedia-operations) [2023-05-31T14:02:05Z] <hnowlan@cumin1001> END (PASS) - Cookbook sre.loadbalancer.restart-pybal (exit_code=0) rolling-restart of pybal on P{lvs1019*,lvs2009*} and A:lvs (T329049)

Change 920667 merged by Hnowlan:

[operations/puppet@production] service: move rest-gateway to production

https://gerrit.wikimedia.org/r/920667

Mentioned in SAL (#wikimedia-operations) [2023-06-13T11:35:15Z] <hnowlan@cumin1001> START - Cookbook sre.loadbalancer.restart-pybal rolling-restart of pybal on P{lvs1020*,lvs2014*} and A:lvs (T329049)

Mentioned in SAL (#wikimedia-operations) [2023-06-13T11:37:38Z] <hnowlan@cumin1001> END (PASS) - Cookbook sre.loadbalancer.restart-pybal (exit_code=0) rolling-restart of pybal on P{lvs1020*,lvs2014*} and A:lvs (T329049)

Mentioned in SAL (#wikimedia-operations) [2023-06-13T11:40:44Z] <hnowlan@cumin1001> START - Cookbook sre.loadbalancer.restart-pybal rolling-restart of pybal on P{lvs1019*,lvs2013*} and A:lvs (T329049)

Mentioned in SAL (#wikimedia-operations) [2023-06-13T11:41:38Z] <hnowlan@cumin1001> END (PASS) - Cookbook sre.loadbalancer.restart-pybal (exit_code=0) rolling-restart of pybal on P{lvs1019*,lvs2013*} and A:lvs (T329049)

Change 920710 merged by jenkins-bot:

[operations/deployment-charts@master] rest-gateway: add citoid support

https://gerrit.wikimedia.org/r/920710

Change 954248 had a related patch set uploaded (by Mvolz; author: Mvolz):

[operations/deployment-charts@master] rest-gateway: fix citoid regex

https://gerrit.wikimedia.org/r/954248

Change 973362 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/deployment-charts@master] rest-gateway: add params to config, rework citoid path matching

https://gerrit.wikimedia.org/r/973362

Change 954248 abandoned by Mvolz:

[operations/deployment-charts@master] rest-gateway: fix citoid regex

Reason:

superceded

https://gerrit.wikimedia.org/r/954248

hnowlan updated the task description. (Show Details)