[Fleet] Resolve streams and secrets by effective input name#264366
[Fleet] Resolve streams and secrets by effective input name#264366teresaromero merged 6 commits intoelastic:mainfrom
Conversation
Follow up to named/qualified inputs (name ?? type): registry data stream streams reference streams[].input by effective name while package policy inputs still carry the real agent type. Align stream template compilation, stream var validation, stream secret var lookup, and EPM template indexing with getInputEffectiveName(input). Adds a Jest case for manifests whose stream.input uses the input name. Made-with: Cursor
|
Pinging @elastic/fleet (Team:Fleet) |
ApprovabilityVerdict: Needs human review This PR changes runtime behavior by resolving streams and secrets using the input's effective name (name ?? type) instead of just type. This affects how Fleet validates, generates templates, and resolves secrets for inputs with custom names. All modified files are owned by @elastic/fleet who should review this behavioral change. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
Align getTemplateInputs placeholder lookup and templatePackagePolicyToFullInputStreams input ids with buildIndexedPackage (policy_template + name ?? type) so inputs with explicit names still resolve registry vars and YAML comments. Made-with: Cursor
|
Starting backport for target branches: 9.4 https://github.com/elastic/kibana/actions/runs/24716526625 |
💚 Build Succeeded
Metrics [docs]Page load bundle
History
|
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…64366) (#264634) # Backport This will backport the following commits from `main` to `9.4`: - [[Fleet] Resolve streams and secrets by effective input name (#264366)](#264366) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Tere","email":"teresa.romero@elastic.co"},"sourceCommit":{"committedDate":"2026-04-21T10:06:51Z","message":"[Fleet] Resolve streams and secrets by effective input name (#264366)\n\n## Summary\n\nCompletes propagation of **effective input names** (`name ?? type`,\n`getInputEffectiveName`) for places that still matched registry\n`streams[].input` against **`input.type`**. That mismatch caused package\npolicy creation to fail with `Stream template not found, unable to find\nstream for input <type>` when integration manifests reference streams by\n**input name** (same agent type, disambiguated names), as exercised by\ncomposable/elastic-package dual-input fixtures.\n\n**Changes**\n\n- **`package_policy.ts`**: `_compilePackageStream` selects the registry\nstream using `getInputEffectiveName(input)`; error message includes\neffective name and type.\n- **`validate_package_policy.ts`**: stream var-def lookup key uses\n`${dataset}-${getInputEffectiveName(input)}` to match the registry map\nkeyed by `stream.input`.\n- **`secrets/package_policies.ts`**: stream secret var-def lookup uses\nthe same effective name in the dataset key; import\n`getInputEffectiveName`.\n- **`get_template_inputs.ts`**: `buildIndexedPackage` indexes streams\nand input ids using `getInputEffectiveName(packageInput)` so\ndocs/template indexing matches named stream references.\n- **`package_policy.test.ts`**: Jest coverage for a manifest whose\n`streams[].input` is the input **name** while `input.type` remains the\nreal type.\n\nRelates to [Fleet: Support setting explicit names for ambiguous\ninputs](#262138) and composable\npackages that set `streams[].input` to the input name qualifier.\n\n**Related issue:** This gap surfaced while testing work for\n[elastic/elastic-package#3465](https://github.com/elastic/elastic-package/issues/3465)\n(composable `requires.input`: input `name` and stream `input` per\npackage-spec qualified inputs). The elastic-package change that\nimplements that issue is still **WIP**; this Kibana PR closes the Fleet\nside so policies compile when manifests follow the spec (streams\nreference the input **name** while the policy input keeps the real agent\n**type**).\n\n**Release notes:** Follow-up to #262138; no additional user-facing\nrelease note beyond that change. Use label `release_note:skip`.\n\n### Checklist\n\nCheck the PR satisfies following conditions.\n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [x] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n(`release_note:skip`, follow-up to #262138).\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n\n**Risks**\n\n- **Wrong stream match if a package mis-declares `streams[].input`**:\nLow. Behavior is aligned with `getInputEffectiveName`; packages that\nstill use plain `type` in manifests continue to work because `name` is\nabsent.\n- **EPM template / comment indexing**: Low. `buildIndexedPackage` now\nkeys by effective name; verify integration detail docs for packages with\nduplicate types and names if any UI relies on old `type`-only ids.","sha":"170d52a1b934b921c81a4edc59130f54310d77e7","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:version","v9.4.0","v9.5.0"],"title":"[Fleet] Resolve streams and secrets by effective input name","number":264366,"url":"https://github.com/elastic/kibana/pull/264366","mergeCommit":{"message":"[Fleet] Resolve streams and secrets by effective input name (#264366)\n\n## Summary\n\nCompletes propagation of **effective input names** (`name ?? type`,\n`getInputEffectiveName`) for places that still matched registry\n`streams[].input` against **`input.type`**. That mismatch caused package\npolicy creation to fail with `Stream template not found, unable to find\nstream for input <type>` when integration manifests reference streams by\n**input name** (same agent type, disambiguated names), as exercised by\ncomposable/elastic-package dual-input fixtures.\n\n**Changes**\n\n- **`package_policy.ts`**: `_compilePackageStream` selects the registry\nstream using `getInputEffectiveName(input)`; error message includes\neffective name and type.\n- **`validate_package_policy.ts`**: stream var-def lookup key uses\n`${dataset}-${getInputEffectiveName(input)}` to match the registry map\nkeyed by `stream.input`.\n- **`secrets/package_policies.ts`**: stream secret var-def lookup uses\nthe same effective name in the dataset key; import\n`getInputEffectiveName`.\n- **`get_template_inputs.ts`**: `buildIndexedPackage` indexes streams\nand input ids using `getInputEffectiveName(packageInput)` so\ndocs/template indexing matches named stream references.\n- **`package_policy.test.ts`**: Jest coverage for a manifest whose\n`streams[].input` is the input **name** while `input.type` remains the\nreal type.\n\nRelates to [Fleet: Support setting explicit names for ambiguous\ninputs](#262138) and composable\npackages that set `streams[].input` to the input name qualifier.\n\n**Related issue:** This gap surfaced while testing work for\n[elastic/elastic-package#3465](https://github.com/elastic/elastic-package/issues/3465)\n(composable `requires.input`: input `name` and stream `input` per\npackage-spec qualified inputs). The elastic-package change that\nimplements that issue is still **WIP**; this Kibana PR closes the Fleet\nside so policies compile when manifests follow the spec (streams\nreference the input **name** while the policy input keeps the real agent\n**type**).\n\n**Release notes:** Follow-up to #262138; no additional user-facing\nrelease note beyond that change. Use label `release_note:skip`.\n\n### Checklist\n\nCheck the PR satisfies following conditions.\n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [x] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n(`release_note:skip`, follow-up to #262138).\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n\n**Risks**\n\n- **Wrong stream match if a package mis-declares `streams[].input`**:\nLow. Behavior is aligned with `getInputEffectiveName`; packages that\nstill use plain `type` in manifests continue to work because `name` is\nabsent.\n- **EPM template / comment indexing**: Low. `buildIndexedPackage` now\nkeys by effective name; verify integration detail docs for packages with\nduplicate types and names if any UI relies on old `type`-only ids.","sha":"170d52a1b934b921c81a4edc59130f54310d77e7"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/264366","number":264366,"mergeCommit":{"message":"[Fleet] Resolve streams and secrets by effective input name (#264366)\n\n## Summary\n\nCompletes propagation of **effective input names** (`name ?? type`,\n`getInputEffectiveName`) for places that still matched registry\n`streams[].input` against **`input.type`**. That mismatch caused package\npolicy creation to fail with `Stream template not found, unable to find\nstream for input <type>` when integration manifests reference streams by\n**input name** (same agent type, disambiguated names), as exercised by\ncomposable/elastic-package dual-input fixtures.\n\n**Changes**\n\n- **`package_policy.ts`**: `_compilePackageStream` selects the registry\nstream using `getInputEffectiveName(input)`; error message includes\neffective name and type.\n- **`validate_package_policy.ts`**: stream var-def lookup key uses\n`${dataset}-${getInputEffectiveName(input)}` to match the registry map\nkeyed by `stream.input`.\n- **`secrets/package_policies.ts`**: stream secret var-def lookup uses\nthe same effective name in the dataset key; import\n`getInputEffectiveName`.\n- **`get_template_inputs.ts`**: `buildIndexedPackage` indexes streams\nand input ids using `getInputEffectiveName(packageInput)` so\ndocs/template indexing matches named stream references.\n- **`package_policy.test.ts`**: Jest coverage for a manifest whose\n`streams[].input` is the input **name** while `input.type` remains the\nreal type.\n\nRelates to [Fleet: Support setting explicit names for ambiguous\ninputs](#262138) and composable\npackages that set `streams[].input` to the input name qualifier.\n\n**Related issue:** This gap surfaced while testing work for\n[elastic/elastic-package#3465](https://github.com/elastic/elastic-package/issues/3465)\n(composable `requires.input`: input `name` and stream `input` per\npackage-spec qualified inputs). The elastic-package change that\nimplements that issue is still **WIP**; this Kibana PR closes the Fleet\nside so policies compile when manifests follow the spec (streams\nreference the input **name** while the policy input keeps the real agent\n**type**).\n\n**Release notes:** Follow-up to #262138; no additional user-facing\nrelease note beyond that change. Use label `release_note:skip`.\n\n### Checklist\n\nCheck the PR satisfies following conditions.\n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [x] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n(`release_note:skip`, follow-up to #262138).\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n\n**Risks**\n\n- **Wrong stream match if a package mis-declares `streams[].input`**:\nLow. Behavior is aligned with `getInputEffectiveName`; packages that\nstill use plain `type` in manifests continue to work because `name` is\nabsent.\n- **EPM template / comment indexing**: Low. `buildIndexedPackage` now\nkeys by effective name; verify integration detail docs for packages with\nduplicate types and names if any UI relies on old `type`-only ids.","sha":"170d52a1b934b921c81a4edc59130f54310d77e7"}}]}] BACKPORT--> Co-authored-by: Tere <teresa.romero@elastic.co>
Summary
Completes propagation of effective input names (
name ?? type,getInputEffectiveName) for places that still matched registrystreams[].inputagainstinput.type. That mismatch caused package policy creation to fail withStream template not found, unable to find stream for input <type>when integration manifests reference streams by input name (same agent type, disambiguated names), as exercised by composable/elastic-package dual-input fixtures.Changes
package_policy.ts:_compilePackageStreamselects the registry stream usinggetInputEffectiveName(input); error message includes effective name and type.validate_package_policy.ts: stream var-def lookup key uses${dataset}-${getInputEffectiveName(input)}to match the registry map keyed bystream.input.secrets/package_policies.ts: stream secret var-def lookup uses the same effective name in the dataset key; importgetInputEffectiveName.get_template_inputs.ts:buildIndexedPackageindexes streams and input ids usinggetInputEffectiveName(packageInput)so docs/template indexing matches named stream references.package_policy.test.ts: Jest coverage for a manifest whosestreams[].inputis the input name whileinput.typeremains the real type.Relates to Fleet: Support setting explicit names for ambiguous inputs and composable packages that set
streams[].inputto the input name qualifier.Related issue: This gap surfaced while testing work for elastic/elastic-package#3465 (composable
requires.input: inputnameand streaminputper package-spec qualified inputs). The elastic-package change that implements that issue is still WIP; this Kibana PR closes the Fleet side so policies compile when manifests follow the spec (streams reference the input name while the policy input keeps the real agent type).Release notes: Follow-up to #262138; no additional user-facing release note beyond that change. Use label
release_note:skip.Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelines (release_note:skip, follow-up to [Fleet] Support setting explicit names for ambiguous inputs #262138).backport:*labels.Identify risks
Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.
Risks
streams[].input: Low. Behavior is aligned withgetInputEffectiveName; packages that still use plaintypein manifests continue to work becausenameis absent.buildIndexedPackagenow keys by effective name; verify integration detail docs for packages with duplicate types and names if any UI relies on oldtype-only ids.