From b63d0ea9fe73e0c8ad0f1e942d92b34d6ae1e733 Mon Sep 17 00:00:00 2001 From: prafull01 Date: Mon, 23 Sep 2024 23:17:57 +0530 Subject: [PATCH] Allow changing of grpc and http ports from single placeholder --- build/templates/values.yaml | 10 ++++++---- cockroachdb/templates/statefulset.yaml | 16 ++++++++++++++++ cockroachdb/values.yaml | 10 ++++++---- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/build/templates/values.yaml b/build/templates/values.yaml index 4d2d16a2..1a444140 100644 --- a/build/templates/values.yaml +++ b/build/templates/values.yaml @@ -147,11 +147,11 @@ conf: # If non-empty, create a SQL audit log in the specified directory. sql-audit-dir: "" - # CockroachDB's port to listen to inter-communications and client connections. - port: 26257 + # WARNING this parameter is deprecated and will be removed in a future version. Use `.service.ports.grpc.internal.port` instead + port: "" - # CockroachDB's port to listen to HTTP requests. - http-port: 8080 + # WARNING this parameter is deprecated and will be removed in a future version. Use `.service.ports.http.port` instead + http-port: "" # CockroachDB's data mount path. path: cockroach-data @@ -293,10 +293,12 @@ service: # If the port number is different than `external.port`, then it will be # named as `internal.name` in Service. internal: + # CockroachDB's port to listen to inter-communications and client connections. port: 26257 # If using Istio set it to `cockroach`. name: grpc-internal http: + # CockroachDB's port to listen to HTTP requests. port: 8080 name: http diff --git a/cockroachdb/templates/statefulset.yaml b/cockroachdb/templates/statefulset.yaml index 190d931a..6b781aed 100644 --- a/cockroachdb/templates/statefulset.yaml +++ b/cockroachdb/templates/statefulset.yaml @@ -202,8 +202,16 @@ spec: {{- with .Values.conf.attrs }} --attrs={{ join `:` . }} {{- end }} + {{- if index .Values.conf `http-port` }} --http-port={{ index .Values.conf `http-port` | int64 }} + {{- else }} + --http-port={{ index .Values.service.ports.http.port | int64 }} + {{- end }} + {{ if .Values.conf.port }} --port={{ .Values.conf.port | int64 }} + {{- else }} + --port={{ .Values.service.ports.grpc.internal.port | int64 }} + {{- end }} --cache={{ .Values.conf.cache }} {{- with index .Values.conf `max-disk-temp-storage` }} --max-disk-temp-storage={{ . }} @@ -241,10 +249,18 @@ spec: {{- end }} ports: - name: grpc + {{ if .Values.conf.port }} containerPort: {{ .Values.conf.port | int64 }} + {{- else }} + containerPort: {{ .Values.service.ports.grpc.internal.port | int64 }} + {{- end }} protocol: TCP - name: http + {{- if index .Values.conf `http-port` }} containerPort: {{ index .Values.conf `http-port` | int64 }} + {{- else }} + containerPort: {{ index .Values.service.ports.http.port | int64 }} + {{- end }} protocol: TCP volumeMounts: - name: datadir diff --git a/cockroachdb/values.yaml b/cockroachdb/values.yaml index 92a3d833..e933ef20 100644 --- a/cockroachdb/values.yaml +++ b/cockroachdb/values.yaml @@ -148,11 +148,11 @@ conf: # If non-empty, create a SQL audit log in the specified directory. sql-audit-dir: "" - # CockroachDB's port to listen to inter-communications and client connections. - port: 26257 + # WARNING this parameter is deprecated and will be removed in a future version. Use `.service.ports.grpc.internal.port` instead + port: "" - # CockroachDB's port to listen to HTTP requests. - http-port: 8080 + # WARNING this parameter is deprecated and will be removed in a future version. Use `.service.ports.http.port` instead + http-port: "" # CockroachDB's data mount path. path: cockroach-data @@ -294,10 +294,12 @@ service: # If the port number is different than `external.port`, then it will be # named as `internal.name` in Service. internal: + # CockroachDB's port to listen to inter-communications and client connections. port: 26257 # If using Istio set it to `cockroach`. name: grpc-internal http: + # CockroachDB's port to listen to HTTP requests. port: 8080 name: http