-
Notifications
You must be signed in to change notification settings - Fork 8.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
[Cloud Posture] Initialize plugin on package creation and on start if installed #130649
Conversation
|
||
// If package is installed we want to make sure all needed assets are installed | ||
if (packageInfo) { | ||
this.initialize(core); |
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.
be aware, there's a use case that the package is installed without adding it to agent-policy.
That means packagePolicyPostCreate
event is not being called.
so there's a case that the assets would be installed only on next server start - which is fine
Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security Posture) |
public stop() {} | ||
|
||
initialize(core: CoreStart): Promise<unknown> { |
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.
The return value contains an unknown
type. Why is that?
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.
fixed
): Promise<PackagePolicy> => { | ||
if (packagePolicy.package?.name === CIS_KUBERNETES_PACKAGE_NAME) { | ||
await this.initialize(core); |
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.
nit:
I would consider consolidating all the post create functions into one method, so maybe initialize
should include onPackagePolicyPostCreateCallback
as well?
wdyt?
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.
the callback of onPackagePolicyPostCreateCallback
is not part of the initialize
of the plugin.
how do you see they relate?
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
Summary
In this PR we are installing needed assets (mainly indices and Transforms) only when adding the package.
Incase the plugin is already installed, initialization process takes place as well.
As it verifies prerequisite state for the cspm solution to work correctly
Checklist
Delete any items that are not applicable to this PR.
Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:
For maintainers