-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tenantcapabilities: introduce TenantCapabilities proto #94644
Conversation
2b1f53e
to
2ad1571
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR gives us a protobuf but it does not give us an API to test the capability. What would the API look like?
Reviewed 7 of 7 files at r1, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @ecwall)
It's hard to have an opinion about this change given that it's not exercised anywhere. What we are able to judge appears to be fairly uncontroversial, too. Perhaps this commit would be better reviewed as part of a more substantial changeset? |
As an aside, why are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR gives us a protobuf but it does not give us an API to test the capability. What would the API look like?
Here's a rough sketch for what I had in mind. It tries to keep all capability logic inside the tenantcapabilities
package, by expecting callers to pass in requests, instead of pulling the concept above in auth_tenant.go
. I'm happy to explore other alternatives as well.
// CapabilitiesWatcher presents a consistent snapshot of tenant capabilities
// that is incrementally (and transparently) maintained by watching for changes
// to the global tenant capability state.
type CapabilitiesWatcher interface {
// HasCapabilityForBatch returns whether a tenant, referenced by its ID, is
// allowed to execute the supplied batch request given the capabilities it
// possesses.
HasCapabilityForBatch(roachpb.TenantID, *roachpb.BatchRequest) bool
}
Perhaps this commit would be better reviewed as part of a more substantial changeset?
I agree. However, there's a bit of parallelization to be had here with the work @ecwall is doing. He's going to be working on the set/alter path for tenant capabilities, which will make use of these protos.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @ecwall)
TenantInfo contains more than just capabilities, so I'm not sure if |
2ad1571
to
3bd5bd2
Compare
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 cockroachdb#94643 Epic: CRDB-18503 Release note: None
3bd5bd2
to
e5a7093
Compare
TFTR! bors r=ecwall |
Build succeeded: |
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 containcapabilities. 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 -- thiswill likely expand to a fuller set as we introduce other capabilities
in the system.
References #94643
Epic: CRDB-18503
Release note: None