-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Extract hardcoded entitlements creation to a separate class #127698
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
Extract hardcoded entitlements creation to a separate class #127698
Conversation
Pinging @elastic/es-core-infra (Team:Core/Infra) |
|
||
class HardcodedEntitlements { | ||
|
||
private static List<Scope> createServerEntitlements(Path pidFile) { |
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'll need to support multiple pid files for multiple nodes, I think. Perhaps pid file should be another BaseDir
enum value. That would have a nice simplifying effect on the code below, actually, because serverModuleFileDatas
would no longer need to be a mutable list.
Q: Why do we need read/write permission on the pid file? It's created in phase 2 before entitlements are initialized.
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.
++ for the Q: do we need this, especially for tests? I am assuming this will always be null for unit tests.
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.
For context, we discussed both
Why do we need read/write permission on the pid file? It's created in phase 2 before entitlements are initialized.\
Ideally, we probably want to handle both creation and deletion of the PID file to happen in the CLI; that is additional work that we might want to do, but it will be separate
do we need this, especially for tests? I am assuming this will always be null for unit tests.
(where "this" is "support multiple pid files for multiple nodes") the answer is no; in unit and integ tests we still have one runner/one JVM, and we don't need the PID file permission anyway as there is no PID file; still, we can handle it more elegantly that this (testing for null) and simplify things as @prdoyle pointed out; I think it would be a great follow up, but for now I'm merging this as-is as it serves the purpose, and we can make it better in another PR.
…t-hardcoded-entitlements
💔 Backport failed
You can use sqren/backport to manually backport by running |
…127698) Moving creation of hardcoded entitlements (server policy + APM agent) to a separate class
* Extract hardcoded entitlements creation to a separate class (#127698) Moving creation of hardcoded entitlements (server policy + APM agent) to a separate class * Move FilesEntitlements validation to a separate class (#127703) Moves FilesEntitlements validation to a separate class. This is the final PR to make EntitlementsInitialization a simpler "orchestrator" of the various steps in the initialization phase.
Moving creation of hardcoded entitlements (server policy + APM agent) to a separate class