-
Notifications
You must be signed in to change notification settings - Fork 84
feat(platform-api): support API-level upstreamDefinitions pool #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
base: feature/operation-level-ep
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6326,6 +6326,11 @@ components: | |||||||||||||||||
| example: "2023-10-12T10:30:00Z" | ||||||||||||||||||
| upstream: | ||||||||||||||||||
| $ref: "#/components/schemas/Upstream" | ||||||||||||||||||
| upstreamDefinitions: | ||||||||||||||||||
| type: array | ||||||||||||||||||
| description: List of reusable named upstream definitions. API-level upstream `ref` values resolve against entries here by name. | ||||||||||||||||||
| items: | ||||||||||||||||||
| $ref: '#/components/schemas/ReusableUpstream' | ||||||||||||||||||
| lifeCycleStatus: | ||||||||||||||||||
| type: string | ||||||||||||||||||
| description: Current lifecycle status of the API | ||||||||||||||||||
|
|
@@ -8404,6 +8409,60 @@ components: | |||||||||||||||||
| description: Authentication value (API key, Bearer token, or Base64 encoded credentials for basic auth) | ||||||||||||||||||
| example: my-api-key-value | ||||||||||||||||||
|
|
||||||||||||||||||
| ReusableUpstream: | ||||||||||||||||||
|
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.
Suggested change
What about UpstreamDefinition here?
Contributor
Author
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. @tharindu1st @renuka-fernando this is a 3-way name swap, not a simple rename. Today in
( Two things point the same way:
We can't fully match the gateway since it has no wrapper (it inlines Proposal: keep the
This aligns the schema with both the gateway's pool name and our internal model. Good to proceed? |
||||||||||||||||||
| title: Reusable Upstream | ||||||||||||||||||
| type: object | ||||||||||||||||||
| required: | ||||||||||||||||||
| - name | ||||||||||||||||||
| - upstreams | ||||||||||||||||||
| description: A reusable named upstream definition. Referenced by name from an API-level upstream.ref. | ||||||||||||||||||
| properties: | ||||||||||||||||||
| name: | ||||||||||||||||||
| type: string | ||||||||||||||||||
| description: Unique identifier for this upstream definition | ||||||||||||||||||
| minLength: 1 | ||||||||||||||||||
| maxLength: 100 | ||||||||||||||||||
| pattern: '^[a-zA-Z0-9\-_]+$' | ||||||||||||||||||
| example: my-upstream-1 | ||||||||||||||||||
| basePath: | ||||||||||||||||||
|
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. pattern for basePath?
Contributor
Author
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. The gateway-controller validates upstream basePath in code (#2106), not via an OpenAPI pattern. Happy to add a matching pattern here for client-side validation , or keep it server-side to match the gateway. Which do you prefer? |
||||||||||||||||||
| type: string | ||||||||||||||||||
| description: Base path prefix prepended to all requests routed to this upstream (e.g., /api/v2) | ||||||||||||||||||
| example: /api/v2 | ||||||||||||||||||
| timeout: | ||||||||||||||||||
| $ref: '#/components/schemas/UpstreamTimeout' | ||||||||||||||||||
| upstreams: | ||||||||||||||||||
| type: array | ||||||||||||||||||
| description: List of backend targets with optional weights for load balancing | ||||||||||||||||||
| minItems: 1 | ||||||||||||||||||
| items: | ||||||||||||||||||
| type: object | ||||||||||||||||||
| additionalProperties: false | ||||||||||||||||||
| required: | ||||||||||||||||||
| - url | ||||||||||||||||||
| properties: | ||||||||||||||||||
| url: | ||||||||||||||||||
| type: string | ||||||||||||||||||
| format: uri | ||||||||||||||||||
| description: Backend URL (host and port only; path comes from basePath) | ||||||||||||||||||
| example: http://prod-backend-1:5000 | ||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||
| weight: | ||||||||||||||||||
| type: integer | ||||||||||||||||||
| description: Weight for load balancing (optional, default 100) | ||||||||||||||||||
| minimum: 0 | ||||||||||||||||||
| maximum: 100 | ||||||||||||||||||
| example: 80 | ||||||||||||||||||
|
|
||||||||||||||||||
| UpstreamTimeout: | ||||||||||||||||||
| title: Upstream Timeout | ||||||||||||||||||
| type: object | ||||||||||||||||||
| description: Timeout configuration for upstream requests | ||||||||||||||||||
| properties: | ||||||||||||||||||
| connect: | ||||||||||||||||||
| type: string | ||||||||||||||||||
| description: Connection timeout duration (e.g., "5s", "500ms") | ||||||||||||||||||
| pattern: '^\d+(\.\d+)?(ms|s|m|h)$' | ||||||||||||||||||
| example: 5s | ||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||
|
|
||||||||||||||||||
| ExtractionIdentifier: | ||||||||||||||||||
| type: object | ||||||||||||||||||
| required: | ||||||||||||||||||
|
|
||||||||||||||||||
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.
upstream should have to support ref as well right?
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.
Yes , main/sandbox resolve to UpstreamDefinition (line 8374), which is oneOf: [url] | [ref], so main: { ref: my-upstream-1 } already works. Same shape as the gateway's Upstream in #2012.