From 7f4906bdc172147c8ec67ed0587704edee1d2edd Mon Sep 17 00:00:00 2001 From: sonicaj Date: Thu, 7 Oct 2021 20:07:23 +0500 Subject: [PATCH] Properly disable host networking when chia ports are greater then or equal to 9000 --- test/chia/1.3.18/questions.yaml | 30 +++++++++++----------- test/chia/1.3.18/templates/deployment.yaml | 6 ++++- test/chia/1.3.18/templates/service.yaml | 2 +- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/test/chia/1.3.18/questions.yaml b/test/chia/1.3.18/questions.yaml index 74004f86d2..c163bb3e4e 100644 --- a/test/chia/1.3.18/questions.yaml +++ b/test/chia/1.3.18/questions.yaml @@ -157,18 +157,18 @@ questions: 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 + 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 diff --git a/test/chia/1.3.18/templates/deployment.yaml b/test/chia/1.3.18/templates/deployment.yaml index 4af5e243ee..5839b70ae2 100644 --- a/test/chia/1.3.18/templates/deployment.yaml +++ b/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,9 @@ 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 }} hostNetwork: true + {{ end }} containers: - name: {{ .Chart.Name }} {{ include "common.containers.imageConfig" .Values.image | nindent 10 }} @@ -27,7 +31,7 @@ spec: - name: chia-network protocol: TCP containerPort: 8444 - {{ if lt .Values.service.nodePort 9000 }} + {{ if lt (.Values.service.nodePort | int) 9000 }} hostPort: {{ .Values.service.nodePort }} {{ end }} {{ $envList := (default list .Values.environmentVariables) }} diff --git a/test/chia/1.3.18/templates/service.yaml b/test/chia/1.3.18/templates/service.yaml index ff64c4841f..8b9c3c225b 100644 --- a/test/chia/1.3.18/templates/service.yaml +++ b/test/chia/1.3.18/templates/service.yaml @@ -1,5 +1,5 @@ {{ $svc := .Values.service }} -{{ if ge $svc.nodePort 9000 }} +{{ if ge ($svc.nodePort | int) 9000 }} {{ $ports := list }} {{ $ports = mustAppend $ports (dict "name" "chia-network" "port" $svc.nodePort "nodePort" $svc.nodePort "targetPort" 8444) }} {{ $params := . }}