-
Notifications
You must be signed in to change notification settings - Fork 90
feat(platform-api): support upstreamDefinitions pool and per-operation upstream overrides #2155
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
Open
mehara-rothila
wants to merge
8
commits into
wso2:main
Choose a base branch
from
mehara-rothila:feat/platform-api-upstream-definitions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8058f3e
feat(platform-api): add upstreamDefinitions pool and per-operation up…
mehara-rothila 408ae7d
feat(platform-api): validate upstreamDefinitions basePath against the…
mehara-rothila a932f98
fix(platform-api): correct the upstream weight description
mehara-rothila 40a6528
test(platform-api): drop a stale sentinel reference from a test comment
mehara-rothila 5dbd5d0
test(platform-api): apply review polish to comments and test setup
mehara-rothila ee93249
test(platform-api): extend upstream test coverage
mehara-rothila 67f26d5
refactor(platform-api): rename reusable-upstream converters and add s…
mehara-rothila 486ecb2
refactor(platform-api): clarify reusable upstream naming
mehara-rothila File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,15 +137,16 @@ type Vhosts struct { | |
|
|
||
| // APIYAMLData represents a basic spec section of the API deployment YAML | ||
| type APIYAMLData struct { | ||
| DisplayName string `yaml:"displayName"` | ||
| Version string `yaml:"version"` | ||
| Context string `yaml:"context"` | ||
| SubscriptionPlans []string `yaml:"subscriptionPlans,omitempty"` | ||
| Vhosts *Vhosts `yaml:"vhosts,omitempty"` | ||
| Upstream *UpstreamYAML `yaml:"upstream,omitempty"` | ||
| Policies []Policy `yaml:"policies,omitempty"` | ||
| Operations []api.OperationRequest `yaml:"operations,omitempty"` | ||
| Channels []api.ChannelRequest `yaml:"channels,omitempty"` | ||
| DisplayName string `yaml:"displayName"` | ||
| Version string `yaml:"version"` | ||
| Context string `yaml:"context"` | ||
| SubscriptionPlans []string `yaml:"subscriptionPlans,omitempty"` | ||
| Vhosts *Vhosts `yaml:"vhosts,omitempty"` | ||
| Upstream *UpstreamYAML `yaml:"upstream,omitempty"` | ||
| UpstreamDefinitions []ReusableUpstreamYAML `yaml:"upstreamDefinitions,omitempty"` | ||
| Policies []Policy `yaml:"policies,omitempty"` | ||
| Operations []api.OperationRequest `yaml:"operations,omitempty"` | ||
| Channels []api.ChannelRequest `yaml:"channels,omitempty"` | ||
| } | ||
|
|
||
| // UpstreamYAML represents the upstream configuration for API deployment YAML | ||
|
|
@@ -160,10 +161,28 @@ type UpstreamTarget struct { | |
| Ref string `yaml:"ref,omitempty"` | ||
| } | ||
|
|
||
| // ReusableUpstreamYAML represents a named entry in the deployment YAML's upstreamDefinitions pool. | ||
| type ReusableUpstreamYAML struct { | ||
| Name string `yaml:"name"` | ||
| BasePath string `yaml:"basePath,omitempty"` | ||
| Timeout *UpstreamTimeoutYAML `yaml:"timeout,omitempty"` | ||
|
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. Do we need the |
||
| Upstreams []UpstreamBackendYAML `yaml:"upstreams"` | ||
| } | ||
|
|
||
| // UpstreamBackendYAML represents a weighted backend target within a reusable upstream. | ||
| type UpstreamBackendYAML struct { | ||
| URL string `yaml:"url"` | ||
| Weight *int `yaml:"weight,omitempty"` | ||
| } | ||
|
|
||
| // UpstreamTimeoutYAML represents the timeout configuration for a reusable upstream. | ||
| type UpstreamTimeoutYAML struct { | ||
| Connect string `yaml:"connect,omitempty"` | ||
| } | ||
|
|
||
| // APIListResponse represents a paginated list of APIs (constitution-compliant) | ||
| type APIListResponse struct { | ||
| Count int `json:"count" yaml:"count"` // Number of items in current response | ||
| List []*API `json:"list" yaml:"list"` // Array of API objects | ||
| Pagination Pagination `json:"pagination" yaml:"pagination"` // Pagination metadata | ||
| } | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shall we rename this
ReusableUpstreamYAMLto something more aligning like[]UpstreamDefinition? Any limitation in doing a rename like that?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.
UpstreamDefinitionis already a pre-existing platform-api schema/type, used for the API-levelupstream.main/sandboxendpoint (theurl | ref | authunion). It predates this PR:api-platform/platform-api/resources/openapi.yaml
Lines 6703 to 6719 in be3e3a0
That is why the new pool entry is
ReusableUpstream: renaming it toUpstreamDefinitionwould collide with that existing type in both the OpenAPI components and the generated Go.For context, the gateway's
management-openapi.yamluses the opposite terminology,Upstreamfor the endpoint andUpstreamDefinitionfor the pool entry, so the two planes already name these concepts differently, independent of this PR.