-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
add LicenseState() to SystemView interface #27930
base: main
Are you sure you want to change the base?
Conversation
CI Results: |
Build Results: |
sdk/plugin/grpc_system.go
Outdated
@@ -226,6 +226,18 @@ func (s *gRPCSystemViewClient) GenerateIdentityToken(ctx context.Context, req *p | |||
}, nil | |||
} | |||
|
|||
func (s *gRPCSystemViewClient) HasLicense() (bool, error) { | |||
reply, err := s.client.HasLicense(context.Background(), &pb.Empty{}) |
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.
Is it possible for the caller to pass the context instead of using context.Background() here?
vault/dynamic_system_view.go
Outdated
@@ -479,3 +479,12 @@ func (d dynamicSystemView) GenerateIdentityToken(ctx context.Context, req *plugi | |||
TTL: ttl, | |||
}, nil | |||
} | |||
|
|||
func (d dynamicSystemView) HasLicense() (bool, error) { | |||
licenseState, err := d.core.EntGetLicenseState() |
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.
On the one hand, I like this approach because it is simple. It does not require us to update https://github.com/hashicorp/vault-licensing and other places in Vault core's code to add a new ent plugin.
On the other hand, it sidesteps the current paradigm of explicitly allowlisting each feature/plugin. So I am not sure about this. I am having trouble coming up with any downsides to your current approach other than we don't have fine-grained control. Maybe we should get more feedback from our team?
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.
it sidesteps the current paradigm of explicitly allowlisting each feature/plugin
I agree. Along this line, I wonder, if any point we have different types/tiers of licensing, HasLicense()
will need to be changed. This makes me think HasFeature()
of SystemView
interface, currently left unimplemented, could solve the fine-grained control in both situations.
2d28084
to
be0d397
Compare
Description
Currently, enterprise plugins can be only run as builtin plugins. To allow enterprise plugins to run as external plugins, we need a way to validate Vault license. This PR adds
LicenseState()
to SystemView so that external plugins can request license state over gRPC, following a similar work done in #24929.The new method can replace the current approach of using
addLicenseCallback()
to assign the plugin'sBackend.LicenseState()
. Whether the plugin is run as a builtin plugin or an external plugin, the plugin backend can useSystem().LicenseState()
. If the plugin is no longer an enterprise plugin, we can simply remove the license check on the plugin repo.Test output shows Vault with new plugin sdk works with older plugins with previous plugin sdk
TODO only if you're a HashiCorp employee
getting backported to N-2, use the new style
backport/ent/x.x.x+ent
labelsinstead of the old style
backport/x.x.x
labels.the normal
backport/x.x.x
label (there should be only 1).of a public function, even if that change is in a CE file, double check that
applying the patch for this PR to the ENT repo and running tests doesn't
break any tests. Sometimes ENT only tests rely on public functions in CE
files.
in the PR description, commit message, or branch name.
description. Also, make sure the changelog is in this PR, not in your ENT PR.