From 8b7f8931624e698919d760dc7972422d2055b0d3 Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Tue, 4 Jul 2023 17:42:20 +0200 Subject: [PATCH] configprofiles: emphasize "cluster virtualization" Before this patch: ``` $ cockroach start-single-node --config-profile=help ... replication-source configuration suitable for a replication source cluster (alias for "multitenant+app+sharedservice+repl") replication-target configuration suitable for a replication target cluster (alias for "multitenant+noapp+repl")` multitenant+app+sharedservice multi-tenant cluster with one secondary tenant configured to serve SQL application traffic multitenant+app+sharedservice+repl multi-tenant cluster with one secondary tenant configured to serve SQL application traffic, with replication enabled multitenant+noapp multi-tenant cluster with no secondary tenant defined yet multitenant+noapp+repl multi-tenant cluster with no secondary tenant defined yet, with replication enabled ``` After this patch: ``` replication-source configuration suitable for a replication source cluster (alias for "virtual+app+sharedservice+repl") replication-target configuration suitable for a replication target cluster (alias for "virtual+noapp+repl") virtual+app+sharedservice one virtual cluster configured to serve SQL application traffic virtual+app+sharedservice+repl one virtual cluster configured to serve SQL application traffic, with replication enabled virtual+noapp virtualization enabled but no virtual cluster defined yet virtual+noapp+repl virtualization enabled but no virtual cluster defined yet, with replication enabled ``` Release note: None --- pkg/configprofiles/profiles.go | 43 ++++++++++--------- pkg/configprofiles/setter.go | 3 ++ .../testdata/replication-source | 2 +- .../testdata/replication-target | 2 +- .../testdata/{multitenant-app => virtual-app} | 4 +- ...{multitenant-app-repl => virtual-app-repl} | 4 +- .../{multitenant-noapp => virtual-noapp} | 4 +- ...titenant-noapp-repl => virtual-noapp-repl} | 4 +- 8 files changed, 35 insertions(+), 31 deletions(-) rename pkg/configprofiles/testdata/{multitenant-app => virtual-app} (97%) rename pkg/configprofiles/testdata/{multitenant-app-repl => virtual-app-repl} (97%) rename pkg/configprofiles/testdata/{multitenant-noapp => virtual-noapp} (97%) rename pkg/configprofiles/testdata/{multitenant-noapp-repl => virtual-noapp-repl} (97%) diff --git a/pkg/configprofiles/profiles.go b/pkg/configprofiles/profiles.go index 1ec630616b51..daa665b4a939 100644 --- a/pkg/configprofiles/profiles.go +++ b/pkg/configprofiles/profiles.go @@ -20,15 +20,16 @@ import ( type alias struct { aliasTarget string description string + hidden bool } var aliases = map[string]alias{ "replication-source": { - aliasTarget: "multitenant+app+sharedservice+repl", + aliasTarget: "virtual+app+sharedservice+repl", description: "configuration suitable for a replication source cluster", }, "replication-target": { - aliasTarget: "multitenant+noapp+repl", + aliasTarget: "virtual+noapp+repl", description: "configuration suitable for a replication target cluster", }, } @@ -60,25 +61,25 @@ var staticProfiles = map[string]configProfile{ ), }, }, - "multitenant+noapp": { - description: "multi-tenant cluster with no secondary tenant defined yet", - tasks: multitenantClusterInitTasks, + "virtual+noapp": { + description: "virtualization enabled but no virtual cluster defined yet", + tasks: virtClusterInitTasks, }, - "multitenant+noapp+repl": { - description: "multi-tenant cluster with no secondary tenant defined yet, with replication enabled", - tasks: enableReplication(multitenantClusterInitTasks), + "virtual+noapp+repl": { + description: "virtualization enabled but no virtual cluster defined yet, with replication enabled", + tasks: enableReplication(virtClusterInitTasks), }, - "multitenant+app+sharedservice": { - description: "multi-tenant cluster with one secondary tenant configured to serve SQL application traffic", - tasks: multitenantClusterWithAppServiceInitTasks, + "virtual+app+sharedservice": { + description: "one virtual cluster configured to serve SQL application traffic", + tasks: virtClusterWithAppServiceInitTasks, }, - "multitenant+app+sharedservice+repl": { - description: "multi-tenant cluster with one secondary tenant configured to serve SQL application traffic, with replication enabled", - tasks: enableReplication(multitenantClusterWithAppServiceInitTasks), + "virtual+app+sharedservice+repl": { + description: "one virtual cluster configured to serve SQL application traffic, with replication enabled", + tasks: enableReplication(virtClusterWithAppServiceInitTasks), }, } -var multitenantClusterInitTasks = []autoconfigpb.Task{ +var virtClusterInitTasks = []autoconfigpb.Task{ makeTask("initial cluster config", /* nonTxnSQL */ []string{ // Disable trace redaction (this ought to be configurable per-tenant, but is not possible yet in v23.1). @@ -96,7 +97,7 @@ var multitenantClusterInitTasks = []autoconfigpb.Task{ }, nil, /* txnSQL */ ), - makeTask("create tenant template", + makeTask("create virtual cluster template", nil, /* nonTxnSQL */ /* txnSQL */ []string{ @@ -110,7 +111,7 @@ var multitenantClusterInitTasks = []autoconfigpb.Task{ }, ), // Finally. - makeTask("use the application tenant template by default in CREATE VIRTUAL CLUSTER", + makeTask("use the application virtual cluster template by default in CREATE VIRTUAL CLSUTER", /* nonTxnSQL */ []string{ "SET CLUSTER SETTING sql.create_tenant.default_template = 'template'", }, @@ -118,9 +119,9 @@ var multitenantClusterInitTasks = []autoconfigpb.Task{ ), } -var multitenantClusterWithAppServiceInitTasks = append( - multitenantClusterInitTasks, - makeTask("create an application tenant", +var virtClusterWithAppServiceInitTasks = append( + virtClusterInitTasks, + makeTask("create an application virtual cluster", nil, /* nonTxnSQL */ /* txnSQL */ []string{ // Create the app tenant record. @@ -129,7 +130,7 @@ var multitenantClusterWithAppServiceInitTasks = append( "ALTER VIRTUAL CLUSTER application START SERVICE SHARED", }, ), - makeTask("activate application tenant", + makeTask("activate application virtual cluster", /* nonTxnSQL */ []string{ // Make the app tenant receive SQL connections by default. "SET CLUSTER SETTING server.controller.default_tenant = 'application'", diff --git a/pkg/configprofiles/setter.go b/pkg/configprofiles/setter.go index 6d8ea7c2151d..22bf58fe31c3 100644 --- a/pkg/configprofiles/setter.go +++ b/pkg/configprofiles/setter.go @@ -107,6 +107,9 @@ var profileHelp = func() string { if _, ok := staticProfiles[a.aliasTarget]; !ok { panic(errors.AssertionFailedf("alias %q refers to non-existent profile %q", name, a.aliasTarget)) } + if a.hidden { + continue + } allNames = append(allNames, name) } sort.Strings(allNames) diff --git a/pkg/configprofiles/testdata/replication-source b/pkg/configprofiles/testdata/replication-source index 1bca6d48f0ca..5258c6614f83 100644 --- a/pkg/configprofiles/testdata/replication-source +++ b/pkg/configprofiles/testdata/replication-source @@ -1,5 +1,5 @@ profile replication-source ---- -canonical profile name: multitenant+app+sharedservice+repl +canonical profile name: virtual+app+sharedservice+repl server started diff --git a/pkg/configprofiles/testdata/replication-target b/pkg/configprofiles/testdata/replication-target index 4c1bd8785dd2..39877f49ee9c 100644 --- a/pkg/configprofiles/testdata/replication-target +++ b/pkg/configprofiles/testdata/replication-target @@ -1,5 +1,5 @@ profile replication-target ---- -canonical profile name: multitenant+noapp+repl +canonical profile name: virtual+noapp+repl server started diff --git a/pkg/configprofiles/testdata/multitenant-app b/pkg/configprofiles/testdata/virtual-app similarity index 97% rename from pkg/configprofiles/testdata/multitenant-app rename to pkg/configprofiles/testdata/virtual-app index d2425716bcd5..c788694786d3 100644 --- a/pkg/configprofiles/testdata/multitenant-app +++ b/pkg/configprofiles/testdata/virtual-app @@ -1,7 +1,7 @@ profile -multitenant+app+sharedservice +virtual+app+sharedservice ---- -canonical profile name: multitenant+app+sharedservice +canonical profile name: virtual+app+sharedservice server started connect-tenant diff --git a/pkg/configprofiles/testdata/multitenant-app-repl b/pkg/configprofiles/testdata/virtual-app-repl similarity index 97% rename from pkg/configprofiles/testdata/multitenant-app-repl rename to pkg/configprofiles/testdata/virtual-app-repl index bbfef13442e1..c1b8e3d9a160 100644 --- a/pkg/configprofiles/testdata/multitenant-app-repl +++ b/pkg/configprofiles/testdata/virtual-app-repl @@ -1,7 +1,7 @@ profile -multitenant+app+sharedservice+repl +virtual+app+sharedservice+repl ---- -canonical profile name: multitenant+app+sharedservice+repl +canonical profile name: virtual+app+sharedservice+repl server started connect-tenant diff --git a/pkg/configprofiles/testdata/multitenant-noapp b/pkg/configprofiles/testdata/virtual-noapp similarity index 97% rename from pkg/configprofiles/testdata/multitenant-noapp rename to pkg/configprofiles/testdata/virtual-noapp index 1785b6138a68..2a8c8f21d351 100644 --- a/pkg/configprofiles/testdata/multitenant-noapp +++ b/pkg/configprofiles/testdata/virtual-noapp @@ -1,7 +1,7 @@ profile -multitenant+noapp +virtual+noapp ---- -canonical profile name: multitenant+noapp +canonical profile name: virtual+noapp server started system-sql diff --git a/pkg/configprofiles/testdata/multitenant-noapp-repl b/pkg/configprofiles/testdata/virtual-noapp-repl similarity index 97% rename from pkg/configprofiles/testdata/multitenant-noapp-repl rename to pkg/configprofiles/testdata/virtual-noapp-repl index 52456f3f6f57..2efe13c0eb8f 100644 --- a/pkg/configprofiles/testdata/multitenant-noapp-repl +++ b/pkg/configprofiles/testdata/virtual-noapp-repl @@ -1,7 +1,7 @@ profile -multitenant+noapp+repl +virtual+noapp+repl ---- -canonical profile name: multitenant+noapp+repl +canonical profile name: virtual+noapp+repl server started system-sql