Explorar o código

Allow node port of chia app to be configurable

sonicaj %!s(int64=3) %!d(string=hai) anos
pai
achega
67f9f344e4

+ 19 - 0
test/chia/1.3.18/questions.yaml

@@ -5,6 +5,8 @@ groups:
     description: "Configure farmr.net support"
   - name: "Chia Environment Variables"
     description: "Set the environment that will be visible to the container"
+  - name: "Networking"
+    description: "Configure networking for Chia container"
 
 portals:
   web_portal:
@@ -153,3 +155,20 @@ questions:
                 label: "Value"
                 schema:
                   type: string
+
+  - variable: service
+      description: "Networking Configuration"
+      label: "Networking Configuration"
+      group: "Networking"
+      schema:
+        type: dict
+        required: true
+        attrs:
+          - variable: nodePort
+            label: "Node Port to use for Chia"
+            schema:
+              type: int
+              min: 8000
+              max: 65535
+              default: 8444
+              required: true

+ 3 - 1
test/chia/1.3.18/templates/deployment.yaml

@@ -27,7 +27,9 @@ spec:
             - name: chia-network
               protocol: TCP
               containerPort: 8444
-              hostPort: 8444
+              {{ if lt .Values.service.nodePort 9000 }}
+              hostPort: {{ .Values.service.nodePort }}
+              {{ end }}
           {{ $envList := (default list .Values.environmentVariables) }}
           {{ $envList = mustAppend $envList (dict "name" "keys" "value" "/plots/keyfile") }}
           {{ $envList = mustAppend $envList (dict "name" "farmr" "value" $.Values.farmr_env) }}

+ 8 - 0
test/chia/1.3.18/templates/service.yaml

@@ -0,0 +1,8 @@
+{{ $svc := .Values.service }}
+{{ if ge $svc.nodePort 9000 }}
+{{ $ports := list }}
+{{ $ports = mustAppend $ports (dict "name" "chia-network" "port" $svc.nodePort "nodePort" $svc.nodePort "targetPort" 8444) }}
+{{ $params := . }}
+{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
+{{ include "common.classes.service" $params }}
+{{ end }}

+ 2 - 0
test/chia/1.3.18/test_values.yaml

@@ -11,3 +11,5 @@ image:
   repository: ixsystems/chia-docker
   tag: v1.2.8
 updateStrategy: Recreate
+service:
+  nodePort: 33121