diff --git a/apis/v1alpha1/cluster_types.go b/apis/v1alpha1/cluster_types.go index 9b99da6d6..55f8bf969 100644 --- a/apis/v1alpha1/cluster_types.go +++ b/apis/v1alpha1/cluster_types.go @@ -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"` diff --git a/config/crd/bases/crdb.cockroachlabs.com_crdbclusters.yaml b/config/crd/bases/crdb.cockroachlabs.com_crdbclusters.yaml index 4f7f24173..e662ed482 100644 --- a/config/crd/bases/crdb.cockroachlabs.com_crdbclusters.yaml +++ b/config/crd/bases/crdb.cockroachlabs.com_crdbclusters.yaml @@ -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 diff --git a/pkg/resource/statefulset.go b/pkg/resource/statefulset.go index 3025c62b6..fb3114c2e 100644 --- a/pkg/resource/statefulset.go +++ b/pkg/resource/statefulset.go @@ -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), } diff --git a/pkg/resource/testdata/TestStatefulSetBuilder/automount_sa.golden b/pkg/resource/testdata/TestStatefulSetBuilder/automount_sa.golden index 37b73f0db..1dee800a2 100644 --- a/pkg/resource/testdata/TestStatefulSetBuilder/automount_sa.golden +++ b/pkg/resource/testdata/TestStatefulSetBuilder/automount_sa.golden @@ -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' diff --git a/pkg/resource/testdata/TestStatefulSetBuilder/default_insecure_statefulset.golden b/pkg/resource/testdata/TestStatefulSetBuilder/default_insecure_statefulset.golden index 1600f00af..54132b7c4 100644 --- a/pkg/resource/testdata/TestStatefulSetBuilder/default_insecure_statefulset.golden +++ b/pkg/resource/testdata/TestStatefulSetBuilder/default_insecure_statefulset.golden @@ -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: diff --git a/pkg/resource/testdata/TestStatefulSetBuilder/default_secure.golden b/pkg/resource/testdata/TestStatefulSetBuilder/default_secure.golden index 15bf7d863..a2a30ddac 100644 --- a/pkg/resource/testdata/TestStatefulSetBuilder/default_secure.golden +++ b/pkg/resource/testdata/TestStatefulSetBuilder/default_secure.golden @@ -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' diff --git a/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_cli_args.golden b/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_cli_args.golden index 49e8aeb5f..48969ff9a 100644 --- a/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_cli_args.golden +++ b/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_cli_args.golden @@ -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: diff --git a/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_cli_args_with_join.golden b/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_cli_args_with_join.golden index 182ef0710..a13f445f6 100644 --- a/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_cli_args_with_join.golden +++ b/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_cli_args_with_join.golden @@ -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: diff --git a/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_with_resources.golden b/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_with_resources.golden index 7b3062da7..ee9250cf2 100644 --- a/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_with_resources.golden +++ b/pkg/resource/testdata/TestStatefulSetBuilder/insecure_statefulset_with_resources.golden @@ -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: diff --git a/pkg/scale/drainer.go b/pkg/scale/drainer.go index c9de41924..f64a7be08 100644 --- a/pkg/scale/drainer.go +++ b/pkg/scale/drainer.go @@ -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 { @@ -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")