[management] Add support to allocate same port for public and internal (#3347)

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
Bethuel Mmbaga 2025-02-21 11:16:24 +03:00 committed by GitHub
parent 630edf2480
commit 4ebf1410c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 48 additions and 8 deletions

View File

@ -1693,10 +1693,12 @@ components:
type: array type: array
items: items:
$ref: '#/components/schemas/IngressPortAllocationRequestPortRange' $ref: '#/components/schemas/IngressPortAllocationRequestPortRange'
direct_port:
description: Direct port allocation
$ref: '#/components/schemas/IngressPortAllocationRequestDirectPort'
required: required:
- name - name
- enabled - enabled
- port_ranges
IngressPortAllocationRequestPortRange: IngressPortAllocationRequestPortRange:
type: object type: object
properties: properties:
@ -1711,12 +1713,27 @@ components:
protocol: protocol:
description: The protocol accepted by the port range description: The protocol accepted by the port range
type: string type: string
enum: [ "tcp", "udp" ] enum: [ "tcp", "udp", "tcp/udp" ]
example: tcp example: tcp
required: required:
- start - start
- end - end
- protocol - protocol
IngressPortAllocationRequestDirectPort:
type: object
properties:
count:
description: The number of ports to be forwarded
type: integer
example: 5
protocol:
description: The protocol accepted by the port
type: string
enum: [ "tcp", "udp", "tcp/udp" ]
example: udp
required:
- count
- protocol
IngressPortAllocation: IngressPortAllocation:
type: object type: object
properties: properties:
@ -1779,7 +1796,7 @@ components:
protocol: protocol:
description: Protocol accepted by the ports description: Protocol accepted by the ports
type: string type: string
enum: [ "tcp", "udp" ] enum: [ "tcp", "udp", "tcp/udp" ]
example: tcp example: tcp
required: required:
- translated_start - translated_start

View File

@ -86,12 +86,21 @@ const (
// Defines values for IngressPortAllocationPortMappingProtocol. // Defines values for IngressPortAllocationPortMappingProtocol.
const ( const (
IngressPortAllocationPortMappingProtocolTcp IngressPortAllocationPortMappingProtocol = "tcp" IngressPortAllocationPortMappingProtocolTcp IngressPortAllocationPortMappingProtocol = "tcp"
IngressPortAllocationPortMappingProtocolTcpudp IngressPortAllocationPortMappingProtocol = "tcp/udp"
IngressPortAllocationPortMappingProtocolUdp IngressPortAllocationPortMappingProtocol = "udp" IngressPortAllocationPortMappingProtocolUdp IngressPortAllocationPortMappingProtocol = "udp"
) )
// Defines values for IngressPortAllocationRequestDirectPortProtocol.
const (
IngressPortAllocationRequestDirectPortProtocolTcp IngressPortAllocationRequestDirectPortProtocol = "tcp"
IngressPortAllocationRequestDirectPortProtocolTcpudp IngressPortAllocationRequestDirectPortProtocol = "tcp/udp"
IngressPortAllocationRequestDirectPortProtocolUdp IngressPortAllocationRequestDirectPortProtocol = "udp"
)
// Defines values for IngressPortAllocationRequestPortRangeProtocol. // Defines values for IngressPortAllocationRequestPortRangeProtocol.
const ( const (
IngressPortAllocationRequestPortRangeProtocolTcp IngressPortAllocationRequestPortRangeProtocol = "tcp" IngressPortAllocationRequestPortRangeProtocolTcp IngressPortAllocationRequestPortRangeProtocol = "tcp"
IngressPortAllocationRequestPortRangeProtocolTcpudp IngressPortAllocationRequestPortRangeProtocol = "tcp/udp"
IngressPortAllocationRequestPortRangeProtocolUdp IngressPortAllocationRequestPortRangeProtocol = "udp" IngressPortAllocationRequestPortRangeProtocolUdp IngressPortAllocationRequestPortRangeProtocol = "udp"
) )
@ -533,6 +542,8 @@ type IngressPortAllocationPortMappingProtocol string
// IngressPortAllocationRequest defines model for IngressPortAllocationRequest. // IngressPortAllocationRequest defines model for IngressPortAllocationRequest.
type IngressPortAllocationRequest struct { type IngressPortAllocationRequest struct {
DirectPort *IngressPortAllocationRequestDirectPort `json:"direct_port,omitempty"`
// Enabled Indicates if an ingress port allocation is enabled // Enabled Indicates if an ingress port allocation is enabled
Enabled bool `json:"enabled"` Enabled bool `json:"enabled"`
@ -540,9 +551,21 @@ type IngressPortAllocationRequest struct {
Name string `json:"name"` Name string `json:"name"`
// PortRanges List of port ranges that are forwarded by the ingress peer // PortRanges List of port ranges that are forwarded by the ingress peer
PortRanges []IngressPortAllocationRequestPortRange `json:"port_ranges"` PortRanges *[]IngressPortAllocationRequestPortRange `json:"port_ranges,omitempty"`
} }
// IngressPortAllocationRequestDirectPort defines model for IngressPortAllocationRequestDirectPort.
type IngressPortAllocationRequestDirectPort struct {
// Count The number of ports to be forwarded
Count int `json:"count"`
// Protocol The protocol accepted by the port
Protocol IngressPortAllocationRequestDirectPortProtocol `json:"protocol"`
}
// IngressPortAllocationRequestDirectPortProtocol The protocol accepted by the port
type IngressPortAllocationRequestDirectPortProtocol string
// IngressPortAllocationRequestPortRange defines model for IngressPortAllocationRequestPortRange. // IngressPortAllocationRequestPortRange defines model for IngressPortAllocationRequestPortRange.
type IngressPortAllocationRequestPortRange struct { type IngressPortAllocationRequestPortRange struct {
// End The ending port of the range of forwarded ports // End The ending port of the range of forwarded ports