-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
mt_start_sql: enable enterprise features for multitenant sql servers #69115
mt_start_sql: enable enterprise features for multitenant sql servers #69115
Conversation
More context is available on slack: https://cockroachlabs.slack.com/archives/C01CDD4HRC5/p1628542467012900 |
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @knz)
ab84ebc
to
7850559
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.
Reviewed 3 of 4 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @jeffswenson)
pkg/ccl/utilccl/license_check.go, line 118 at r2 (raw file):
base.LicenseType = getLicenseType base.TimeToEnterpriseLicenseExpiry = TimeToEnterpriseLicenseExpiry server.EnableEnterpriseForTenant = EnableEnterpriseWithImpliedLicense
This does not sound right.
With this change, any person who downloads the source code from github, builds their own CCL binary and starts a crdb cluster with a tenant pod can use enterprise features without a license, and claim they are legally entitled to do so because the product did not prompt for anything.
IMHO this mode of operation should be opt-in; for example using a serverless-specific license key that we would set using an env var in the k8s pods in the CC infra.
@knz, who owns these licensing decisions? We're willing to do whatever should be done, but who decides what should be done? Are there any written guidelines/criteria for these decisions and/or any process that should happen to make them? By blocking this PR, you're implicitly putting yourself in that role, so you need to specify what we need to do in order to unblock this PR and move forward. |
That's a product decision, from someone close to our licensing goals. I'm not sure who exactly is currently closest to licensing, but Nate would know. That being said the engineering viewpoint (from my perspective) is to follow established semantics, where a valid license key should be supplied externally to the process to enable licensed features. It ensures that the decision to enable remains in the hands of the operator for the particular deployment of crdb, and does not automatically extend to all users who happen to have a similar execution script. |
@piyush-singh owns this from the Product side but he is out, so @mwang1026 is filling in for the next month till Piyush is back. |
Can we check the license in these situations:
If we did this, then there'd be no need to recheck the license repeatedly in the SQL tenant processes. |
@knz are you okay with this change if the KV layer checks for the enterprise license on tenant creation and connection? Or do think there should be an explicit setting to enable enterprise features at the tenant level? |
At a basic level we're evolving crdb to offer multi-tenant servers for all deployments, so we'll want the ability to run mon-enterprise tenants. My intuition is that this can be done using the logic you have implemented here but extend it with an env var that accepts a license and validates it upon process initialization (eg in an init function) and turns it into a boolean fed into the code you wrote already. Any obstacles to this? |
My 2c: MT is right now for CockroachCloud only. If in the future we want to evolve the licensing story to allow non-enterprise MT deployments we can solve that problem then. For now, I think (in Piyush's absence) it's fine to be more strict about those checks since the goal right now is to unblock CC Serverless users' access to enterprise features. I'll leave it to eng to figure out best implementation re: not locking us in against future rolling back of said license check. Based on ^ I think it's reasonable to check for license upon startup of a tenant. |
The big downside in my mind for creating an environment level setting for the tenant license is: an environment variable is a more complex solution for the case where we want all tenants to have enterprise features enabled. Both in the sense there is more code in the database and it is another setting the CC control plane needs to get right. Even if we did want to support core and enterprise multi-tenant clusters, I still think the environment setting is suboptimal. Enabling enterprise support would require setting the license on the host cluster and setting an environment variable on each of the tenant servers. I think it would be better for the tenants to read the license configured at the host layer. That way updating or adding a license to a cluster only requires a single configuration change. I think we should do the following:
|
ok let us know when you have implemented step 1 as part of this PR |
7850559
to
e596d27
Compare
I've changed course to align with knz@'s original suggestion. I added the COCKROACH_TENANT_LICENSE environment variable and check for its presence. I think we should replace the environment variable as soon as there is support in the tenant for reading settings from the host cluster. |
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.
nice 💯
LGTM modulo a nit
I think we should replace the environment variable as soon as there is support in the tenant for reading settings from the host cluster.
Agreed
Reviewed 6 of 6 files at r3, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @jeffswenson)
pkg/util/envutil/env.go, line 367 at r3 (raw file):
// TestSetEnv sets an environment variable and the cleanup function // resets it to the original value. func TestSetEnv(name string, value string) func() {
if this is meant only for use in tests, you can accept a testutils.TB
as argument here and use t.Fatal
instead of panic
below to get cleaner test errors.
310bc9f
to
ff2e77a
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @knz)
pkg/util/envutil/env.go, line 367 at r3 (raw file):
Previously, knz (kena) wrote…
if this is meant only for use in tests, you can accept a
testutils.TB
as argument here and uset.Fatal
instead ofpanic
below to get cleaner test errors.
Done.
ff2e77a
to
677c0b4
Compare
Enterprise features are controlled by the enterprise.license setting. Currently this setting applies only to the host tenant cluster. This change allows tenants to read the license from an environment variable. This should be replaced once it is possible to read the license directly from the host cluster. Release note: None
677c0b4
to
b42a9b3
Compare
bors r+ |
Build succeeded: |
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale)
pkg/util/envutil/env.go, line 367 at r3 (raw file):
Previously, JeffSwenson (Jeff Swenson) wrote…
Done.
@knz wait, really? we used to have a pretty strict rule about not importing "testing" in non _test.go files... did that change?
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale)
pkg/util/envutil/env.go, line 367 at r3 (raw file):
Previously, dt (David Taylor) wrote…
@knz wait, really? we used to have a pretty strict rule about not importing "testing" in non _test.go files... did that change?
I said testutils.TB
. Jeff just made a mistake and I didn't notice during the review. Let's patch this.
73821: tracing: tenant redaction test uses tracing knobs r=dhartunian a=dhartunian Previously, the tenant redaction test manually read back the results of traces in SQL. Since we have a testing knob for this purpose it makes sense to use it here and collect the traces in a more straightforward way. This test now also uses the `trace.redactability.enabled` cluster setting instead of setting the redactability flag on the tracer to test that the cluster setting is correctly connected. Release note: None 73905: envutil: avoid importing `testing` in non-test code r=dt,JeffSwenson a=knz Thanks to @dt for [noticing](#69115 (review)). Release note: None 73922: ui: say "reset" SQL stats instead of "clear" r=matthewtodd a=matthewtodd Fixes #73444 Release note (ui change): The "clear SQL stats" links on the statement and transaction pages were relabeled "reset SQL stats," for consistency with the language in the SQL shell. Co-authored-by: David Hartunian <[email protected]> Co-authored-by: Raphael 'kena' Poss <[email protected]> Co-authored-by: Matthew Todd <[email protected]>
Enterprise features are controlled by the enterprise.license setting.
Currently this setting applies only to the host tenant cluster. This
change enables enterprise features for all tenant clusters. Enabling
enterprise features for all tenants is reasonable, because multi
tenant deployments are an enterprise feature.
Release note: None