mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Fleet] Add {package}@custom component template support (#213431)
Closes [212086](https://github.com/elastic/kibana/issues/212086) ## Summary Adds support for `{package}@custom` on component templates in Fleet installed integrations. Similar to [PR 192731](https://github.com/elastic/kibana/pull/192731).  ### Acceptance Criteria - [x] All index templates for data streams associated with an integration installed through Fleet include a reference to {package}@custom in their composed_of array. - _Example: All index templates for the nginx integration's data streams should include nginx@custom._ - [x] {package}@custom appears after {type}@custom in the composed_of array. - _Example: system@custom should be listed after logs@custom._ - [x] {package}@custom is included in the ignore_missing_component_templates array since it is optional. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks N/A --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
0b77522dc1
commit
9d99f821ff
10 changed files with 45 additions and 6 deletions
|
@ -474,6 +474,15 @@ export function buildComponentTemplates(params: {
|
|||
_meta,
|
||||
};
|
||||
}
|
||||
if (packageName) {
|
||||
const customTemplateName = `${packageName}${USER_SETTINGS_TEMPLATE_SUFFIX}`;
|
||||
templatesMap[customTemplateName] = {
|
||||
template: {
|
||||
settings: {},
|
||||
},
|
||||
_meta,
|
||||
};
|
||||
}
|
||||
|
||||
// return empty/stub template
|
||||
templatesMap[userSettingsTemplateName] = {
|
||||
|
|
|
@ -387,12 +387,16 @@ _meta:
|
|||
_meta: meta,
|
||||
composed_of: [
|
||||
'logs-endpoint.metadata_current-template@package',
|
||||
'endpoint@custom',
|
||||
'logs-endpoint.metadata_current-template@custom',
|
||||
],
|
||||
index_patterns: ['.metrics-endpoint.metadata_united_default'],
|
||||
priority: 250,
|
||||
template: { mappings: undefined, settings: undefined },
|
||||
ignore_missing_component_templates: ['logs-endpoint.metadata_current-template@custom'],
|
||||
ignore_missing_component_templates: [
|
||||
'endpoint@custom',
|
||||
'logs-endpoint.metadata_current-template@custom',
|
||||
],
|
||||
},
|
||||
name: 'logs-endpoint.metadata_current-template',
|
||||
},
|
||||
|
@ -673,12 +677,16 @@ _meta:
|
|||
_meta: meta,
|
||||
composed_of: [
|
||||
'logs-endpoint.metadata_current-template@package',
|
||||
'endpoint@custom',
|
||||
'logs-endpoint.metadata_current-template@custom',
|
||||
],
|
||||
index_patterns: ['.metrics-endpoint.metadata_united_default'],
|
||||
priority: 250,
|
||||
template: { mappings: undefined, settings: undefined },
|
||||
ignore_missing_component_templates: ['logs-endpoint.metadata_current-template@custom'],
|
||||
ignore_missing_component_templates: [
|
||||
'endpoint@custom',
|
||||
'logs-endpoint.metadata_current-template@custom',
|
||||
],
|
||||
},
|
||||
name: 'logs-endpoint.metadata_current-template',
|
||||
},
|
||||
|
@ -936,12 +944,16 @@ _meta:
|
|||
_meta: meta,
|
||||
composed_of: [
|
||||
'logs-endpoint.metadata_current-template@package',
|
||||
'endpoint@custom',
|
||||
'logs-endpoint.metadata_current-template@custom',
|
||||
],
|
||||
index_patterns: ['.metrics-endpoint.metadata_united_default'],
|
||||
priority: 250,
|
||||
template: { mappings: undefined, settings: undefined },
|
||||
ignore_missing_component_templates: ['logs-endpoint.metadata_current-template@custom'],
|
||||
ignore_missing_component_templates: [
|
||||
'endpoint@custom',
|
||||
'logs-endpoint.metadata_current-template@custom',
|
||||
],
|
||||
},
|
||||
name: 'logs-endpoint.metadata_current-template',
|
||||
},
|
||||
|
|
|
@ -68,6 +68,12 @@ Array [
|
|||
"id": "logs@custom",
|
||||
"type": "component_template",
|
||||
},
|
||||
Object {
|
||||
"appLink": "/app/management/data/index_management/component_templates/all_assets@custom",
|
||||
"attributes": Object {},
|
||||
"id": "all_assets@custom",
|
||||
"type": "component_template",
|
||||
},
|
||||
Object {
|
||||
"appLink": "/app/management/data/index_management/component_templates/logs-all_assets.test_logs@custom",
|
||||
"attributes": Object {},
|
||||
|
|
|
@ -97,7 +97,7 @@ export default function (providerContext: FtrProviderContext) {
|
|||
|
||||
it('should install a tar archive correctly', async function () {
|
||||
const res = await uploadPackage();
|
||||
expect(res.body.items.length).to.be(32);
|
||||
expect(res.body.items.length).to.be(33);
|
||||
});
|
||||
|
||||
it('should upgrade when uploading a newer zip archive', async () => {
|
||||
|
@ -111,7 +111,7 @@ export default function (providerContext: FtrProviderContext) {
|
|||
.type('application/zip')
|
||||
.send(buf)
|
||||
.expect(200);
|
||||
expect(res.body.items.length).to.be(32);
|
||||
expect(res.body.items.length).to.be(33);
|
||||
expect(res.body.items.some((item: any) => item.id.includes(testPkgNewVersion)));
|
||||
|
||||
await deletePackage(testPkgName, testPkgNewVersion);
|
||||
|
@ -182,7 +182,7 @@ export default function (providerContext: FtrProviderContext) {
|
|||
.type('application/zip')
|
||||
.send(buf)
|
||||
.expect(200);
|
||||
expect(res.body.items.length).to.be(32);
|
||||
expect(res.body.items.length).to.be(33);
|
||||
});
|
||||
|
||||
it('should throw an error if the archive is zip but content type is gzip', async function () {
|
||||
|
|
|
@ -62,6 +62,7 @@ export default function (providerContext: FtrProviderContext) {
|
|||
`logs@settings`,
|
||||
`${templateName}@package`,
|
||||
'logs@custom',
|
||||
`overrides@custom`,
|
||||
`${templateName}@custom`,
|
||||
`ecs@mappings`,
|
||||
'.fleet_globals-1',
|
||||
|
|
|
@ -604,6 +604,10 @@ const expectAssetsInstalled = ({
|
|||
id: 'logs@custom',
|
||||
type: 'component_template',
|
||||
},
|
||||
{
|
||||
id: 'all_assets@custom',
|
||||
type: 'component_template',
|
||||
},
|
||||
{
|
||||
id: 'logs-all_assets.test_logs@custom',
|
||||
type: 'component_template',
|
||||
|
|
|
@ -429,6 +429,10 @@ export default function (providerContext: FtrProviderContext) {
|
|||
id: 'logs@custom',
|
||||
type: 'component_template',
|
||||
},
|
||||
{
|
||||
id: 'all_assets@custom',
|
||||
type: 'component_template',
|
||||
},
|
||||
{
|
||||
id: 'logs-all_assets.test_logs@custom',
|
||||
type: 'component_template',
|
||||
|
|
|
@ -204,6 +204,7 @@ export default function (providerContext: FtrProviderContext) {
|
|||
{ id: 'logs-dataset1@package', type: 'component_template' },
|
||||
{ id: 'logs-dataset1@custom', type: 'component_template' },
|
||||
{ id: 'logs@custom', type: 'component_template' },
|
||||
{ id: 'input_package_upgrade@custom', type: 'component_template' },
|
||||
]);
|
||||
|
||||
// now check the package component template was created correctly
|
||||
|
|
|
@ -993,6 +993,7 @@ export default function (providerContext: FtrProviderContext) {
|
|||
{ id: 'logs-somedataset@package', type: 'component_template' },
|
||||
{ id: 'logs-somedataset@custom', type: 'component_template' },
|
||||
{ id: 'logs@custom', type: 'component_template' },
|
||||
{ id: 'integration_to_input@custom', type: 'component_template' },
|
||||
]);
|
||||
|
||||
const dataset3PkgComponentTemplate = await getComponentTemplate('logs-somedataset@package');
|
||||
|
|
|
@ -1315,6 +1315,7 @@ export default function (providerContext: FtrProviderContext) {
|
|||
}
|
||||
|
||||
expectedAssets.push({ id: 'logs@custom', type: 'component_template' });
|
||||
expectedAssets.push({ id: 'integration_to_input@custom', type: 'component_template' });
|
||||
});
|
||||
|
||||
afterEach(async function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue