Add service to specify port forwarding

This commit is contained in:
Waqar Ahmed 2020-10-16 15:16:54 +05:00
parent 38ef0b463f
commit a88f0ad217
2 changed files with 50 additions and 0 deletions

View File

@ -274,6 +274,37 @@ questions:
schema:
type: string
- variable: portForwardingList
label: "Specify Node ports to forward to workload"
group: "Networking"
description: "Specify ports of node and workload to forward traffic from node port to workload port"
schema:
type: list
items:
- variable: portForwarding
label: "Port Forwarding Configuration"
schema:
type: dict
attrs:
- variable: containerPort
label: "Container Port"
schema:
type: string
required: true
- variable: nodePort
label: "Node Port"
schema:
type: string
required: true
- variable: protocol
label: "Protocol"
schema:
type: string
default: "TCP"
enum:
- "TCP"
- "UDP"
# Storage Options
# Host path based volumes
- variable: hostPathVolumes

View File

@ -0,0 +1,19 @@
{{- if .Values.portForwardingList }}
apiVersion: v1
kind: Service
metadata:
name: {{- include "ix-chart.fullname" . }}
labels:
{{- include "ix-chart.labels" . | nindent 4 }}
spec:
type: NodePort
ports:
{{- range $index, $config := .Values.portForwardingList }}
- port: {{ $config.containerPort }}
targetPort: {{ $config.containerPort }}
protocol: {{ $config.protocol }}
nodePort: {{ $config.nodePort }}
{{- end }}
selector:
{{- include "ix-chart.selectorLabels" . | nindent 4 }}
{{- end }}