-
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
Port activation flags with dynamic registration #29237
Conversation
CI Results: |
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.
@biazmoreira this is looking great!
I think most comments inline are around parts of the test code that seem like they should ideally remain in Ent-only code.
I'm not sure if you already discussed these and there's a reason they need to be CE for now. Some of them seem from this PR like they'd fail because only the test code is here and not the actual implementation which I guess is ent-only.
I could be missing something though from previous ent review so let me know!
Build Results: |
48485ad
to
115f7fe
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.
LGTM! Good to go. if you want to take the optional simpler syntax suggestion I can re-approve!
dd4ad0a
to
114c46b
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.
re-approve. The delta is just my suggestion. There are some build things going on but don't seem related. If those can be figured out I think this is good!
91e29e8
to
7c6b409
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.
Approving with my super late nits from before the break. Feel free to disregard unless they spark some new thinking.
return writeActivationFlag(ctx, b, req, data, true) | ||
} | ||
|
||
func (b *SystemBackend) readActivationFlag(ctx context.Context, req *logical.Request, _ *framework.FieldData) (*logical.Response, error) { |
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.
We can probably just drop the FieldData arg here, right (same with the other handler internals)?
return b.activationFlagsToResponse(activationFlags), nil | ||
} | ||
|
||
func (b *SystemBackend) writeActivationFlagWrite(ctx context.Context, req *logical.Request, _ *framework.FieldData, isActivate bool) (*logical.Response, error) { |
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.
Not a big deal, but we've got two "writes" in this method name. Maybe writeActivationFlag
to keep it consistent with the readActivationFlag
?
if storage == nil { | ||
return fmt.Errorf("unable to access storage") | ||
} |
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.
🤔 I wonder if we need to be so defensive... Wouldn't this mean that the systemBarrier is nil? Presumably we would have already bailed long before this point if so.
Same argument for the rest of the f.storage
nil checks. I think it's safe to assume they're all non-nil at this point, unless you have a specific flow in mind that would break this assumption.
changelog/29237.txt
Outdated
@@ -0,0 +1,3 @@ | |||
```release-note:feature | |||
**Activation Flag (core)**: A simple, one-time flag that lets users turn on specific Vault functionalities when they need them. |
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 already existed in previous versions right (just Enterprise only)? Was there no changelog entry at the time? It might be confusing for folks in the future if they see this in 1.19 but then see that older versions documented the API and had instructions for using with secret sync? We do have public docs for the endpoint already for example.
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.
There's no Changelog for that... I can mention this was an enterprise only feature and now it's being ported to CE. Would that sound better?
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.
Yeah, I'd also maybe not put it in as a "feature" as it's more of a mechanism for enabling actual features. (it's not use to users unless we wire it to something they care about). Maybe enhancement
is better?
Maybe we could hint at the history without details like:
release-note:enhancement
Activation Flags (core): A mechanism for users to opt-in to new functionality at a convenient time. Previously used only in Enterprise for SecretSync, activation flags are now available in CE for future features to use.
Or something?
d3af049
to
5539863
Compare
Description
This PR adds activation flag logic, paths, and tests.
Activation flags are a one-off type of flags used to activate certain features in Vault.
Features cannot be deactivate and new paths cannot be registered by users.
TODO only if you're a HashiCorp employee
backport/
label that matches the desired release branch. Note that in the CE repo, the latest release branch will look likebackport/x.x.x
, but older release branches will bebackport/ent/x.x.x+ent
.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.