瀏覽代碼

Merge pull request #174 from truenas/NAS-112674

NAS-112674 / 22.02-RC.2 / Allow configuring nodeport/farmerport for chia application
Waqar Ahmed 3 年之前
父節點
當前提交
dfcf23a388
共有 32 個文件被更改,包括 146 次插入6 次删除
  1. 0 0
      charts/chia/1.3.18/.helmignore
  2. 1 1
      charts/chia/1.3.18/Chart.yaml
  3. 0 0
      charts/chia/1.3.18/README.md
  4. 0 0
      charts/chia/1.3.18/app-readme.md
  5. 0 0
      charts/chia/1.3.18/charts/common-2105.0.0.tgz
  6. 0 0
      charts/chia/1.3.18/default_values.yaml
  7. 0 0
      charts/chia/1.3.18/ix_values.yaml
  8. 27 0
      charts/chia/1.3.18/questions.yaml
  9. 0 0
      charts/chia/1.3.18/requirements.lock
  10. 8 2
      charts/chia/1.3.18/templates/deployment.yaml
  11. 0 0
      charts/chia/1.3.18/templates/generate-mnemonic.yaml
  12. 0 0
      charts/chia/1.3.18/templates/mnemonic-configmap.yaml
  13. 21 0
      charts/chia/1.3.18/templates/networking.tpl
  14. 13 0
      charts/chia/1.3.18/templates/service.yaml
  15. 3 0
      charts/chia/1.3.18/test_values.yaml
  16. 0 0
      charts/chia/1.3.18/values.yaml
  17. 0 0
      test/chia/1.3.18/.helmignore
  18. 1 1
      test/chia/1.3.18/Chart.yaml
  19. 0 0
      test/chia/1.3.18/README.md
  20. 0 0
      test/chia/1.3.18/app-readme.md
  21. 0 0
      test/chia/1.3.18/charts/common-2105.0.0.tgz
  22. 0 0
      test/chia/1.3.18/default_values.yaml
  23. 0 0
      test/chia/1.3.18/ix_values.yaml
  24. 27 0
      test/chia/1.3.18/questions.yaml
  25. 0 0
      test/chia/1.3.18/requirements.lock
  26. 8 2
      test/chia/1.3.18/templates/deployment.yaml
  27. 0 0
      test/chia/1.3.18/templates/generate-mnemonic.yaml
  28. 0 0
      test/chia/1.3.18/templates/mnemonic-configmap.yaml
  29. 21 0
      test/chia/1.3.18/templates/networking.tpl
  30. 13 0
      test/chia/1.3.18/templates/service.yaml
  31. 3 0
      test/chia/1.3.18/test_values.yaml
  32. 0 0
      test/chia/1.3.18/values.yaml

+ 0 - 0
charts/chia/1.3.17/.helmignore → charts/chia/1.3.18/.helmignore


+ 1 - 1
charts/chia/1.3.17/Chart.yaml → charts/chia/1.3.18/Chart.yaml

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

+ 0 - 0
charts/chia/1.3.17/README.md → charts/chia/1.3.18/README.md


+ 0 - 0
charts/chia/1.3.17/app-readme.md → charts/chia/1.3.18/app-readme.md


+ 0 - 0
charts/chia/1.3.17/charts/common-2105.0.0.tgz → charts/chia/1.3.18/charts/common-2105.0.0.tgz


+ 0 - 0
charts/chia/1.3.17/default_values.yaml → charts/chia/1.3.18/default_values.yaml


+ 0 - 0
charts/chia/1.3.17/ix_values.yaml → charts/chia/1.3.18/ix_values.yaml


+ 27 - 0
test/chia/1.3.17/questions.yaml → charts/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,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

+ 0 - 0
charts/chia/1.3.17/requirements.lock → charts/chia/1.3.18/requirements.lock


+ 8 - 2
test/chia/1.3.17/templates/deployment.yaml → charts/chia/1.3.18/templates/deployment.yaml

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

+ 0 - 0
charts/chia/1.3.17/templates/generate-mnemonic.yaml → charts/chia/1.3.18/templates/generate-mnemonic.yaml


+ 0 - 0
charts/chia/1.3.17/templates/mnemonic-configmap.yaml → charts/chia/1.3.18/templates/mnemonic-configmap.yaml


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

@@ -0,0 +1,21 @@
+{{/*
+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 -}}

+ 13 - 0
charts/chia/1.3.18/templates/service.yaml

@@ -0,0 +1,13 @@
+{{ 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 }}

+ 3 - 0
test/chia/1.3.17/test_values.yaml → charts/chia/1.3.18/test_values.yaml

@@ -11,3 +11,6 @@ image:
   repository: ixsystems/chia-docker
   tag: v1.2.8
 updateStrategy: Recreate
+service:
+  nodePort: 31121
+  farmerPort: 31122

+ 0 - 0
charts/chia/1.3.17/values.yaml → charts/chia/1.3.18/values.yaml


+ 0 - 0
test/chia/1.3.17/.helmignore → test/chia/1.3.18/.helmignore


+ 1 - 1
test/chia/1.3.17/Chart.yaml → test/chia/1.3.18/Chart.yaml

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

+ 0 - 0
test/chia/1.3.17/README.md → test/chia/1.3.18/README.md


+ 0 - 0
test/chia/1.3.17/app-readme.md → test/chia/1.3.18/app-readme.md


+ 0 - 0
test/chia/1.3.17/charts/common-2105.0.0.tgz → test/chia/1.3.18/charts/common-2105.0.0.tgz


+ 0 - 0
test/chia/1.3.17/default_values.yaml → test/chia/1.3.18/default_values.yaml


+ 0 - 0
test/chia/1.3.17/ix_values.yaml → test/chia/1.3.18/ix_values.yaml


+ 27 - 0
charts/chia/1.3.17/questions.yaml → 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,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

+ 0 - 0
test/chia/1.3.17/requirements.lock → test/chia/1.3.18/requirements.lock


+ 8 - 2
charts/chia/1.3.17/templates/deployment.yaml → test/chia/1.3.18/templates/deployment.yaml

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

+ 0 - 0
test/chia/1.3.17/templates/generate-mnemonic.yaml → test/chia/1.3.18/templates/generate-mnemonic.yaml


+ 0 - 0
test/chia/1.3.17/templates/mnemonic-configmap.yaml → test/chia/1.3.18/templates/mnemonic-configmap.yaml


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

@@ -0,0 +1,21 @@
+{{/*
+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 -}}

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

@@ -0,0 +1,13 @@
+{{ 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 }}

+ 3 - 0
charts/chia/1.3.17/test_values.yaml → test/chia/1.3.18/test_values.yaml

@@ -11,3 +11,6 @@ image:
   repository: ixsystems/chia-docker
   tag: v1.2.8
 updateStrategy: Recreate
+service:
+  nodePort: 31121
+  farmerPort: 31122

+ 0 - 0
test/chia/1.3.17/values.yaml → test/chia/1.3.18/values.yaml