From fbf25c6ba2ff60458cfa60dd8c032cb60b46a007 Mon Sep 17 00:00:00 2001 From: qiaozp <47812250+chivalryq@users.noreply.github.com> Date: Wed, 7 Sep 2022 11:33:45 +0800 Subject: [PATCH] Feat: add nodeport in webservice (#4696) Signed-off-by: Qiaozp Signed-off-by: Qiaozp --- charts/vela-core/templates/defwithtemplate/webservice.yaml | 5 +++++ .../vela-minimal/templates/defwithtemplate/webservice.yaml | 5 +++++ vela-templates/definitions/internal/component/webservice.cue | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/charts/vela-core/templates/defwithtemplate/webservice.yaml b/charts/vela-core/templates/defwithtemplate/webservice.yaml index 3237ebf45..be7b5b3bc 100644 --- a/charts/vela-core/templates/defwithtemplate/webservice.yaml +++ b/charts/vela-core/templates/defwithtemplate/webservice.yaml @@ -306,6 +306,9 @@ spec: if v.name == _|_ { name: "port-" + strconv.FormatInt(v.port, 10) } + if v.nodePort != _|_ && parameter.exposeType == "NodePort" { + nodePort: v.nodePort + } }, ] outputs: { @@ -354,6 +357,8 @@ spec: protocol: *"TCP" | "UDP" | "SCTP" // +usage=Specify if the port should be exposed expose: *false | bool + // +usage=exposed node port. Only Valid when exposeType is NodePort + nodePort?: int }] // +ignore diff --git a/charts/vela-minimal/templates/defwithtemplate/webservice.yaml b/charts/vela-minimal/templates/defwithtemplate/webservice.yaml index 3237ebf45..be7b5b3bc 100644 --- a/charts/vela-minimal/templates/defwithtemplate/webservice.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/webservice.yaml @@ -306,6 +306,9 @@ spec: if v.name == _|_ { name: "port-" + strconv.FormatInt(v.port, 10) } + if v.nodePort != _|_ && parameter.exposeType == "NodePort" { + nodePort: v.nodePort + } }, ] outputs: { @@ -354,6 +357,8 @@ spec: protocol: *"TCP" | "UDP" | "SCTP" // +usage=Specify if the port should be exposed expose: *false | bool + // +usage=exposed node port. Only Valid when exposeType is NodePort + nodePort?: int }] // +ignore diff --git a/vela-templates/definitions/internal/component/webservice.cue b/vela-templates/definitions/internal/component/webservice.cue index c184cdded..0e24438ac 100644 --- a/vela-templates/definitions/internal/component/webservice.cue +++ b/vela-templates/definitions/internal/component/webservice.cue @@ -351,6 +351,9 @@ template: { if v.name == _|_ { name: "port-" + strconv.FormatInt(v.port, 10) } + if v.nodePort != _|_ && parameter.exposeType == "NodePort" { + nodePort: v.nodePort + } }, ] @@ -401,6 +404,8 @@ template: { protocol: *"TCP" | "UDP" | "SCTP" // +usage=Specify if the port should be exposed expose: *false | bool + // +usage=exposed node port. Only Valid when exposeType is NodePort + nodePort?: int }] // +ignore