Skip to content

Commit

Permalink
Allow changing of grpc and http ports from single placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
prafull01 committed Sep 24, 2024
1 parent fdbe0c3 commit cff7534
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 16 deletions.
6 changes: 2 additions & 4 deletions build/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,6 @@ For details see the [`values.yaml`](values.yaml) file.
| `conf.locality` | Locality attribute for this deployment | `""` |
| `conf.single-node` | Disable CockroachDB clustering (standalone mode) | `no` |
| `conf.sql-audit-dir` | Directory for SQL audit log | `""` |
| `conf.port` | CockroachDB primary serving port in Pods | `26257` |
| `conf.http-port` | CockroachDB HTTP port in Pods | `8080` |
| `conf.path` | CockroachDB data directory mount path | `cockroach-data` |
| `conf.store.enabled` | Enable store configuration for CockroachDB | `false` |
| `conf.store.type` | CockroachDB storage type | `""` |
Expand Down Expand Up @@ -347,9 +345,9 @@ For details see the [`values.yaml`](values.yaml) file.
| `statefulset.terminationGracePeriodSeconds` | Termination grace period for CRDB statefulset pods | `300` |
| `service.ports.grpc.external.port` | CockroachDB primary serving port in Services | `26257` |
| `service.ports.grpc.external.name` | CockroachDB primary serving port name in Services | `grpc` |
| `service.ports.grpc.internal.port` | CockroachDB inter-communication port in Services | `26257` |
| `service.ports.grpc.internal.port` | CockroachDB inter-communication port in Pods and Services | `26257` |
| `service.ports.grpc.internal.name` | CockroachDB inter-communication port name in Services | `grpc-internal` |
| `service.ports.http.port` | CockroachDB HTTP port in Services | `8080` |
| `service.ports.http.port` | CockroachDB HTTP port in Pods and Services | `8080` |
| `service.ports.http.name` | CockroachDB HTTP port name in Services | `http` |
| `service.public.type` | Public Service type | `ClusterIP` |
| `service.public.labels` | Additional labels of public Service | `{"app.kubernetes.io/component": "cockroachdb"}` |
Expand Down
10 changes: 6 additions & 4 deletions build/templates/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -303,10 +303,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

Expand Down
6 changes: 2 additions & 4 deletions cockroachdb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,6 @@ For details see the [`values.yaml`](values.yaml) file.
| `conf.locality` | Locality attribute for this deployment | `""` |
| `conf.single-node` | Disable CockroachDB clustering (standalone mode) | `no` |
| `conf.sql-audit-dir` | Directory for SQL audit log | `""` |
| `conf.port` | CockroachDB primary serving port in Pods | `26257` |
| `conf.http-port` | CockroachDB HTTP port in Pods | `8080` |
| `conf.path` | CockroachDB data directory mount path | `cockroach-data` |
| `conf.store.enabled` | Enable store configuration for CockroachDB | `false` |
| `conf.store.type` | CockroachDB storage type | `""` |
Expand Down Expand Up @@ -348,9 +346,9 @@ For details see the [`values.yaml`](values.yaml) file.
| `statefulset.terminationGracePeriodSeconds` | Termination grace period for CRDB statefulset pods | `300` |
| `service.ports.grpc.external.port` | CockroachDB primary serving port in Services | `26257` |
| `service.ports.grpc.external.name` | CockroachDB primary serving port name in Services | `grpc` |
| `service.ports.grpc.internal.port` | CockroachDB inter-communication port in Services | `26257` |
| `service.ports.grpc.internal.port` | CockroachDB inter-communication port in Pods and Services | `26257` |
| `service.ports.grpc.internal.name` | CockroachDB inter-communication port name in Services | `grpc-internal` |
| `service.ports.http.port` | CockroachDB HTTP port in Services | `8080` |
| `service.ports.http.port` | CockroachDB HTTP port in Pods and Services | `8080` |
| `service.ports.http.name` | CockroachDB HTTP port name in Services | `http` |
| `service.public.type` | Public Service type | `ClusterIP` |
| `service.public.labels` | Additional labels of public Service | `{"app.kubernetes.io/component": "cockroachdb"}` |
Expand Down
16 changes: 16 additions & 0 deletions cockroachdb/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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={{ . }}
Expand Down Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions cockroachdb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -304,10 +304,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

Expand Down

0 comments on commit cff7534

Please sign in to comment.