[Bug]: Updating a REST API on the gateway doesn't resolve its vhosts, so _gateway_default_ is stored as a hostname
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
gateway/gateway-controller/pkg/service/restapi/service.goを読み、特にRestAPIService.UpdateとDeployAPIConfigurationを通る作成経路を確認し、それぞれがvhostをどのように扱うか比較してください。次に、gateway/gateway-controller/pkg/utils/api_deployment.goと、その中のresolveVhostSentinels関数を調べてください。更新時に_gateway_default_と未指定のvhostが現在のgatewayのデフォルト値に解決され、GETが解決後の値を返すことが完了条件です。この動作を確認するため、既存のREST API更新テストがあるか確認してください。
索引モデルが issue の本文から書いたものです。
説明
Please select the area the issue is related to
Gateway
Please select the aspect the issue is related to
Aspect/API (API backends, definitions, contracts, interfaces, OpenAPI)
Description
When a REST API is created on the gateway, its vhosts are resolved at deploy time: _gateway_default_, or a missing vhosts block, becomes the gateway's current default hosts. The resolved values are stored, so a later change to the gateway defaults doesn't move the API (discussion #369).
Updating the API through the gateway's REST API (PUT /rest-apis/{id}) skips that step:
- With
vhosts.main: _gateway_default_: the placeholder is stored literally, as a hostname. The API stops answering on the default hosts. - With no
vhostsblock: nothing is stored. The API keeps answering on the defaults only because the router falls back to the live default. So it follows the next config change, which is what deploy-time resolution is meant to prevent, andGETshows no vhosts.
Observed (gateway with router.vhosts.main.default = "*.wso2.com" and router.vhosts.sandbox.default = "*-sandbox.wso2.com")
POST /rest-apiswith novhosts:GET /rest-apis/{id}showsspec.vhosts.main*.wso2.comandspec.vhosts.sandbox*-sandbox.wso2.com, and a request withHost: api.wso2.comanswers 200.PUT /rest-apis/{id}withvhosts: {"main": "_gateway_default_"}:GETshowsspec.vhosts.main_gateway_default_, and the same request now answers 404.PUT /rest-apis/{id}with novhosts:GETshows nospec.vhostsat all.
Expected
An update resolves vhosts the same way a create does. _gateway_default_ and a missing vhosts block become the current gateway defaults, which are stored and shown by GET.
Cause
Create goes through DeployAPIConfiguration (gateway/gateway-controller/pkg/service/restapi/service.go:174), which calls resolveVhostSentinels (gateway/gateway-controller/pkg/utils/api_deployment.go:312). RestAPIService.Update (pkg/service/restapi/service.go:320) parses the body and saves it without that call. The event gateway's WebSub update does resolve vhosts, because it goes through DeployAPIConfiguration.
Steps to Reproduce
- Start a gateway with
[router.vhosts.main] default = "*.wso2.com". - Create a REST API with no
vhoststhroughPOST /rest-apis. A request withHost: api.wso2.comanswers 200. - Update it through
PUT /rest-apis/{id}with"vhosts": {"main": "_gateway_default_"}. GET /rest-apis/{id}shows_gateway_default_, and the request withHost: api.wso2.comanswers 404.- Update it again with no
vhosts:GETshows no vhosts.
Severity Level of the Issue
Severity/Major (Important functionality is broken. Should be prioritized. Doesn't need immediate attention)
Environment Details (with versions)
Current main (e90cde473). Platform-api and gateway built from source and run by the IT suite (tests/framework), on macOS with Rancher Desktop.
- 主要言語
- Go
- スター
- 85
- フォーク
- 137
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 247
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wso2/api-platform のほかの issue
-
Area/DeveloperPortal Aspect/UI Severity/Minor Type/Bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
wso2/api-platform#4369 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: host-rewrite policy documentation lists fewer allowed host characters than the policy acceptsオープンArea/Policies Aspect/Other Severity/Trivial Type/Bug
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
wso2/api-platform#4355 ·
メンテナーはふだん 1 日以内に返信
-
Area/Gateway Aspect/API Severity/Minor Type/Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
wso2/api-platform#4348 ·
メンテナーはふだん 1 日以内に返信
-
Aspect/AI Aspect/API. Severity/Major
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
wso2/api-platform#4343 ·
メンテナーはふだん 1 日以内に返信
-
Area/Policies Aspect/Configuration Severity/Minor Type/Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
wso2/api-platform#4330 ·
メンテナーはふだん 1 日以内に返信
wso2/api-platform の issue をすべて見る
似ている issue
-
benchmark
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
mozilla-ai/cq#601 ·
メンテナーはふだん 1 日以内に返信
-
documentation migration
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信