-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tenantcapabilities: introduce TenantCapabilities proto
This commit adds the skeletal structure for a `TenantCapabilities` proto, which is intended to encapsulate capabilities for a specific tenant. Capabilities are intended to be stored in the `system.tenants` table, in its Info column. To that end, we modify `TenantInfo` to contain capabilities. However, actually populating this field through SQL is left to a future commit. Future commits will also add the infrastructure required to check a tenant's requests against its capabilities for "privileged" operations. For now, I've only accounted for the `CanAdminSplit` capability -- this will likely expand to a fuller set as we introduce other capabilities in the system. References #94643 Epic: CRDB-18503 Release note: None
- Loading branch information
1 parent
48fb16b
commit e5a7093
Showing
16 changed files
with
219 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,3 @@ query-sql | |
SELECT * FROM [SHOW SCHEDULES] WHERE label='hello'; | ||
---- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -584,4 +584,3 @@ foofoo | |
baz | ||
show_cluster_backup | ||
show_database_backup | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
load("//build/bazelutil/unused_checker:unused.bzl", "get_x_data") |
30 changes: 30 additions & 0 deletions
30
pkg/multitenant/tenantcapabilities/tenantcapabilitiespb/BUILD.bazel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
load("//build/bazelutil/unused_checker:unused.bzl", "get_x_data") | ||
load("@rules_proto//proto:defs.bzl", "proto_library") | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") | ||
|
||
proto_library( | ||
name = "tenantcapabilitiespb_proto", | ||
srcs = ["capabilities.proto"], | ||
strip_import_prefix = "/pkg", | ||
visibility = ["//visibility:public"], | ||
deps = ["@com_github_gogo_protobuf//gogoproto:gogo_proto"], | ||
) | ||
|
||
go_proto_library( | ||
name = "tenantcapabilitiespb_go_proto", | ||
compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"], | ||
importpath = "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities/tenantcapabilitiespb", | ||
proto = ":tenantcapabilitiespb_proto", | ||
visibility = ["//visibility:public"], | ||
deps = ["@com_github_gogo_protobuf//gogoproto"], | ||
) | ||
|
||
go_library( | ||
name = "tenantcapabilitiespb", | ||
embed = [":tenantcapabilitiespb_go_proto"], | ||
importpath = "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities/tenantcapabilitiespb", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
get_x_data(name = "get_x_data") |
32 changes: 32 additions & 0 deletions
32
pkg/multitenant/tenantcapabilities/tenantcapabilitiespb/capabilities.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2023 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
syntax = "proto3"; | ||
package cockroach.multitenant.tenantcapabilities.tenantcapabilitiespb; | ||
option go_package = "tenantcapabilitiespb"; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
// TenantCapabilities encapsulates a set of capabilities[1] for a specific | ||
// tenant. Capabilities for a specific tenant are stored in the system.tenants | ||
// table and are checked against in KV when the tenant performs a privileged | ||
// operation. | ||
// | ||
// [1] Certain requests in the system are considered "privileged", and as such, | ||
// tenants are only allowed to perform them if they have the appropriate | ||
// capability. For example, performing an AdminSplit. | ||
message TenantCapabilities { | ||
option (gogoproto.equal) = true; | ||
|
||
// CanAdminSplit, if set to true, grants grants the tenant the ability to | ||
// successfully perform `AdminSplit` requests. | ||
bool can_admin_split = 1; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.