Repository navigation
Allow structured Kubernetes manifest field values - #21824
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21824Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21824" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Nested resource handles are silently serialized as unresolved $handle/$type objects, producing invalid manifest values; recursive rejection and tests covering handles inside objects and arrays are needed.
1 open issue
What changed in this PR
This PR addresses the remaining structured-manifest limitation in #18080, allowing polyglot AppHosts to supply nested Kubernetes fields without changing the CLR signature or dot-separated path behavior.
Changes:
- Removes the scalar-only restriction from
WithFieldand applies numeric validation to JSON values. - Adds dispatch-to-YAML tests, invalid-value tests, and generated SDK snapshots for five languages.
- Documents custom manifests, dotted label keys, and subtree replacement behavior.
| File | Description |
|---|---|
tests/Aspire.Hosting.RemoteHost.Tests/Snapshots/KubernetesManifestTests.WithField_GeneratedSdkAcceptsStructuredValues_language=TypeScript.verified.ts |
Captures the TypeScript any parameter. |
tests/Aspire.Hosting.RemoteHost.Tests/Snapshots/KubernetesManifestTests.WithField_GeneratedSdkAcceptsStructuredValues_language=Rust.verified.rs |
Captures the Rust &Value parameter. |
tests/Aspire.Hosting.RemoteHost.Tests/Snapshots/KubernetesManifestTests.WithField_GeneratedSdkAcceptsStructuredValues_language=Python.verified.py |
Captures the Python typing.Any parameter. |
tests/Aspire.Hosting.RemoteHost.Tests/Snapshots/KubernetesManifestTests.WithField_GeneratedSdkAcceptsStructuredValues_language=Java.verified.java |
Captures the Java Object parameter. |
tests/Aspire.Hosting.RemoteHost.Tests/Snapshots/KubernetesManifestTests.WithField_GeneratedSdkAcceptsStructuredValues_language=Go.verified.go |
Captures Go generation without the scalar union guard. |
tests/Aspire.Hosting.RemoteHost.Tests/Snapshots/KubernetesManifestTests.WithField_DispatchesStructuredValuesToPublishedYaml.verified.yaml |
Records the published Cilium policy structure. |
tests/Aspire.Hosting.RemoteHost.Tests/KubernetesManifestTests.cs |
Tests dispatch, publishing, rejection, and SDK projections. |
tests/Aspire.Hosting.RemoteHost.Tests/Aspire.Hosting.RemoteHost.Tests.csproj |
Adds Kubernetes and snapshot-testing dependencies. |
tests/Aspire.Hosting.Kubernetes.Tests/KubernetesPublisherTests.cs |
Tests invalid-value rejection and preservation of existing fields. |
src/Aspire.Hosting.Kubernetes/README.md |
Documents structured custom-manifest usage. |
src/Aspire.Hosting.Kubernetes/KubernetesManifestResource.cs |
Removes the union restriction and validates JSON numbers. |
Review effort: Balanced
Preserve both Kubernetes README additions and reject ATS handle envelopes recursively before updating manifest fields. Cover nested object and array arguments and preserve existing fields on failure. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…d-manifest-fields
Tests selector7 / 101 PR test projects · 2 PR jobs, from 10 changed files. Selected PR test projects (7 / 101)
Selected PR jobs (2)
How these were chosen — grouped by what changed🔧 📦 affected project 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
|
Pull request created: #2072
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#2072 targeting Documented structured (object/array) Note This draft PR needs human review before merging. |
## Description Generated Go AppHosts can run callbacks concurrently with the main builder chain without racing the sticky error or lazy collection accessors. Invalid request arguments and unencodable callback results now fail their individual calls instead of disconnecting every pending operation. Callback decoding errors and `runtime.Goexit` produce explicit JSON-RPC errors; message headers and cancellation requests are bounded. The Go API export also includes structured `type` and `optional` metadata for every field and constant. DTO optionality comes from ATS metadata, not the generated `omitempty` tag or pointer spelling. This is additive to schema version 1 and includes options, runtime fields, enum constants, and exported value leaves. Export snapshots and the output-format documentation are updated. Related to #21204, #21212, and #21115. This does not close either follow-up issue. The remaining structured Kubernetes manifest work is separate in #21824. ### User-facing usage Collection serialization preserves its existing signature; failures are now observable through the additive `Err` methods: ```go payload := resource.GetTags().ToJSON() if err := resource.GetTags().Err(); err != nil { return err } _ = payload ``` `aspire sdk export --language go --package Name@Version` now emits fields such as: ```json { "name": "Mode", "type": "*TestPersistenceMode", "optional": true } ``` Cancellation watchers are armed only after the invocation carrying their IDs has entered the FIFO write queue. The cancellation RPC has a five-second timeout; a canceled call still returns through its own context without waiting for that RPC. ### Validation Commands ran on Windows with the restored repository SDK and an isolated Go 1.27.3 toolchain added to `PATH`. Linux race checks used Go 1.26.10 and GCC from the existing local `aspire-go-e2e-6972:latest` image. | Command | Result | | --- | --- | | `.\restore.cmd` | Passed; 17 dependency audit warnings, no errors. | | `dotnet test --project tests\Aspire.Hosting.CodeGeneration.Go.Tests\Aspire.Hosting.CodeGeneration.Go.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed: 130 tests, no failures or skips. Reviewed and accepted generated Go/JSON snapshot changes. | | `dotnet test --project tests\Aspire.Hosting.CodeGeneration.Go.Tests\Aspire.Hosting.CodeGeneration.Go.Tests.csproj --no-launch-profile -- --filter-method "*.GeneratedRuntime_PassesGoRuntimeHardeningTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed after adding the final actual-getter-failure assertions. | | `go test -race -timeout 60s -v .` | Passed in a generated module extracted from the Go snapshot, with `runtime_test.go`, `transport_hardening_test.go`, and `decode_test.go` from the C# tests. Includes a callback and main chaining on the same captured generated builder, encoding failures, callback errors/Goexit, header bounds, and cancellation ordering/timeout cleanup. | | `go test -race -timeout 60s -run TestCallbackAndMainCanChainOnCapturedBuilder .` | Failed as expected against the original main snapshot with data races; the same regression passes with this branch. | | `dotnet test --project tests\Aspire.Hosting.RemoteHost.Tests\Aspire.Hosting.RemoteHost.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed: 698 tests, 1 skipped. Includes integration scanning and Go export/codegen coverage. | | `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.SdkExportCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed: 31 tests. | | `dotnet build src\Aspire.Cli\Aspire.Cli.csproj --configuration Release /p:SkipNativeBuild=true` | Passed, with the existing ILCompiler audit warning. Managed Release build, not native AOT. | | `.\.dotnet\dotnet.exe artifacts\bin\Aspire.Cli\Release\net11.0\aspire.dll sdk export --help` | Passed; help lists Go as an export language. | | `git diff --check` | Passed. | ### Remaining policy and execution gaps - Callback registry release still needs a host release signal and a cross-language ownership contract. This PR does not unregister callbacks when a registration capability returns, because the host can invoke them later. - Disconnect-driven `os.Exit(1)` is unchanged. Choosing an observable shutdown contract requires a cross-language decision; no GA lifecycle guarantee is introduced. - The reported required-token path is currently unreachable because `SplitParameters` places all cancellation tokens in Go options. Both token-emission paths select the supplied token's context. - A bundled current-main CLI export measuring Redis/Azure Storage XML-summary coverage was not run. No documentation-copy policy was changed based solely on project-built behavior. - No new grouped export view was introduced; consumers still have `capabilityId` for grouping. The aspire.dev consumer and its grouping decision are outside this product-only change. - Native AOT publishing, the full CLI suite, a many-integration live AppHost, polyglot E2E, macOS, and the complete CI matrix were not run. Go feature-flag-off validation is obsolete because #21183 removed that flag. ### Security considerations This changes handling of AppHost JSON-RPC messages and callback payloads. Headers are limited to 16 entries and 8 KiB before body allocation, in addition to the existing 64 MiB body cap. Invalid typed callback arguments are rejected before user code is called; decoding no longer silently substitutes invalid DTO fields. No authentication, listener, or permission policy changes are made. A formal threat model/security review has not been performed. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [x] Yes - If yes, did you have an API Review for it? - [ ] Yes - [x] No - Did you add `<remarks />` and `<code />` elements on your triple slash comments? - [ ] Yes - [x] No - [ ] No - Does the change make any security assumptions or guarantees? - [x] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [x] No - [ ] No The additive APIs are Go `List.Err`/`Dict.Err` and JSON export metadata; no public C# API was added. Go documentation comments describe the error contract. Triple-slash XML elements do not apply to these Go members. The fixes in this PR are complete; the explicitly deferred cross-language policy and bundle-validation items remain tracked in the related issues. --------- Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
## Description Generated Go AppHosts can run callbacks concurrently with the main builder chain without racing the sticky error or lazy collection accessors. Invalid request arguments and unencodable callback results now fail their individual calls instead of disconnecting every pending operation. Callback decoding errors and `runtime.Goexit` produce explicit JSON-RPC errors; message headers and cancellation requests are bounded. The Go API export also includes structured `type` and `optional` metadata for every field and constant. DTO optionality comes from ATS metadata, not the generated `omitempty` tag or pointer spelling. This is additive to schema version 1 and includes options, runtime fields, enum constants, and exported value leaves. Export snapshots and the output-format documentation are updated. Related to #21204, #21212, and #21115. This does not close either follow-up issue. The remaining structured Kubernetes manifest work is separate in #21824. ### User-facing usage Collection serialization preserves its existing signature; failures are now observable through the additive `Err` methods: ```go payload := resource.GetTags().ToJSON() if err := resource.GetTags().Err(); err != nil { return err } _ = payload ``` `aspire sdk export --language go --package Name@Version` now emits fields such as: ```json { "name": "Mode", "type": "*TestPersistenceMode", "optional": true } ``` Cancellation watchers are armed only after the invocation carrying their IDs has entered the FIFO write queue. The cancellation RPC has a five-second timeout; a canceled call still returns through its own context without waiting for that RPC. ### Validation Commands ran on Windows with the restored repository SDK and an isolated Go 1.27.3 toolchain added to `PATH`. Linux race checks used Go 1.26.10 and GCC from the existing local `aspire-go-e2e-6972:latest` image. | Command | Result | | --- | --- | | `.\restore.cmd` | Passed; 17 dependency audit warnings, no errors. | | `dotnet test --project tests\Aspire.Hosting.CodeGeneration.Go.Tests\Aspire.Hosting.CodeGeneration.Go.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed: 130 tests, no failures or skips. Reviewed and accepted generated Go/JSON snapshot changes. | | `dotnet test --project tests\Aspire.Hosting.CodeGeneration.Go.Tests\Aspire.Hosting.CodeGeneration.Go.Tests.csproj --no-launch-profile -- --filter-method "*.GeneratedRuntime_PassesGoRuntimeHardeningTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed after adding the final actual-getter-failure assertions. | | `go test -race -timeout 60s -v .` | Passed in a generated module extracted from the Go snapshot, with `runtime_test.go`, `transport_hardening_test.go`, and `decode_test.go` from the C# tests. Includes a callback and main chaining on the same captured generated builder, encoding failures, callback errors/Goexit, header bounds, and cancellation ordering/timeout cleanup. | | `go test -race -timeout 60s -run TestCallbackAndMainCanChainOnCapturedBuilder .` | Failed as expected against the original main snapshot with data races; the same regression passes with this branch. | | `dotnet test --project tests\Aspire.Hosting.RemoteHost.Tests\Aspire.Hosting.RemoteHost.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed: 698 tests, 1 skipped. Includes integration scanning and Go export/codegen coverage. | | `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.SdkExportCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed: 31 tests. | | `dotnet build src\Aspire.Cli\Aspire.Cli.csproj --configuration Release /p:SkipNativeBuild=true` | Passed, with the existing ILCompiler audit warning. Managed Release build, not native AOT. | | `.\.dotnet\dotnet.exe artifacts\bin\Aspire.Cli\Release\net11.0\aspire.dll sdk export --help` | Passed; help lists Go as an export language. | | `git diff --check` | Passed. | ### Remaining policy and execution gaps - Callback registry release still needs a host release signal and a cross-language ownership contract. This PR does not unregister callbacks when a registration capability returns, because the host can invoke them later. - Disconnect-driven `os.Exit(1)` is unchanged. Choosing an observable shutdown contract requires a cross-language decision; no GA lifecycle guarantee is introduced. - The reported required-token path is currently unreachable because `SplitParameters` places all cancellation tokens in Go options. Both token-emission paths select the supplied token's context. - A bundled current-main CLI export measuring Redis/Azure Storage XML-summary coverage was not run. No documentation-copy policy was changed based solely on project-built behavior. - No new grouped export view was introduced; consumers still have `capabilityId` for grouping. The aspire.dev consumer and its grouping decision are outside this product-only change. - Native AOT publishing, the full CLI suite, a many-integration live AppHost, polyglot E2E, macOS, and the complete CI matrix were not run. Go feature-flag-off validation is obsolete because #21183 removed that flag. ### Security considerations This changes handling of AppHost JSON-RPC messages and callback payloads. Headers are limited to 16 entries and 8 KiB before body allocation, in addition to the existing 64 MiB body cap. Invalid typed callback arguments are rejected before user code is called; decoding no longer silently substitutes invalid DTO fields. No authentication, listener, or permission policy changes are made. A formal threat model/security review has not been performed. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [x] Yes - If yes, did you have an API Review for it? - [ ] Yes - [x] No - Did you add `<remarks />` and `<code />` elements on your triple slash comments? - [ ] Yes - [x] No - [ ] No - Does the change make any security assumptions or guarantees? - [x] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [x] No - [ ] No The additive APIs are Go `List.Err`/`Dict.Err` and JSON export metadata; no public C# API was added. Go documentation comments describe the error contract. Triple-slash XML elements do not apply to these Go members. The fixes in this PR are complete; the explicitly deferred cross-language policy and bundle-validation items remain tracked in the related issues. --------- Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> (cherry picked from commit e7ff435)
## Description Generated Go AppHosts can run callbacks concurrently with the main builder chain without racing the sticky error or lazy collection accessors. Invalid request arguments and unencodable callback results now fail their individual calls instead of disconnecting every pending operation. Callback decoding errors and `runtime.Goexit` produce explicit JSON-RPC errors; message headers and cancellation requests are bounded. The Go API export also includes structured `type` and `optional` metadata for every field and constant. DTO optionality comes from ATS metadata, not the generated `omitempty` tag or pointer spelling. This is additive to schema version 1 and includes options, runtime fields, enum constants, and exported value leaves. Export snapshots and the output-format documentation are updated. Related to #21204, #21212, and #21115. This does not close either follow-up issue. The remaining structured Kubernetes manifest work is separate in #21824. ### User-facing usage Collection serialization preserves its existing signature; failures are now observable through the additive `Err` methods: ```go payload := resource.GetTags().ToJSON() if err := resource.GetTags().Err(); err != nil { return err } _ = payload ``` `aspire sdk export --language go --package Name@Version` now emits fields such as: ```json { "name": "Mode", "type": "*TestPersistenceMode", "optional": true } ``` Cancellation watchers are armed only after the invocation carrying their IDs has entered the FIFO write queue. The cancellation RPC has a five-second timeout; a canceled call still returns through its own context without waiting for that RPC. ### Validation Commands ran on Windows with the restored repository SDK and an isolated Go 1.27.3 toolchain added to `PATH`. Linux race checks used Go 1.26.10 and GCC from the existing local `aspire-go-e2e-6972:latest` image. | Command | Result | | --- | --- | | `.\restore.cmd` | Passed; 17 dependency audit warnings, no errors. | | `dotnet test --project tests\Aspire.Hosting.CodeGeneration.Go.Tests\Aspire.Hosting.CodeGeneration.Go.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed: 130 tests, no failures or skips. Reviewed and accepted generated Go/JSON snapshot changes. | | `dotnet test --project tests\Aspire.Hosting.CodeGeneration.Go.Tests\Aspire.Hosting.CodeGeneration.Go.Tests.csproj --no-launch-profile -- --filter-method "*.GeneratedRuntime_PassesGoRuntimeHardeningTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed after adding the final actual-getter-failure assertions. | | `go test -race -timeout 60s -v .` | Passed in a generated module extracted from the Go snapshot, with `runtime_test.go`, `transport_hardening_test.go`, and `decode_test.go` from the C# tests. Includes a callback and main chaining on the same captured generated builder, encoding failures, callback errors/Goexit, header bounds, and cancellation ordering/timeout cleanup. | | `go test -race -timeout 60s -run TestCallbackAndMainCanChainOnCapturedBuilder .` | Failed as expected against the original main snapshot with data races; the same regression passes with this branch. | | `dotnet test --project tests\Aspire.Hosting.RemoteHost.Tests\Aspire.Hosting.RemoteHost.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed: 698 tests, 1 skipped. Includes integration scanning and Go export/codegen coverage. | | `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.SdkExportCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` | Passed: 31 tests. | | `dotnet build src\Aspire.Cli\Aspire.Cli.csproj --configuration Release /p:SkipNativeBuild=true` | Passed, with the existing ILCompiler audit warning. Managed Release build, not native AOT. | | `.\.dotnet\dotnet.exe artifacts\bin\Aspire.Cli\Release\net11.0\aspire.dll sdk export --help` | Passed; help lists Go as an export language. | | `git diff --check` | Passed. | ### Remaining policy and execution gaps - Callback registry release still needs a host release signal and a cross-language ownership contract. This PR does not unregister callbacks when a registration capability returns, because the host can invoke them later. - Disconnect-driven `os.Exit(1)` is unchanged. Choosing an observable shutdown contract requires a cross-language decision; no GA lifecycle guarantee is introduced. - The reported required-token path is currently unreachable because `SplitParameters` places all cancellation tokens in Go options. Both token-emission paths select the supplied token's context. - A bundled current-main CLI export measuring Redis/Azure Storage XML-summary coverage was not run. No documentation-copy policy was changed based solely on project-built behavior. - No new grouped export view was introduced; consumers still have `capabilityId` for grouping. The aspire.dev consumer and its grouping decision are outside this product-only change. - Native AOT publishing, the full CLI suite, a many-integration live AppHost, polyglot E2E, macOS, and the complete CI matrix were not run. Go feature-flag-off validation is obsolete because #21183 removed that flag. ### Security considerations This changes handling of AppHost JSON-RPC messages and callback payloads. Headers are limited to 16 entries and 8 KiB before body allocation, in addition to the existing 64 MiB body cap. Invalid typed callback arguments are rejected before user code is called; decoding no longer silently substitutes invalid DTO fields. No authentication, listener, or permission policy changes are made. A formal threat model/security review has not been performed. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [x] Yes - If yes, did you have an API Review for it? - [ ] Yes - [x] No - Did you add `<remarks />` and `<code />` elements on your triple slash comments? - [ ] Yes - [x] No - [ ] No - Does the change make any security assumptions or guarantees? - [x] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [x] No - [ ] No The additive APIs are Go `List.Err`/`Dict.Err` and JSON export metadata; no public C# API was added. Go documentation comments describe the error contract. Triple-slash XML elements do not apply to these Go members. The fixes in this PR are complete; the explicitly deferred cross-language policy and bundle-validation items remain tracked in the related issues. --------- Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> (cherry picked from commit e7ff435)
|
/backport to release/17.0 |
|
Started backporting to |
|
David Pine (@IEvangelist) backporting to git am output$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Allow structured Kubernetes manifest field values
Using index info to reconstruct a base tree...
M src/Aspire.Hosting.Kubernetes/README.md
M tests/Aspire.Hosting.Kubernetes.Tests/KubernetesPublisherTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Aspire.Hosting.Kubernetes/README.md
CONFLICT (content): Merge conflict in src/Aspire.Hosting.Kubernetes/README.md
Auto-merging tests/Aspire.Hosting.Kubernetes.Tests/KubernetesPublisherTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Allow structured Kubernetes manifest field values
Error: The process '/usr/bin/git' failed with exit code 128 |
) ## Description Backport of #21824 to `release/17.0`. Polyglot AppHosts can author custom Kubernetes manifests with nested objects and arrays, including CiliumNetworkPolicy ingress rules and selectors whose label keys contain dots and slashes. JSON numbers receive the same finite/range checks as CLR numeric values, including inside nested structures. Dot-separated paths and last-write-wins behavior are unchanged; no public CLR API is added. This standalone backport applies the final merged squash commit `dea22b13453b1703ace03f23c06bfd013017edb6`, not the original multi-commit patch history. It applied cleanly to release tip `cec195f2d0bf3f1d714badf74f205fa855fdf963` without conflict resolution or adaptations. It does not depend on or modify the abandoned stacked backports, including #22001. Relates to #18080; this addresses structured manifest values only and does not close the umbrella issue. ### User-facing usage ```typescript await api.publishAsKubernetesService(async (service) => { const policy = await service.addManifest("cilium.io/v2", "CiliumNetworkPolicy", "api-netpol"); await policy.withField("spec.endpointSelector.matchLabels", { "app.kubernetes.io/component": "api" }); await policy.withField("spec.ingress", [{ fromEndpoints: [{ matchLabels: { "app.kubernetes.io/component": "frontend" } }] }]); }); ``` ### Validation Run against this release-branch backport on Windows: - `.\restore.cmd` - passed (0 errors, 18 NuGet vulnerability warnings). - `dotnet test --project tests\Aspire.Hosting.RemoteHost.Tests\Aspire.Hosting.RemoteHost.Tests.csproj --no-launch-profile -- --filter-class "*.KubernetesManifestTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` - passed, 13 tests; 0 failed/skipped. - `dotnet test --project tests\Aspire.Hosting.Kubernetes.Tests\Aspire.Hosting.Kubernetes.Tests.csproj --no-launch-profile -- --filter-class "*.KubernetesPublisherTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"` - passed, 115 tests; 0 failed/skipped. - `git diff --check HEAD^ HEAD` - passed. - `git diff HEAD^ HEAD | git patch-id --stable` and `git diff dea22b1^ dea22b1 | git patch-id --stable` - passed equivalence check: both patch IDs are `26cc4688082766ec12213ef758509ce1b4153169`. - `git diff --exit-code` and `git status --short` - passed/clean after tests; no snapshot changes accepted. No local build/test blockers. Live AppHosts, Helm rendering, and Kubernetes/Cilium deployment were not rerun for this backport; CI was pending when the PR was created. The added test dependency is an explicit MSBuild project reference, with tests and snapshots in their owning project; no test-selection map changes are required. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - If yes, did you have an API Review for it? - [ ] Yes - [ ] No - Did you add `<remarks />` and `<code />` elements on your triple slash comments? - [ ] Yes - [ ] No - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [ ] No - [x] No ## Customer Impact Polyglot AppHosts, including Go, cannot author Kubernetes custom-resource fields containing nested objects or arrays, blocking scenarios such as CiliumNetworkPolicy rules and dotted/slashed label keys. ## Testing On this release-branch backport, KubernetesManifestTests passed 13 tests and KubernetesPublisherTests passed 115 tests. The patch exactly matches the merged source, with no snapshot updates. Exact commands and results are recorded above. ## Risk Low. Localized manifest-value handling with unchanged CLR signature, capability ID, field paths, and replacement behavior. ## Regression? Unknown. The source PR does not establish a regression. Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Documents changes from microsoft/aspire#21824 Author: ``@davidfowl-unknown`` Targeting `release/17.0` based on the source PR milestone `17.0` (target_resolution: `exact_match`). ## Why `KubernetesManifestResource.WithField` no longer restricts polyglot values to scalars; objects and arrays (e.g. CiliumNetworkPolicy selectors with dotted keys) are now accepted. The docs previously didn't describe this. ## Changes - Updated `src/frontend/src/content/docs/integrations/compute/kubernetes.mdx` (existing page): added a "Structured field values" section with a TypeScript example, dotted-key guidance, replace semantics, and the resource-handle limitation. > Generated by [PR Documentation Check](https://github.com/microsoft/aspire/actions/runs/42168191345) for #21824 · copilot · auto · 26.4 AIC · ⌖ 1.17 AIC · ⊞ 7.4K · [◷](https://github.com/search?q=repo%3Amicrosoft%2Faspire.dev+%22gh-aw-workflow-id%3A+pr-docs-check%22&type=pullrequests) <!-- gh-aw-agentic-workflow: PR Documentation Check, engine: copilot, model: auto, id: 42168191345, workflow_id: pr-docs-check, run: https://github.com/microsoft/aspire/actions/runs/42168191345 --> <!-- gh-aw-workflow-id: pr-docs-check --> <!-- gh-aw-workflow-call-id: microsoft/aspire/pr-docs-check -->

Description
Polyglot AppHosts can now author custom Kubernetes manifests with nested objects and arrays, including CiliumNetworkPolicy ingress rules and selectors whose label keys contain dots and slashes.
Remove the scalar-only
AspireUnionrestriction fromKubernetesManifestResource.WithField. The CLR signature remainsWithField(string, object)and the existing normalization/YAML paths handle the structured values. JSON numbers now use the same finite/range checks as CLR numeric values, including inside nested objects and arrays.Dot-separated paths and last-write-wins replacement are unchanged. Supply dotted keys inside a map subtree rather than adding path escape syntax. Manifest metadata still uses dedicated APIs.
Part of #18080: addresses the remaining structured-manifest limitation (bug 2). The Go Configure callback panic and integer union handling (bug 1) were already fixed by merged #21188 and are not changed here.
User-facing usage
C# AppHosts continue to use
AdditionalResourceswith aBaseKubernetesResourcesubclass for typed custom resources; no public CLR API is added.Generated SDK compatibility
Focused snapshots cover the real Kubernetes capability in all five generators: Go
anywithout the scalar union guard, TypeScriptany, Pythontyping.Any, JavaObject, and Rust&Value. Java's transport still unwraps existingAspireUnionarguments, so existing source calls remain usable after regeneration. The CLR signature and capability ID are unchanged. No generator implementation, shared runtime, or release API baseline files are edited.Validation
.\restore.cmd- passed; repository-wide restore reported 17 NuGet vulnerability warnings.dotnet test --project tests\Aspire.Hosting.RemoteHost.Tests\Aspire.Hosting.RemoteHost.Tests.csproj --no-launch-profile -- --filter-class "*.KubernetesManifestTests" --filter-class "*.CapabilityDispatcherTests" --filter-class "*.AtsMarshallerTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"- passed, 278 tests.dotnet test --project tests\Aspire.Hosting.RemoteHost.Tests\Aspire.Hosting.RemoteHost.Tests.csproj --no-launch-profile -- --filter-class "*.KubernetesManifestTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"- passed, 10 tests after normalizing trailing whitespace in generated snapshots.dotnet test --project tests\Aspire.Hosting.Kubernetes.Tests\Aspire.Hosting.Kubernetes.Tests.csproj --no-launch-profile -- --filter-class "*.KubernetesPublisherTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"- passed, 74 tests.dotnet test --project tests\Aspire.Hosting.RemoteHost.Tests\Aspire.Hosting.RemoteHost.Tests.csproj --no-launch-profile -- --filter-method "*.WithField_DispatchesStructuredValuesToPublishedYaml" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"with the original scalar union temporarily restored - failed as expected withrequires handle of type 'String | Double | Boolean', got 'object'. The fix was restored before the passing runs.git diff --check- passed.The behavioral test dispatches real
addManifest/withFieldcapabilities through publishing and snapshots CiliumNetworkPolicy YAML: arrays of objects, dotted/slashed keys, empty arrays, booleans, replacement semantics, and fluent return identity. Rejection tests cover resource handles, nested non-finite JSON numbers, invalid dictionary keys, unsupported CLR objects, and non-finite CLR numbers, including preservation of existing fields on failure.Evaluated MSBuild items/project references represent the new tests, snapshots, shared initializer, and Kubernetes dependency; no loose-input routing or workflow changes are needed.
Live Go Preview validation
Used the Linux x64 CLI archive and portable
built-nugetsfrom CI run 42116251464, both matching head3603a49c38bd7de8336c971cc16352992ffe4669. CLI version:17.0.0-pr.21824.g3603a49c. Ran in the existingaspire-go-e2e-6972:latestDocker image with Go1.26.10, GCC13.3.0, and a live Docker engine29.9.2. No repository fixtures or shared Go runtime files were changed.Exact commands inside the container (all passed):
The compile covers the complete generated Go module, not only the focused projection snapshot. Its generated
WithField(path string, value any)accepts native Go maps/slices. The scratch AppHost usesPublishAsKubernetesServiceand theAddManifestConfigure callback to author a CiliumNetworkPolicy. Publishing succeeded with 10/10 pipeline steps; a complete-output equality assertion verifiedtemplates/api/policy.yaml, including nested endpoint/port arrays,app.kubernetes.io/componentandapp.kubernetes.io/namekeys,egress: [],ingress: true, and integerrevision: 3.The initial attempt without explicit version/source selected stable
13.6.4and failed becauseAspire.Hosting.Gohas no matching stable package; the successful run above uses explicit matching PR artifacts. This does not claim default stable Go scaffolding is validated.Not run: live TypeScript/Python/Java/Rust AppHosts or generated SDK compilation in those languages, Helm rendering, or deployment to a Kubernetes/Cilium cluster. Negative-value coverage remains the automated production dispatch/CLR tests, not live Go rejection scenarios. Callback-release and disconnect/
os.Exitlifecycle redesigns are outside this change and this validation makes no new lifecycle guarantees.Checklist
<remarks />and<code />elements on your triple slash comments?