From 4ebf1410c6967e5a51364cc7afcd0e203f052c39 Mon Sep 17 00:00:00 2001 From: Bethuel Mmbaga Date: Fri, 21 Feb 2025 11:16:24 +0300 Subject: [PATCH] [management] Add support to allocate same port for public and internal (#3347) Signed-off-by: bcmmbaga --- management/server/http/api/openapi.yml | 23 ++++++++++++++--- management/server/http/api/types.gen.go | 33 +++++++++++++++++++++---- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/management/server/http/api/openapi.yml b/management/server/http/api/openapi.yml index 510227e04..1a3d58eaa 100644 --- a/management/server/http/api/openapi.yml +++ b/management/server/http/api/openapi.yml @@ -1693,10 +1693,12 @@ components: type: array items: $ref: '#/components/schemas/IngressPortAllocationRequestPortRange' + direct_port: + description: Direct port allocation + $ref: '#/components/schemas/IngressPortAllocationRequestDirectPort' required: - name - enabled - - port_ranges IngressPortAllocationRequestPortRange: type: object properties: @@ -1711,12 +1713,27 @@ components: protocol: description: The protocol accepted by the port range type: string - enum: [ "tcp", "udp" ] + enum: [ "tcp", "udp", "tcp/udp" ] example: tcp required: - start - end - 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: type: object properties: @@ -1779,7 +1796,7 @@ components: protocol: description: Protocol accepted by the ports type: string - enum: [ "tcp", "udp" ] + enum: [ "tcp", "udp", "tcp/udp" ] example: tcp required: - translated_start diff --git a/management/server/http/api/types.gen.go b/management/server/http/api/types.gen.go index f79b22f0c..7b783a962 100644 --- a/management/server/http/api/types.gen.go +++ b/management/server/http/api/types.gen.go @@ -85,14 +85,23 @@ const ( // Defines values for IngressPortAllocationPortMappingProtocol. const ( - IngressPortAllocationPortMappingProtocolTcp IngressPortAllocationPortMappingProtocol = "tcp" - IngressPortAllocationPortMappingProtocolUdp IngressPortAllocationPortMappingProtocol = "udp" + IngressPortAllocationPortMappingProtocolTcp IngressPortAllocationPortMappingProtocol = "tcp" + IngressPortAllocationPortMappingProtocolTcpudp IngressPortAllocationPortMappingProtocol = "tcp/udp" + IngressPortAllocationPortMappingProtocolUdp IngressPortAllocationPortMappingProtocol = "udp" +) + +// Defines values for IngressPortAllocationRequestDirectPortProtocol. +const ( + IngressPortAllocationRequestDirectPortProtocolTcp IngressPortAllocationRequestDirectPortProtocol = "tcp" + IngressPortAllocationRequestDirectPortProtocolTcpudp IngressPortAllocationRequestDirectPortProtocol = "tcp/udp" + IngressPortAllocationRequestDirectPortProtocolUdp IngressPortAllocationRequestDirectPortProtocol = "udp" ) // Defines values for IngressPortAllocationRequestPortRangeProtocol. const ( - IngressPortAllocationRequestPortRangeProtocolTcp IngressPortAllocationRequestPortRangeProtocol = "tcp" - IngressPortAllocationRequestPortRangeProtocolUdp IngressPortAllocationRequestPortRangeProtocol = "udp" + IngressPortAllocationRequestPortRangeProtocolTcp IngressPortAllocationRequestPortRangeProtocol = "tcp" + IngressPortAllocationRequestPortRangeProtocolTcpudp IngressPortAllocationRequestPortRangeProtocol = "tcp/udp" + IngressPortAllocationRequestPortRangeProtocolUdp IngressPortAllocationRequestPortRangeProtocol = "udp" ) // Defines values for NameserverNsType. @@ -533,6 +542,8 @@ type IngressPortAllocationPortMappingProtocol string // IngressPortAllocationRequest defines model for IngressPortAllocationRequest. type IngressPortAllocationRequest struct { + DirectPort *IngressPortAllocationRequestDirectPort `json:"direct_port,omitempty"` + // Enabled Indicates if an ingress port allocation is enabled Enabled bool `json:"enabled"` @@ -540,9 +551,21 @@ type IngressPortAllocationRequest struct { Name string `json:"name"` // 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. type IngressPortAllocationRequestPortRange struct { // End The ending port of the range of forwarded ports