Skip to content
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] Add <type>@custom component template to integrations index te… #192731

Conversation

jillguyonnet
Copy link
Contributor

@jillguyonnet jillguyonnet commented Sep 12, 2024

Summary

Relates #190730

This PR adds a <type>@custom component template to integrations index template's composed_of array.

Testing

Integration install/update should be tested.

From my manual testing, Fleet seems to behave normally and the new component template is added to the composed_of array. For example, the output of GET /_index_template/logs-system.auth is:

{
  "index_templates": [
    {
      "name": "logs-system.auth",
      "index_template": {
        "index_patterns": [
          "logs-system.auth-*"
        ],
        "template": {
          "settings": {},
          "mappings": {
            "_meta": {
              "package": {
                "name": "system"
              },
              "managed_by": "fleet",
              "managed": true
            }
          }
        },
        "composed_of": [
          "logs@mappings",
          "logs@settings",
          "logs-system.auth@package",
          "logs@custom",
          "logs-system.auth@custom",
          "ecs@mappings",
          ".fleet_globals-1",
          ".fleet_agent_id_verification-1"
        ],
        "priority": 200,
        "_meta": {
          "package": {
            "name": "system"
          },
          "managed_by": "fleet",
          "managed": true
        },
        "data_stream": {
          "hidden": false,
          "allow_custom_routing": false,
          "failure_store": false
        },
        "ignore_missing_component_templates": [
          "logs@custom",
          "logs-system.auth@custom"
        ]
      }
    }
  ]
}

Screenshot

Screenshot 2024-09-19 at 16 44 57 Screenshot 2024-09-19 at 17 04 45

Checklist

@obltmachine
Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@jillguyonnet jillguyonnet self-assigned this Sep 16, 2024
@jillguyonnet jillguyonnet added Team:Fleet Team label for Observability Data Collection Fleet team release_note:enhancement labels Sep 16, 2024
@jillguyonnet jillguyonnet force-pushed the fleet/190730-add-custom-component-template-to-integration-index-template branch from 7f5819c to 441808f Compare September 18, 2024 14:37
@jillguyonnet jillguyonnet marked this pull request as ready for review September 18, 2024 14:38
@jillguyonnet jillguyonnet requested a review from a team as a code owner September 18, 2024 14:38
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@nchaulet nchaulet self-requested a review September 18, 2024 14:54
Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and work as expected, LGTM 🚀

@@ -48,6 +48,7 @@ export const GLOBAL_DATA_TAG_EXCLUDED_INPUTS = new Set<string>([

export const PACKAGE_TEMPLATE_SUFFIX = '@package';
export const USER_SETTINGS_TEMPLATE_SUFFIX = '@custom';
export const CUSTOM_TEMPLATE_SUFFIX = '@custom';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could we use the same variable for USER_SETTINGS_TEMPLATE_SUFFIX and CUSTOM_TEMPLATE_SUFFIX

@nchaulet
Copy link
Member

We have a mechanism to reinstall all integrations when upgrading the stack https://github.com/elastic/kibana/blob/main/x-pack/plugins/fleet/server/constants/fleet_es_assets.ts#L14 do we want to bump it?
otherwise user with existing integrations may have to reinstall the integration to benefits of that new feature, (this seems acceptable to me too)

@jillguyonnet jillguyonnet added the backport:skip This commit does not require backporting label Sep 19, 2024
@jillguyonnet
Copy link
Contributor Author

Thanks for pointing this out @nchaulet! Making the feature available after upgrade makes sense - I've bumped FLEET_INSTALL_FORMAT_VERSION to 1.3.0.

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jillguyonnet

@jillguyonnet jillguyonnet merged commit c8ff7ea into elastic:main Sep 20, 2024
22 checks passed
@jillguyonnet jillguyonnet deleted the fleet/190730-add-custom-component-template-to-integration-index-template branch September 20, 2024 13:28
@kpollich kpollich removed the backport:skip This commit does not require backporting label Nov 4, 2024
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Nov 4, 2024
@kpollich kpollich added backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) and removed backport:skip This commit does not require backporting labels Nov 4, 2024
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11667303817

@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11667303749

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 4, 2024
elastic#192731)

## Summary

Relates elastic#190730

This PR adds a `<type>@Custom `component template to integrations index
template's `composed_of` array.

### Testing

Integration install/update should be tested.

From my manual testing, Fleet seems to behave normally and the new
component template is added to the `composed_of` array. For example, the
output of `GET /_index_template/logs-system.auth` is:
```json
{
  "index_templates": [
    {
      "name": "logs-system.auth",
      "index_template": {
        "index_patterns": [
          "logs-system.auth-*"
        ],
        "template": {
          "settings": {},
          "mappings": {
            "_meta": {
              "package": {
                "name": "system"
              },
              "managed_by": "fleet",
              "managed": true
            }
          }
        },
        "composed_of": [
          "logs@mappings",
          "logs@settings",
          "logs-system.auth@package",
          "logs@custom",
          "logs-system.auth@custom",
          "ecs@mappings",
          ".fleet_globals-1",
          ".fleet_agent_id_verification-1"
        ],
        "priority": 200,
        "_meta": {
          "package": {
            "name": "system"
          },
          "managed_by": "fleet",
          "managed": true
        },
        "data_stream": {
          "hidden": false,
          "allow_custom_routing": false,
          "failure_store": false
        },
        "ignore_missing_component_templates": [
          "logs@custom",
          "logs-system.auth@custom"
        ]
      }
    }
  ]
}
```

### Screenshot

<img width="956" alt="Screenshot 2024-09-19 at 16 44 57"
src="https://github.com/user-attachments/assets/7e1d8e67-1d78-45a7-bc8d-8e509f1a2533">

<img width="956" alt="Screenshot 2024-09-19 at 17 04 45"
src="https://github.com/user-attachments/assets/8b6bbaf3-34b7-4169-8ca8-2bc6a38fe60d">

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

(cherry picked from commit c8ff7ea)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 4, 2024
elastic#192731)

## Summary

Relates elastic#190730

This PR adds a `<type>@Custom `component template to integrations index
template's `composed_of` array.

### Testing

Integration install/update should be tested.

From my manual testing, Fleet seems to behave normally and the new
component template is added to the `composed_of` array. For example, the
output of `GET /_index_template/logs-system.auth` is:
```json
{
  "index_templates": [
    {
      "name": "logs-system.auth",
      "index_template": {
        "index_patterns": [
          "logs-system.auth-*"
        ],
        "template": {
          "settings": {},
          "mappings": {
            "_meta": {
              "package": {
                "name": "system"
              },
              "managed_by": "fleet",
              "managed": true
            }
          }
        },
        "composed_of": [
          "logs@mappings",
          "logs@settings",
          "logs-system.auth@package",
          "logs@custom",
          "logs-system.auth@custom",
          "ecs@mappings",
          ".fleet_globals-1",
          ".fleet_agent_id_verification-1"
        ],
        "priority": 200,
        "_meta": {
          "package": {
            "name": "system"
          },
          "managed_by": "fleet",
          "managed": true
        },
        "data_stream": {
          "hidden": false,
          "allow_custom_routing": false,
          "failure_store": false
        },
        "ignore_missing_component_templates": [
          "logs@custom",
          "logs-system.auth@custom"
        ]
      }
    }
  ]
}
```

### Screenshot

<img width="956" alt="Screenshot 2024-09-19 at 16 44 57"
src="https://github.com/user-attachments/assets/7e1d8e67-1d78-45a7-bc8d-8e509f1a2533">

<img width="956" alt="Screenshot 2024-09-19 at 17 04 45"
src="https://github.com/user-attachments/assets/8b6bbaf3-34b7-4169-8ca8-2bc6a38fe60d">

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

(cherry picked from commit c8ff7ea)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 4, 2024
…ons index te… (#192731) (#198808)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Fleet] Add &lt;type&gt;@Custom component template to integrations
index te… (#192731)](#192731)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jill
Guyonnet","email":"jill.guyonnet@elastic.co"},"sourceCommit":{"committedDate":"2024-09-20T13:28:23Z","message":"[Fleet]
Add <type>@Custom component template to integrations index te…
(#192731)\n\n## Summary\r\n\r\nRelates
https://github.com/elastic/kibana/issues/190730\r\n\r\nThis PR adds a
`<type>@Custom `component template to integrations index\r\ntemplate's
`composed_of` array.\r\n\r\n### Testing\r\n\r\nIntegration
install/update should be tested.\r\n\r\nFrom my manual testing, Fleet
seems to behave normally and the new\r\ncomponent template is added to
the `composed_of` array. For example, the\r\noutput of `GET
/_index_template/logs-system.auth` is:\r\n```json\r\n{\r\n
\"index_templates\": [\r\n {\r\n \"name\": \"logs-system.auth\",\r\n
\"index_template\": {\r\n \"index_patterns\": [\r\n
\"logs-system.auth-*\"\r\n ],\r\n \"template\": {\r\n \"settings\":
{},\r\n \"mappings\": {\r\n \"_meta\": {\r\n \"package\": {\r\n
\"name\": \"system\"\r\n },\r\n \"managed_by\": \"fleet\",\r\n
\"managed\": true\r\n }\r\n }\r\n },\r\n \"composed_of\": [\r\n
\"logs@mappings\",\r\n \"logs@settings\",\r\n
\"logs-system.auth@package\",\r\n \"logs@custom\",\r\n
\"logs-system.auth@custom\",\r\n \"ecs@mappings\",\r\n
\".fleet_globals-1\",\r\n \".fleet_agent_id_verification-1\"\r\n ],\r\n
\"priority\": 200,\r\n \"_meta\": {\r\n \"package\": {\r\n \"name\":
\"system\"\r\n },\r\n \"managed_by\": \"fleet\",\r\n \"managed\":
true\r\n },\r\n \"data_stream\": {\r\n \"hidden\": false,\r\n
\"allow_custom_routing\": false,\r\n \"failure_store\": false\r\n },\r\n
\"ignore_missing_component_templates\": [\r\n \"logs@custom\",\r\n
\"logs-system.auth@custom\"\r\n ]\r\n }\r\n }\r\n
]\r\n}\r\n```\r\n\r\n### Screenshot\r\n\r\n<img width=\"956\"
alt=\"Screenshot 2024-09-19 at 16 44
57\"\r\nsrc=\"https://github.com/user-attachments/assets/7e1d8e67-1d78-45a7-bc8d-8e509f1a2533\">\r\n\r\n<img
width=\"956\" alt=\"Screenshot 2024-09-19 at 17 04
45\"\r\nsrc=\"https://github.com/user-attachments/assets/8b6bbaf3-34b7-4169-8ca8-2bc6a38fe60d\">\r\n\r\n###
Checklist\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"c8ff7ea27ab02548c25c3c295bbd988e3adfbba4","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:Fleet","v9.0.0","backport:prev-minor"],"title":"[Fleet]
Add <type>@Custom component template to integrations index
te…","number":192731,"url":"https://github.com/elastic/kibana/pull/192731","mergeCommit":{"message":"[Fleet]
Add <type>@Custom component template to integrations index te…
(#192731)\n\n## Summary\r\n\r\nRelates
https://github.com/elastic/kibana/issues/190730\r\n\r\nThis PR adds a
`<type>@Custom `component template to integrations index\r\ntemplate's
`composed_of` array.\r\n\r\n### Testing\r\n\r\nIntegration
install/update should be tested.\r\n\r\nFrom my manual testing, Fleet
seems to behave normally and the new\r\ncomponent template is added to
the `composed_of` array. For example, the\r\noutput of `GET
/_index_template/logs-system.auth` is:\r\n```json\r\n{\r\n
\"index_templates\": [\r\n {\r\n \"name\": \"logs-system.auth\",\r\n
\"index_template\": {\r\n \"index_patterns\": [\r\n
\"logs-system.auth-*\"\r\n ],\r\n \"template\": {\r\n \"settings\":
{},\r\n \"mappings\": {\r\n \"_meta\": {\r\n \"package\": {\r\n
\"name\": \"system\"\r\n },\r\n \"managed_by\": \"fleet\",\r\n
\"managed\": true\r\n }\r\n }\r\n },\r\n \"composed_of\": [\r\n
\"logs@mappings\",\r\n \"logs@settings\",\r\n
\"logs-system.auth@package\",\r\n \"logs@custom\",\r\n
\"logs-system.auth@custom\",\r\n \"ecs@mappings\",\r\n
\".fleet_globals-1\",\r\n \".fleet_agent_id_verification-1\"\r\n ],\r\n
\"priority\": 200,\r\n \"_meta\": {\r\n \"package\": {\r\n \"name\":
\"system\"\r\n },\r\n \"managed_by\": \"fleet\",\r\n \"managed\":
true\r\n },\r\n \"data_stream\": {\r\n \"hidden\": false,\r\n
\"allow_custom_routing\": false,\r\n \"failure_store\": false\r\n },\r\n
\"ignore_missing_component_templates\": [\r\n \"logs@custom\",\r\n
\"logs-system.auth@custom\"\r\n ]\r\n }\r\n }\r\n
]\r\n}\r\n```\r\n\r\n### Screenshot\r\n\r\n<img width=\"956\"
alt=\"Screenshot 2024-09-19 at 16 44
57\"\r\nsrc=\"https://github.com/user-attachments/assets/7e1d8e67-1d78-45a7-bc8d-8e509f1a2533\">\r\n\r\n<img
width=\"956\" alt=\"Screenshot 2024-09-19 at 17 04
45\"\r\nsrc=\"https://github.com/user-attachments/assets/8b6bbaf3-34b7-4169-8ca8-2bc6a38fe60d\">\r\n\r\n###
Checklist\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"c8ff7ea27ab02548c25c3c295bbd988e3adfbba4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192731","number":192731,"mergeCommit":{"message":"[Fleet]
Add <type>@Custom component template to integrations index te…
(#192731)\n\n## Summary\r\n\r\nRelates
https://github.com/elastic/kibana/issues/190730\r\n\r\nThis PR adds a
`<type>@Custom `component template to integrations index\r\ntemplate's
`composed_of` array.\r\n\r\n### Testing\r\n\r\nIntegration
install/update should be tested.\r\n\r\nFrom my manual testing, Fleet
seems to behave normally and the new\r\ncomponent template is added to
the `composed_of` array. For example, the\r\noutput of `GET
/_index_template/logs-system.auth` is:\r\n```json\r\n{\r\n
\"index_templates\": [\r\n {\r\n \"name\": \"logs-system.auth\",\r\n
\"index_template\": {\r\n \"index_patterns\": [\r\n
\"logs-system.auth-*\"\r\n ],\r\n \"template\": {\r\n \"settings\":
{},\r\n \"mappings\": {\r\n \"_meta\": {\r\n \"package\": {\r\n
\"name\": \"system\"\r\n },\r\n \"managed_by\": \"fleet\",\r\n
\"managed\": true\r\n }\r\n }\r\n },\r\n \"composed_of\": [\r\n
\"logs@mappings\",\r\n \"logs@settings\",\r\n
\"logs-system.auth@package\",\r\n \"logs@custom\",\r\n
\"logs-system.auth@custom\",\r\n \"ecs@mappings\",\r\n
\".fleet_globals-1\",\r\n \".fleet_agent_id_verification-1\"\r\n ],\r\n
\"priority\": 200,\r\n \"_meta\": {\r\n \"package\": {\r\n \"name\":
\"system\"\r\n },\r\n \"managed_by\": \"fleet\",\r\n \"managed\":
true\r\n },\r\n \"data_stream\": {\r\n \"hidden\": false,\r\n
\"allow_custom_routing\": false,\r\n \"failure_store\": false\r\n },\r\n
\"ignore_missing_component_templates\": [\r\n \"logs@custom\",\r\n
\"logs-system.auth@custom\"\r\n ]\r\n }\r\n }\r\n
]\r\n}\r\n```\r\n\r\n### Screenshot\r\n\r\n<img width=\"956\"
alt=\"Screenshot 2024-09-19 at 16 44
57\"\r\nsrc=\"https://github.com/user-attachments/assets/7e1d8e67-1d78-45a7-bc8d-8e509f1a2533\">\r\n\r\n<img
width=\"956\" alt=\"Screenshot 2024-09-19 at 17 04
45\"\r\nsrc=\"https://github.com/user-attachments/assets/8b6bbaf3-34b7-4169-8ca8-2bc6a38fe60d\">\r\n\r\n###
Checklist\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"c8ff7ea27ab02548c25c3c295bbd988e3adfbba4"}}]}]
BACKPORT-->

Co-authored-by: Jill Guyonnet <jill.guyonnet@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants