feat: Gateway supports the configuration of forwarding tcp/udp traffic. (#5445)

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
This commit is contained in:
hongzhouzi
2023-01-11 10:19:16 +08:00
committed by GitHub
parent c114d51a3b
commit 3a03b4a6e1
5 changed files with 45 additions and 1 deletions

View File

@@ -56,6 +56,14 @@ spec:
namespace:
type: string
type: object
tcp:
additionalProperties:
type: string
type: object
udp:
additionalProperties:
type: string
type: object
type: object
deployment:
properties:

View File

@@ -266,7 +266,22 @@ spec:
imagePullSecrets: []
# - name: secretName
# TCP service key:value pairs
# Ref: https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/exposing-tcp-udp-services.md
##
{{- if .Values.controller.tcp }}
tcp: {{ toYaml .Values.controller.tcp | nindent 4 }}
{{- end }}
# 8080: "default/example-tcp-svc:9000"
# UDP service key:value pairs
# Ref: https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/exposing-tcp-udp-services.md
##
{{- if .Values.controller.udp }}
udp: {{ toYaml .Values.controller.udp | nindent 4 }}
{{- end }}
# 53: "kube-system/kube-dns:53"

View File

@@ -15,6 +15,9 @@ controller:
tag: "v1.1.0"
pullPolicy: IfNotPresent
digest: ""
# add configuration of forwarding tcp/udp traffic
tcp: {}
udp: {}
service:

View File

@@ -38,6 +38,10 @@ type ControllerSpec struct {
Config map[string]string `json:"config,omitempty"`
// +optional
Scope Scope `json:"scope,omitempty"`
// +optional
TCP map[string]string `json:"tcp,omitempty"`
// +optional
UDP map[string]string `json:"udp,omitempty"`
}
type ServiceSpec struct {

View File

@@ -48,6 +48,20 @@ func (in *ControllerSpec) DeepCopyInto(out *ControllerSpec) {
}
}
out.Scope = in.Scope
if in.TCP != nil {
in, out := &in.TCP, &out.TCP
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.UDP != nil {
in, out := &in.UDP, &out.UDP
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControllerSpec.