Skip to content

Commit

Permalink
Remove --http-port and --port from the cockroach operator
Browse files Browse the repository at this point in the history
  • Loading branch information
prafull01 committed Oct 21, 2024
1 parent ddb2b44 commit 3b43236
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 22 deletions.
4 changes: 2 additions & 2 deletions apis/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ type CrdbClusterSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Cockroach Database Image"
// +optional
Image *PodImage `json:"image,omitempty"`
// (Optional) The database port (`--port` CLI parameter when starting the service)
// (Optional) The database port (`--listen-addr` CLI parameter when starting the service)
// Default: 26258
// +optional
GRPCPort *int32 `json:"grpcPort,omitempty"`
// (Optional) The web UI port (`--http-port` CLI parameter when starting the service)
// (Optional) The web UI port (`--http-addr` CLI parameter when starting the service)
// Default: 8080
// +optional
HTTPPort *int32 `json:"httpPort,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/crdb.cockroachlabs.com_crdbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1086,12 +1086,12 @@ spec:
type: boolean
type: object
grpcPort:
description: '(Optional) The database port (`--port` CLI parameter
description: '(Optional) The database port (`--listen-addr` CLI parameter
when starting the service) Default: 26258'
format: int32
type: integer
httpPort:
description: '(Optional) The web UI port (`--http-port` CLI parameter
description: '(Optional) The web UI port (`--http-addr` CLI parameter
when starting the service) Default: 8080'
format: int32
type: integer
Expand Down
2 changes: 2 additions & 0 deletions config/manager/patches/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,5 @@ spec:
value: cockroachdb/cockroach:v24.2.2
- name: RELATED_IMAGE_COCKROACH_v24_2_3
value: cockroachdb/cockroach:v24.2.3
- name: RELATED_IMAGE_COCKROACH_v24_2_4
value: cockroachdb/cockroach:v24.2.4
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ spec:
name: RELATED_IMAGE_COCKROACH_v24_2_2
- image: registry.connect.redhat.com/cockroachdb/cockroach@sha256:acc083f7dde1fbc557d858d03fc26b68b2056997fc1a457e4695650214d5b303
name: RELATED_IMAGE_COCKROACH_v24_2_3
- image: registry.connect.redhat.com/cockroachdb/cockroach@sha256:226d7f1c3f0d70ac6532ad9490bebcdef44a40959b6aa7c11b0f2d1383a46217
name: RELATED_IMAGE_COCKROACH_v24_2_4
- image: RH_COCKROACH_OP_IMAGE_PLACEHOLDER
name: RELATED_IMAGE_COCKROACH_OPERATOR
version: 0.0.0
2 changes: 2 additions & 0 deletions config/manifests/patches/deployment_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,6 @@ spec:
value: registry.connect.redhat.com/cockroachdb/cockroach@sha256:08cec123813304ab03bd66d72a09949667a874a42320bedafda391ebcdb2e56c
- name: RELATED_IMAGE_COCKROACH_v24_2_3
value: registry.connect.redhat.com/cockroachdb/cockroach@sha256:acc083f7dde1fbc557d858d03fc26b68b2056997fc1a457e4695650214d5b303
- name: RELATED_IMAGE_COCKROACH_v24_2_4
value: registry.connect.redhat.com/cockroachdb/cockroach@sha256:226d7f1c3f0d70ac6532ad9490bebcdef44a40959b6aa7c11b0f2d1383a46217
image: RH_COCKROACH_OP_IMAGE_PLACEHOLDER
2 changes: 1 addition & 1 deletion config/samples/crdb-tls-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ kind: CrdbCluster
metadata:
name: crdb-tls-example
spec:
cockroachDBVersion: v24.2.3
cockroachDBVersion: v24.2.4
dataStore:
pvc:
spec:
Expand Down
3 changes: 3 additions & 0 deletions crdb-versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -475,3 +475,6 @@ CrdbVersions:
- image: cockroachdb/cockroach:v24.2.3
redhatImage: registry.connect.redhat.com/cockroachdb/cockroach@sha256:acc083f7dde1fbc557d858d03fc26b68b2056997fc1a457e4695650214d5b303
tag: v24.2.3
- image: cockroachdb/cockroach:v24.2.4
redhatImage: registry.connect.redhat.com/cockroachdb/cockroach@sha256:226d7f1c3f0d70ac6532ad9490bebcdef44a40959b6aa7c11b0f2d1383a46217
tag: v24.2.4
2 changes: 1 addition & 1 deletion examples/client-secure-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
serviceAccountName: cockroachdb-sa
containers:
- name: cockroachdb-client-secure
image: cockroachdb/cockroach:v24.2.3
image: cockroachdb/cockroach:v24.2.4
imagePullPolicy: IfNotPresent
volumeMounts:
- name: client-certs
Expand Down
4 changes: 2 additions & 2 deletions examples/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ spec:
memory: 8Gi
tlsEnabled: true
# You can set either a version of the db or a specific image name
# cockroachDBVersion: v24.2.3
# cockroachDBVersion: v24.2.4
image:
name: cockroachdb/cockroach:v24.2.3
name: cockroachdb/cockroach:v24.2.4
# nodes refers to the number of crdb pods that are created
# via the statefulset
nodes: 3
Expand Down
2 changes: 1 addition & 1 deletion examples/smoketest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ spec:
memory: 300Mi
tlsEnabled: true
image:
name: cockroachdb/cockroach:v24.2.3
name: cockroachdb/cockroach:v24.2.4
nodes: 3
4 changes: 2 additions & 2 deletions hack/build/repos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5336,8 +5336,8 @@ def _go_dependencies():
build_file_generation = "on",
build_file_proto_mode = "disable",
importpath = "gopkg.in/yaml.v3",
sum = "h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=",
version = "v3.0.0-20210107192922-496545a6307b",
sum = "h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA=",
version = "v3.0.0",
)
go_repository(
name = "io_etcd_go_bbolt",
Expand Down
4 changes: 2 additions & 2 deletions install/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1084,12 +1084,12 @@ spec:
type: boolean
type: object
grpcPort:
description: '(Optional) The database port (`--port` CLI parameter
description: '(Optional) The database port (`--listen-addr` CLI parameter
when starting the service) Default: 26258'
format: int32
type: integer
httpPort:
description: '(Optional) The web UI port (`--http-port` CLI parameter
description: '(Optional) The web UI port (`--http-addr` CLI parameter
when starting the service) Default: 8080'
format: int32
type: integer
Expand Down
2 changes: 2 additions & 0 deletions install/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,8 @@ spec:
value: cockroachdb/cockroach:v24.2.2
- name: RELATED_IMAGE_COCKROACH_v24_2_3
value: cockroachdb/cockroach:v24.2.3
- name: RELATED_IMAGE_COCKROACH_v24_2_4
value: cockroachdb/cockroach:v24.2.4
- name: OPERATOR_NAME
value: cockroachdb
- name: POD_NAME
Expand Down
2 changes: 1 addition & 1 deletion pkg/resource/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func (b StatefulSetBuilder) dbArgs() []string {
fmt.Sprintf("--advertise-host=$(POD_NAME).%s.%s",
b.Cluster.DiscoveryServiceName(), b.Cluster.Namespace()),
b.Cluster.SecureMode(),
"--http-port=" + fmt.Sprint(*b.Spec().HTTPPort),
"--http-addr=:" + fmt.Sprint(*b.Spec().HTTPPort),
"--sql-addr=:" + fmt.Sprint(*b.Spec().SQLPort),
"--listen-addr=:" + fmt.Sprint(*b.Spec().GRPCPort),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- /bin/bash
- -ecx
- 'exec /cockroach/cockroach.sh start --advertise-host=$(POD_NAME).test-cluster.test-ns
--certs-dir=/cockroach/cockroach-certs/ --http-port=8080 --sql-addr=:26257
--certs-dir=/cockroach/cockroach-certs/ --http-addr=:8080 --sql-addr=:26257
--listen-addr=:26258 --log="{sinks: {stderr: {channels: [OPS, HEALTH], redact:
true}}}" --cache $(expr $MEMORY_LIMIT_MIB / 4)MiB --max-sql-memory $(expr
$MEMORY_LIMIT_MIB / 4)MiB --join=test-cluster-0.test-cluster.test-ns:26258'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- /bin/bash
- -ecx
- 'exec /cockroach/cockroach.sh start --advertise-host=$(POD_NAME).test-cluster.test-ns
--insecure --http-port=8080 --sql-addr=:26257 --listen-addr=:26258 --log="{sinks:
--insecure --http-addr=:8080 --sql-addr=:26257 --listen-addr=:26258 --log="{sinks:
{stderr: {channels: [OPS, HEALTH], redact: true}}}" --cache $(expr $MEMORY_LIMIT_MIB
/ 4)MiB --max-sql-memory $(expr $MEMORY_LIMIT_MIB / 4)MiB --join=test-cluster-0.test-cluster.test-ns:26258'
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- /bin/bash
- -ecx
- 'exec /cockroach/cockroach.sh start --advertise-host=$(POD_NAME).test-cluster.test-ns
--certs-dir=/cockroach/cockroach-certs/ --http-port=8080 --sql-addr=:26257
--certs-dir=/cockroach/cockroach-certs/ --http-addr=:8080 --sql-addr=:26257
--listen-addr=:26258 --log="{sinks: {stderr: {channels: [OPS, HEALTH], redact:
true}}}" --cache $(expr $MEMORY_LIMIT_MIB / 4)MiB --max-sql-memory $(expr
$MEMORY_LIMIT_MIB / 4)MiB --join=test-cluster-0.test-cluster.test-ns:26258'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
- /bin/bash
- -ecx
- 'exec /cockroach/cockroach.sh start --advertise-host=$(POD_NAME).test-cluster.test-ns
--insecure --http-port=8080 --sql-addr=:26257 --listen-addr=:26258 --log="{sinks:
--insecure --http-addr=:8080 --sql-addr=:26257 --listen-addr=:26258 --log="{sinks:
{stderr: {channels: [OPS, HEALTH], redact: true}}}" --cache=30% --max-sql-memory=2GB
--temp-dir=/tmp --join=test-cluster-0.test-cluster.test-ns:26258'
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
- /bin/bash
- -ecx
- 'exec /cockroach/cockroach.sh start --advertise-host=$(POD_NAME).test-cluster.test-ns
--insecure --http-port=8080 --sql-addr=:26257 --listen-addr=:26258 --log="{sinks:
--insecure --http-addr=:8080 --sql-addr=:26257 --listen-addr=:26258 --log="{sinks:
{stderr: {channels: [OPS, HEALTH], redact: true}}}" --cache=30% --max-sql-memory=2GB
--join=test-cluster-1.new-test-cluster.new-test-ns:26258'
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- /bin/bash
- -ecx
- exec /cockroach/cockroach.sh start --advertise-host=$(POD_NAME).test-cluster.test-ns
--insecure --http-port=8080 --sql-addr=:26257 --listen-addr=:26258 --logtostderr=INFO
--insecure --http-addr=:8080 --sql-addr=:26257 --listen-addr=:26258 --logtostderr=INFO
--cache $(expr $MEMORY_LIMIT_MIB / 4)MiB --max-sql-memory $(expr $MEMORY_LIMIT_MIB
/ 4)MiB --join=test-cluster-0.test-cluster.test-ns:26258
env:
Expand Down
4 changes: 2 additions & 2 deletions pkg/scale/drainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (d *CockroachNodeDrainer) makeDrainStatusChecker(id uint) func(ctx context.

func (d *CockroachNodeDrainer) executeDrainCmd(ctx context.Context, id uint, gRPCPort int32) error {
cmd := []string{
"./cockroach", "node", "decommission", fmt.Sprintf("%d", id), "--wait=none", fmt.Sprintf("--port=%d", gRPCPort),
"./cockroach", "node", "decommission", fmt.Sprintf("%d", id), "--wait=none", fmt.Sprintf("--host=:%d", gRPCPort),
}

if d.Secure {
Expand All @@ -215,7 +215,7 @@ func (d *CockroachNodeDrainer) executeDrainCmd(ctx context.Context, id uint, gRP
// a node which will transition it from `decommissioning` to `decommissioned`. This should be executed
// after it's confirmed that there are 0 replicas on the node.
func (d *CockroachNodeDrainer) markNodeAsDecommissioned(ctx context.Context, id uint, gRPCPort int32) error {
cmd := []string{"./cockroach", "node", "decommission", fmt.Sprintf("%d", id), fmt.Sprintf("--port=%d", gRPCPort)}
cmd := []string{"./cockroach", "node", "decommission", fmt.Sprintf("%d", id), fmt.Sprintf("--host=:%d", gRPCPort)}

if d.Secure {
cmd = append(cmd, "--certs-dir=cockroach-certs")
Expand Down

0 comments on commit 3b43236

Please sign in to comment.