Commit a5b21a80 authored by sonicaj's avatar sonicaj

Allow specifying farmer port for chia application

parent 7f4906bd
......@@ -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
......@@ -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) }}
......
{{/*
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 -}}
{{ 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 }}
\ No newline at end of file
......@@ -13,3 +13,4 @@ image:
updateStrategy: Recreate
service:
nodePort: 33121
farmerPort: 33122
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment