Pārlūkot izejas kodu

Allow specifying farmer port for chia application

sonicaj 3 gadi atpakaļ
vecāks
revīzija
a5b21a802e

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

@@ -172,3 +172,11 @@ questions:
             max: 65535
             default: 8444
             required: true
+        - variable: farmerPort
+          label: "Farmer Port to use for Chia"
+          schema:
+            type: int
+            min: 8000
+            max: 65535
+            default: 8447
+            required: true

+ 4 - 4
test/chia/1.3.18/templates/deployment.yaml

@@ -16,7 +16,7 @@ spec:
       labels: {{ include "common.labels.selectorLabels" . | nindent 8 }}
     spec:
       # FIXME: Let's please remove hostnetwork when upstream hostport issue is sorted out with kube-router
-      {{ if lt (.Values.service.nodePort | int) 9000 }}
+      {{ if eq (include "hostNetworkingEnabled" .) "true" }}
       hostNetwork: true
       {{ end }}
       containers:
@@ -31,9 +31,9 @@ spec:
             - name: chia-network
               protocol: TCP
               containerPort: 8444
-              {{ if lt (.Values.service.nodePort | int) 9000 }}
-              hostPort: {{ .Values.service.nodePort }}
-              {{ end }}
+            - name: chia-farmer
+              protocol: TCP
+              containerPort: 8447
           {{ $envList := (default list .Values.environmentVariables) }}
           {{ $envList = mustAppend $envList (dict "name" "keys" "value" "/plots/keyfile") }}
           {{ $envList = mustAppend $envList (dict "name" "farmr" "value" $.Values.farmr_env) }}

+ 21 - 0
test/chia/1.3.18/templates/networking.tpl

@@ -0,0 +1,21 @@
+{{/*
+Formats volumeMount for Minio tls keys and trusted certs
+*/}}
+{{- define "hostNetworkingEnabled" -}}
+{{- if or (lt (.Values.service.nodePort | int) 9000) (lt (.Values.service.farmerPort | int) 9000) -}}
+{{- print "true" -}}
+{{- else -}}
+{{- print "false" -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Formats volume for Minio tls keys and trusted certs
+*/}}
+{{- define "enableService" -}}
+{{- if or (ge (.Values.service.nodePort | int) 9000) (ge (.Values.service.farmerPort | int) 9000) -}}
+{{- print "true" -}}
+{{- else -}}
+{{- print "false" -}}
+{{- end -}}
+{{- end -}}

+ 7 - 2
test/chia/1.3.18/templates/service.yaml

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

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

@@ -13,3 +13,4 @@ image:
 updateStrategy: Recreate
 service:
   nodePort: 33121
+  farmerPort: 33122