Unverified Commit dfcf23a3 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by GitHub

Merge pull request #174 from truenas/NAS-112674

NAS-112674 / 22.02-RC.2 / Allow configuring nodeport/farmerport for chia application
parents bdee71c1 372707f1
......@@ -15,4 +15,4 @@ name: chia
sources:
- https://github.com/Chia-Network/chia-blockchain
- https://github.com/orgs/chia-network/packages/container/package/chia
version: 1.3.17
version: 1.3.18
......@@ -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,28 @@ 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
- variable: farmerPort
label: "Farmer Port to use for Chia"
schema:
type: int
min: 8000
max: 65535
default: 8447
required: true
......@@ -3,6 +3,8 @@ kind: Deployment
metadata:
name: {{ template "common.names.fullname" . }}
labels: {{ include "common.labels" . | nindent 4 }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
spec:
strategy:
type: {{ .Values.updateStrategy }}
......@@ -14,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
hostNetwork: true
hostNetwork: {{ include "hostNetworkingEnabled" . }}
containers:
- name: {{ .Chart.Name }}
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
......@@ -27,7 +29,11 @@ spec:
- name: chia-network
protocol: TCP
containerPort: 8444
hostPort: 8444
hostPort: null
- name: chia-farmer
protocol: TCP
containerPort: 8447
hostPort: null
{{ $envList := (default list .Values.environmentVariables) }}
{{ $envList = mustAppend $envList (dict "name" "keys" "value" "/plots/keyfile") }}
{{ $envList = mustAppend $envList (dict "name" "farmr" "value" $.Values.farmr_env) }}
......
{{/*
Enable host networking
*/}}
{{- define "hostNetworkingEnabled" -}}
{{- if or (lt (.Values.service.nodePort | int) 9000) (lt (.Values.service.farmerPort | int) 9000) -}}
{{- print "true" -}}
{{- else -}}
{{- print "false" -}}
{{- end -}}
{{- end -}}
{{/*
Enable Node Port Service
*/}}
{{- 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 }}
{{ $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 }}
\ No newline at end of file
......@@ -11,3 +11,6 @@ image:
repository: ixsystems/chia-docker
tag: v1.2.8
updateStrategy: Recreate
service:
nodePort: 31121
farmerPort: 31122
......@@ -15,4 +15,4 @@ name: chia
sources:
- https://github.com/Chia-Network/chia-blockchain
- https://github.com/orgs/chia-network/packages/container/package/chia
version: 1.3.17
version: 1.3.18
......@@ -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,28 @@ 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
- variable: farmerPort
label: "Farmer Port to use for Chia"
schema:
type: int
min: 8000
max: 65535
default: 8447
required: true
......@@ -3,6 +3,8 @@ kind: Deployment
metadata:
name: {{ template "common.names.fullname" . }}
labels: {{ include "common.labels" . | nindent 4 }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
spec:
strategy:
type: {{ .Values.updateStrategy }}
......@@ -14,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
hostNetwork: true
hostNetwork: {{ include "hostNetworkingEnabled" . }}
containers:
- name: {{ .Chart.Name }}
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
......@@ -27,7 +29,11 @@ spec:
- name: chia-network
protocol: TCP
containerPort: 8444
hostPort: 8444
hostPort: null
- name: chia-farmer
protocol: TCP
containerPort: 8447
hostPort: null
{{ $envList := (default list .Values.environmentVariables) }}
{{ $envList = mustAppend $envList (dict "name" "keys" "value" "/plots/keyfile") }}
{{ $envList = mustAppend $envList (dict "name" "farmr" "value" $.Values.farmr_env) }}
......
{{/*
Enable host networking
*/}}
{{- define "hostNetworkingEnabled" -}}
{{- if or (lt (.Values.service.nodePort | int) 9000) (lt (.Values.service.farmerPort | int) 9000) -}}
{{- print "true" -}}
{{- else -}}
{{- print "false" -}}
{{- end -}}
{{- end -}}
{{/*
Enable Node Port Service
*/}}
{{- 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 }}
{{ $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 }}
\ No newline at end of file
......@@ -11,3 +11,6 @@ image:
repository: ixsystems/chia-docker
tag: v1.2.8
updateStrategy: Recreate
service:
nodePort: 31121
farmerPort: 31122
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