-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Fleet] Support space_id
in preconfiguration
#183920
[Fleet] Support space_id
in preconfiguration
#183920
Conversation
/ci |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
@@ -24,6 +24,7 @@ export type InputsOverride = Partial<NewPackagePolicyInput> & { | |||
|
|||
export interface PreconfiguredAgentPolicy extends Omit<NewAgentPolicy, 'namespace' | 'id'> { | |||
id: string | number; | |||
kibana_namespace?: string; |
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.
namespace
is already used, curious if someone has better naming idea for that one
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.
namespace
is generally used more "internally" in Kibana code whereas space
is used more in the public-facing docs, UI, etc. Maybe kibana_space_id
would make sense here?
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.
namespace
is generally used more "internally" in Kibana code whereasspace
is used more in the public-facing docs, UI, etc. Maybekibana_space_id
would make sense here?
++ either kibana_space_id
or space_id
would be preferred. @kpollich is right that namespace
is the internal name (for fun historical reasons) that we try not to leak.
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 will update to space_id
as it seems more used in other plugins
/ci |
099e742
to
d9aca86
Compare
Pinging @elastic/fleet (Team:Fleet) |
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsTest FailuresMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @nchaulet |
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.
@@ -1124,6 +1125,69 @@ describe('policy preconfiguration', () => { | |||
expect(policies[0].id).toBe('test-id'); | |||
expect(nonFatalErrorsB.length).toBe(0); | |||
}); | |||
|
|||
it('should used a namespaced saved objet client if the agent policy space_id is set', async () => { |
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('should used a namespaced saved objet client if the agent policy space_id is set', async () => { | |
it('should used a namespaced saved object client if the agent policy space_id is set', async () => { |
}), | ||
expect.anything() // options | ||
); | ||
}); |
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 would be nice to add another test for changing the space_id
for the same policy id
when I tested manually, it just created another policy in the second space, rather than "moving" the original policy, because space_id
becomes part of the saved object ID. I think this is ok but want to make sure
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.
@jen-huang Could I ask you how you get the error? just to check if I did not introduced a new bug |
This is when I have a policy using |
I also see the error if you start up KB locally with the config listed in the description, if the space 'test' is not created and the user navigates to fleet |
Thanks I am able to reproduce it, it seems to be related to the deploy policy code, I will create a follow up PR for that specific issue |
space_id
in preconfiguration
Summary
Resolve #182817
As discussed change the SO type for package to be agnostic #172963
That PR allow to configure space aware preconfigured agent policies. By default preconfigured agent policy are created in the default namespace, by using the
space_id
property you could create a policy in a different space.Example
You need to enable the space experimental feature to test this:
Automated tests
I added unit test to the preconfiguration service