Skip to content

Commit 6d8f74a

Browse files
[Ingest Manager] Match package spec dataset->data_stream and config_templates->policy_templates renaming (#78699)
* Match elastic/package-spec#24 `datasets`->`data_streams` property renaming * Match elastic/package-spec#24 `datasets.name`->`data_streams.dataset` property renaming * Match elastic/package-spec#24 `/dataset`->`/data_stream` directory renaming * Match elastic/package-spec#50 `config_templates`->`policy_templates` property renaming * Update API integration test fixtures (test packages) * Temporarily skip API integration tests * Temporarily skip more API integration tests * Pin to custom docker image, unskip test suites, clean up broken icon paths in test package manifests * Skip the only (yay!) failing test suite * Revert "Skip the only (yay!) failing test suite" This reverts commit 3db32e2. * Re-skip tests and revert docker image Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 085f8a1 commit 6d8f74a

File tree

84 files changed

+254
-268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+254
-268
lines changed

x-pack/plugins/ingest_manager/common/openapi/spec_oas3.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@
15431543
}
15441544
},
15451545
"format_version": "1.0.0",
1546-
"datasets": [
1546+
"data_streams": [
15471547
{
15481548
"title": "CoreDNS logs",
15491549
"name": "log",
@@ -1764,7 +1764,7 @@
17641764
]
17651765
}
17661766
},
1767-
"datasets": [
1767+
"data_streams": [
17681768
{
17691769
"id": "endpoint",
17701770
"title": "Endpoint Events",
@@ -3961,7 +3961,7 @@
39613961
"format_version": {
39623962
"type": "string"
39633963
},
3964-
"datasets": {
3964+
"data_streams": {
39653965
"type": "array",
39663966
"items": {
39673967
"type": "object",

x-pack/plugins/ingest_manager/common/services/limited_package.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { PackageInfo, AgentPolicy, PackagePolicy } from '../types';
77

88
// Assume packages only ever include 1 config template for now
99
export const isPackageLimited = (packageInfo: PackageInfo): boolean => {
10-
return packageInfo.config_templates?.[0]?.multiple === false;
10+
return packageInfo.policy_templates?.[0]?.multiple === false;
1111
};
1212

1313
export const doesAgentPolicyAlreadyIncludePackage = (

x-pack/plugins/ingest_manager/common/services/package_to_package_policy.test.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
3434
describe('packageToPackagePolicyInputs', () => {
3535
it('returns empty array for packages with no config templates', () => {
3636
expect(packageToPackagePolicyInputs(mockPackage)).toEqual([]);
37-
expect(packageToPackagePolicyInputs({ ...mockPackage, config_templates: [] })).toEqual([]);
37+
expect(packageToPackagePolicyInputs({ ...mockPackage, policy_templates: [] })).toEqual([]);
3838
});
3939

4040
it('returns empty array for packages with a config template but no inputs', () => {
4141
expect(
4242
packageToPackagePolicyInputs(({
4343
...mockPackage,
44-
config_templates: [{ inputs: [] }],
44+
policy_templates: [{ inputs: [] }],
4545
} as unknown) as PackageInfo)
4646
).toEqual([]);
4747
});
@@ -50,13 +50,13 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
5050
expect(
5151
packageToPackagePolicyInputs(({
5252
...mockPackage,
53-
config_templates: [{ inputs: [{ type: 'foo' }] }],
53+
policy_templates: [{ inputs: [{ type: 'foo' }] }],
5454
} as unknown) as PackageInfo)
5555
).toEqual([{ type: 'foo', enabled: true, streams: [] }]);
5656
expect(
5757
packageToPackagePolicyInputs(({
5858
...mockPackage,
59-
config_templates: [{ inputs: [{ type: 'foo' }, { type: 'bar' }] }],
59+
policy_templates: [{ inputs: [{ type: 'foo' }, { type: 'bar' }] }],
6060
} as unknown) as PackageInfo)
6161
).toEqual([
6262
{ type: 'foo', enabled: true, streams: [] },
@@ -68,12 +68,12 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
6868
expect(
6969
packageToPackagePolicyInputs(({
7070
...mockPackage,
71-
datasets: [
72-
{ type: 'logs', name: 'foo', streams: [{ input: 'foo' }] },
73-
{ type: 'logs', name: 'bar', streams: [{ input: 'bar' }] },
74-
{ type: 'logs', name: 'bar2', streams: [{ input: 'bar' }] },
71+
data_streams: [
72+
{ type: 'logs', dataset: 'foo', streams: [{ input: 'foo' }] },
73+
{ type: 'logs', dataset: 'bar', streams: [{ input: 'bar' }] },
74+
{ type: 'logs', dataset: 'bar2', streams: [{ input: 'bar' }] },
7575
],
76-
config_templates: [
76+
policy_templates: [
7777
{
7878
inputs: [{ type: 'foo' }, { type: 'bar' }],
7979
},
@@ -102,15 +102,15 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
102102
expect(
103103
packageToPackagePolicyInputs(({
104104
...mockPackage,
105-
datasets: [
105+
data_streams: [
106106
{
107107
type: 'logs',
108-
name: 'foo',
108+
dataset: 'foo',
109109
streams: [{ input: 'foo', vars: [{ default: 'foo-var-value', name: 'var-name' }] }],
110110
},
111111
{
112112
type: 'logs',
113-
name: 'bar',
113+
dataset: 'bar',
114114
streams: [
115115
{
116116
input: 'bar',
@@ -120,7 +120,7 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
120120
},
121121
{
122122
type: 'logs',
123-
name: 'bar2',
123+
dataset: 'bar2',
124124
streams: [
125125
{
126126
input: 'bar',
@@ -129,7 +129,7 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
129129
],
130130
},
131131
],
132-
config_templates: [
132+
policy_templates: [
133133
{
134134
inputs: [{ type: 'foo' }, { type: 'bar' }],
135135
},
@@ -173,15 +173,15 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
173173
expect(
174174
packageToPackagePolicyInputs(({
175175
...mockPackage,
176-
datasets: [
176+
data_streams: [
177177
{
178178
type: 'logs',
179-
name: 'foo',
179+
dataset: 'foo',
180180
streams: [{ input: 'foo', vars: [{ default: 'foo-var-value', name: 'var-name' }] }],
181181
},
182182
{
183183
type: 'logs',
184-
name: 'bar',
184+
dataset: 'bar',
185185
streams: [
186186
{
187187
input: 'bar',
@@ -191,7 +191,7 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
191191
},
192192
{
193193
type: 'logs',
194-
name: 'bar2',
194+
dataset: 'bar2',
195195
streams: [
196196
{
197197
input: 'bar',
@@ -201,7 +201,7 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
201201
},
202202
{
203203
type: 'logs',
204-
name: 'disabled',
204+
dataset: 'disabled',
205205
streams: [
206206
{
207207
input: 'with-disabled-streams',
@@ -212,7 +212,7 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
212212
},
213213
{
214214
type: 'logs',
215-
name: 'disabled2',
215+
dataset: 'disabled2',
216216
streams: [
217217
{
218218
input: 'with-disabled-streams',
@@ -221,7 +221,7 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
221221
],
222222
},
223223
],
224-
config_templates: [
224+
policy_templates: [
225225
{
226226
inputs: [
227227
{
@@ -372,13 +372,13 @@ describe('Ingest Manager - packageToPackagePolicy', () => {
372372
});
373373
});
374374
it('returns package policy with inputs', () => {
375-
const mockPackageWithConfigTemplates = ({
375+
const mockPackageWithPolicyTemplates = ({
376376
...mockPackage,
377-
config_templates: [{ inputs: [{ type: 'foo' }] }],
377+
policy_templates: [{ inputs: [{ type: 'foo' }] }],
378378
} as unknown) as PackageInfo;
379379

380380
expect(
381-
packageToPackagePolicy(mockPackageWithConfigTemplates, '1', '2', 'default', 'pkgPolicy-1')
381+
packageToPackagePolicy(mockPackageWithPolicyTemplates, '1', '2', 'default', 'pkgPolicy-1')
382382
).toEqual({
383383
policy_id: '1',
384384
namespace: 'default',

x-pack/plugins/ingest_manager/common/services/package_to_package_policy.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
import {
77
PackageInfo,
8-
RegistryConfigTemplate,
8+
RegistryPolicyTemplate,
99
RegistryVarsEntry,
1010
RegistryStream,
1111
PackagePolicy,
@@ -22,14 +22,14 @@ const getStreamsForInputType = (
2222
): Array<RegistryStream & { data_stream: { type: string; dataset: string } }> => {
2323
const streams: Array<RegistryStream & { data_stream: { type: string; dataset: string } }> = [];
2424

25-
(packageInfo.datasets || []).forEach((dataset) => {
26-
(dataset.streams || []).forEach((stream) => {
25+
(packageInfo.data_streams || []).forEach((dataStream) => {
26+
(dataStream.streams || []).forEach((stream) => {
2727
if (stream.input === inputType) {
2828
streams.push({
2929
...stream,
3030
data_stream: {
31-
type: dataset.type,
32-
dataset: dataset.name,
31+
type: dataStream.type,
32+
dataset: dataStream.dataset,
3333
},
3434
});
3535
}
@@ -46,9 +46,9 @@ export const packageToPackagePolicyInputs = (packageInfo: PackageInfo): PackageP
4646
const inputs: PackagePolicy['inputs'] = [];
4747

4848
// Assume package will only ever ship one package policy template for now
49-
const packagePolicyTemplate: RegistryConfigTemplate | null =
50-
packageInfo.config_templates && packageInfo.config_templates[0]
51-
? packageInfo.config_templates[0]
49+
const packagePolicyTemplate: RegistryPolicyTemplate | null =
50+
packageInfo.policy_templates && packageInfo.policy_templates[0]
51+
? packageInfo.policy_templates[0]
5252
: null;
5353

5454
// Create package policy input property

x-pack/plugins/ingest_manager/common/types/models/epm.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export interface RegistryPackage {
6767
assets?: string[];
6868
internal?: boolean;
6969
format_version: string;
70-
datasets?: Dataset[];
71-
config_templates?: RegistryConfigTemplate[];
70+
data_streams?: RegistryDataStream[];
71+
policy_templates?: RegistryPolicyTemplate[];
7272
download: string;
7373
path: string;
7474
}
@@ -80,7 +80,7 @@ interface RegistryImage {
8080
size?: string;
8181
type?: string;
8282
}
83-
export interface RegistryConfigTemplate {
83+
export interface RegistryPolicyTemplate {
8484
name: string;
8585
title: string;
8686
description: string;
@@ -127,8 +127,8 @@ export type RegistrySearchResult = Pick<
127127
| 'internal'
128128
| 'download'
129129
| 'path'
130-
| 'datasets'
131-
| 'config_templates'
130+
| 'data_streams'
131+
| 'policy_templates'
132132
>;
133133

134134
export type ScreenshotItem = RegistryImage;
@@ -174,9 +174,9 @@ export type ElasticsearchAssetTypeToParts = Record<
174174
ElasticsearchAssetParts[]
175175
>;
176176

177-
export interface Dataset {
177+
export interface RegistryDataStream {
178178
type: string;
179-
name: string;
179+
dataset: string;
180180
title: string;
181181
release: string;
182182
streams?: RegistryStream[];

x-pack/plugins/ingest_manager/dev_docs/epm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ When a package is installed or upgraded, certain Kibana and Elasticsearch assets
2626
### Generation
2727

2828
- Index templates are generated from `YAML` files contained in the package.
29-
- There is one index template per dataset.
30-
- For the generation of an index template, all `yml` files contained in the package subdirectory `dataset/DATASET_NAME/fields/` are used.
29+
- There is one index template per data stream.
30+
- For the generation of an index template, all `yml` files contained in the package subdirectory `data_stream/DATASET_NAME/fields/` are used.

x-pack/plugins/ingest_manager/dev_docs/indexing_strategy.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,48 @@ Overall documentation of Ingest Management is now maintained in the `elastic/sta
66
Ingest Management enforces an indexing strategy to allow the system to automatically detect indices and run queries on it. In short the indexing strategy looks as following:
77

88
```
9-
{dataset.type}-{dataset.name}-{dataset.namespace}
9+
{data_stream.type}-{data_stream.dataset}-{data_stream.namespace}
1010
```
1111

12-
The `{dataset.type}` can be `logs` or `metrics`. The `{dataset.namespace}` is the part where the user can use free form. The only two requirement are that it has only characters allowed in an Elasticsearch index name and does NOT contain a `-`. The `dataset` is defined by the data that is indexed. The same requirements as for the namespace apply. It is expected that the fields for type, namespace and dataset are part of each event and are constant keywords. If there is a dataset or a namespace with a `-` inside, it is recommended to replace it either by a `.` or a `_`.
12+
The `{data_stream.type}` can be `logs` or `metrics`. The `{data_stream.namespace}` is the part where the user can use free form. The only two requirement are that it has only characters allowed in an Elasticsearch index name and does NOT contain a `-`. The `data_stream` is defined by the data that is indexed. The same requirements as for the namespace apply. It is expected that the fields for type, dataset, and namespace are part of each event and are constant keywords. If there is a dataset or a namespace with a `-` inside, it is recommended to replace it either by a `.` or a `_`.
1313

14-
Note: More `{dataset.type}`s might be added in the future like `traces`.
14+
Note: More `{data_stream.type}`s might be added in the future like `traces`.
1515

1616
This indexing strategy has a few advantages:
1717

18-
* Each index contains only the fields which are relevant for the dataset. This leads to more dense indices and better field completion.
19-
* ILM policies can be applied per namespace per dataset.
20-
* Rollups can be specified per namespace per dataset.
21-
* Having the namespace user configurable makes setting security permissions possible.
22-
* Having a global metrics and logs template, allows to create new indices on demand which still follow the convention. This is common in the case of k8s as an example.
23-
* Constant keywords allow to narrow down the indices we need to access for querying very efficiently. This is especially relevant in environments which a large number of indices or with indices on slower nodes.
18+
- Each index contains only the fields which are relevant for the datta stream. This leads to more dense indices and better field completion.
19+
- ILM policies can be applied per namespace per data stream.
20+
- Rollups can be specified per namespace per data stream.
21+
- Having the namespace user configurable makes setting security permissions possible.
22+
- Having a global metrics and logs template, allows to create new indices on demand which still follow the convention. This is common in the case of k8s as an example.
23+
- Constant keywords allow to narrow down the indices we need to access for querying very efficiently. This is especially relevant in environments which a large number of indices or with indices on slower nodes.
2424

2525
Overall it creates smaller indices in size, makes querying more efficient and allows users to define their own naming parts in namespace and still benefiting from all features that can be built on top of the indexing startegy.
2626

2727
## Ingest Pipeline
2828

29-
The ingest pipelines for a specific dataset will have the following naming scheme:
29+
The ingest pipelines for a specific data stream will have the following naming scheme:
3030

3131
```
32-
{dataset.type}-{dataset.name}-{package.version}
32+
{data_stream.type}-{data_stream.dataset}-{package.version}
3333
```
3434

35-
As an example, the ingest pipeline for the Nginx access logs is called `logs-nginx.access-3.4.1`. The same ingest pipeline is used for all namespaces. It is possible that a dataset has multiple ingest pipelines in which case a suffix is added to the name.
35+
As an example, the ingest pipeline for the Nginx access logs is called `logs-nginx.access-3.4.1`. The same ingest pipeline is used for all namespaces. It is possible that a data stream has multiple ingest pipelines in which case a suffix is added to the name.
3636

3737
The version is included in each pipeline to allow upgrades. The pipeline itself is listed in the index template and is automatically applied at ingest time.
3838

3939
## Templates & ILM Policies
4040

41-
To make the above strategy possible, alias templates are required. For each type there is a basic alias template with a default ILM policy. These default templates apply to all indices which follow the indexing strategy and do not have a more specific dataset alias template.
41+
To make the above strategy possible, alias templates are required. For each type there is a basic alias template with a default ILM policy. These default templates apply to all indices which follow the indexing strategy and do not have a more specific data stream alias template.
4242

4343
The `metrics` and `logs` alias template contain all the basic fields from ECS.
4444

4545
Each type template contains an ILM policy. Modifying this default ILM policy will affect all data covered by the default templates.
4646

47-
The templates for a dataset are called as following:
47+
The templates for a data stream are called as following:
4848

4949
```
50-
{dataset.type}-{dataset.name}
50+
{data_stream.type}-{data_stream.dataset}
5151
```
5252

5353
The pattern used inside the index template is `{type}-{dataset}-*` to match all namespaces.

0 commit comments

Comments
 (0)