瀏覽代碼

Add service to specify port forwarding

Waqar Ahmed 4 年之前
父節點
當前提交
a88f0ad217
共有 2 個文件被更改,包括 50 次插入0 次删除
  1. 31 0
      charts/ix-chart/2010.0.1/questions.yaml
  2. 19 0
      charts/ix-chart/2010.0.1/service.yaml

+ 31 - 0
charts/ix-chart/2010.0.1/questions.yaml

@@ -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

+ 19 - 0
charts/ix-chart/2010.0.1/service.yaml

@@ -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 }}