Skip to content

[docs] Add polyglot WithComputeEnvironment examples to Kubernetes and Docker integration pages#997

Open
aspire-repo-bot[bot] wants to merge 1 commit into
release/13.4from
docs/expose-withcomputeenvironment-polyglot-apphosts-eb7e140ad6f1516a
Open

[docs] Add polyglot WithComputeEnvironment examples to Kubernetes and Docker integration pages#997
aspire-repo-bot[bot] wants to merge 1 commit into
release/13.4from
docs/expose-withcomputeenvironment-polyglot-apphosts-eb7e140ad6f1516a

Conversation

@aspire-repo-bot
Copy link
Copy Markdown
Contributor

Documents changes from microsoft/aspire#17093 by @sebastienros.

Targeting release/13.4 based on the source PR milestone 13.4.

Why this PR is needed

WithComputeEnvironment was previously only available in C# app hosts — it was excluded from the polyglot (TypeScript, Python, Java, Go) SDK export via [AspireExportIgnore]. microsoft/aspire#17093 changed it to [AspireExport], making the API available in all polyglot app hosts.

The existing Kubernetes and Docker integration docs referenced WithComputeEnvironment only in a brief tip aside ("you can pass that to WithComputeEnvironment...") without showing how to call it — and the API simply wasn't usable in polyglot before this change.

What was changed

The WithComputeEnvironment tip asides on both integration pages are expanded to include:

  • A note that the API is now available in polyglot (TypeScript, Python, Java, Go) app hosts
  • Side-by-side C# and TypeScript code examples showing how to call WithComputeEnvironment / withComputeEnvironment

Files modified

  • src/frontend/src/content/docs/integrations/compute/kubernetes.mdx — expanded tip aside with C#/TypeScript examples for WithComputeEnvironment
  • src/frontend/src/content/docs/integrations/compute/docker.mdx — expanded tip aside with C#/TypeScript examples for withComputeEnvironment

Generated by PR Documentation Check for issue #17093 · ● 33.9M ·

…Docker integration pages

WithComputeEnvironment is now available in polyglot (TypeScript, Python, Java, Go) app hosts
as of microsoft/aspire#17093. Expand the existing tip asides on the Kubernetes and Docker
integration pages to include C# and TypeScript code examples showing how to call the API.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@aspire-repo-bot aspire-repo-bot Bot added the docs-from-code Copilot initiated issue from dotnet/aspire repo label May 18, 2026
@aspire-repo-bot aspire-repo-bot Bot requested a review from danegsta May 18, 2026 16:37
@IEvangelist IEvangelist marked this pull request as ready for review May 20, 2026 02:16
@IEvangelist IEvangelist self-requested a review as a code owner May 20, 2026 02:16
Copilot AI review requested due to automatic review settings May 20, 2026 02:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Kubernetes and Docker integration docs to show how to use compute environment disambiguation now that WithComputeEnvironment is available in polyglot AppHosts, adding side-by-side C# and TypeScript examples within the existing tip asides.

Changes:

  • Expanded the existing WithComputeEnvironment tip on the Kubernetes integration page with synced C#/TypeScript examples.
  • Expanded the existing WithComputeEnvironment tip on the Docker integration page with synced C#/TypeScript examples.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/frontend/src/content/docs/integrations/compute/kubernetes.mdx Expands the compute-environment disambiguation tip with C# and TypeScript examples.
src/frontend/src/content/docs/integrations/compute/docker.mdx Expands the compute-environment disambiguation tip with C# and TypeScript examples.
Comments suppressed due to low confidence (2)

src/frontend/src/content/docs/integrations/compute/kubernetes.mdx:121

  • This tip is introduced as guidance for the existing k8s (and api) variables from the preceding example, but the snippet redeclares them and calls AddProject("api") again. Reusing the previously declared api (and just showing the .WithComputeEnvironment(k8s) call) would avoid implying a duplicate resource definition.
  var k8s = builder.AddKubernetesEnvironment("k8s");

  builder.AddProject<Projects.MyApi>("api")
         .WithComputeEnvironment(k8s);

src/frontend/src/content/docs/integrations/compute/docker.mdx:156

  • The C# example uses Projects.MyApi, while the rest of this page’s examples use Projects.Api/Projects.Web. Aligning the placeholder project name/type with the surrounding examples would reduce confusion when readers copy/paste.
  var compose = builder.AddDockerComposeEnvironment("compose");

  builder.AddProject<Projects.MyApi>("api")
         .WithComputeEnvironment(compose);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +110 to +113
With the `k8s` variable assigned, you can pass it to the `WithComputeEnvironment` API to
disambiguate compute resources for solutions that define more than one. Otherwise, the `k8s`
variable isn't required. This API is available in C# and polyglot (TypeScript, Python, Java,
Go) app hosts.
Comment on lines +145 to +148
With the `compose` variable assigned, you can pass it to the `WithComputeEnvironment` API to
disambiguate compute resources for solutions that define more than one. Otherwise, the `compose`
variable isn't required. This API is available in C# and polyglot (TypeScript, Python, Java,
Go) app hosts.
Copy link
Copy Markdown
Member

@IEvangelist IEvangelist left a comment

Choose a reason for hiding this comment

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

This review was generated by running the doc-tester skill against PR #997 on the local Aspire docs site (http://localhost:54422).

Summary

Verdict: Comment — the changes are accurate, render cleanly, and the polyglot guidance is a real improvement. I found no blockers. The notes below are all minor / nit-level consistency items the author may or may not want to address before merge.

What I tested:

  • Checked out PR #997 from upstream into a worktree.
  • Started the docs site locally with aspire start --isolated (frontend at http://localhost:54422).
  • Used Playwright MCP-style automation to load both changed pages and exercise the new tip Asides:
    • /integrations/compute/docker/ — clicked C# and TypeScript tabs in the new tip.
    • /integrations/compute/kubernetes/ — clicked C# and TypeScript tabs in the new tip.
  • Verified that <Aside type="tip"> with nested <Tabs> + <TabItem> + fenced code blocks (indented by 2 spaces) renders correctly — the Tabs are interactive, the code highlights, and the copy-to-clipboard button works.
  • Cross-checked the polyglot TypeScript syntax against the rest of docker.mdx and kubernetes.mdx (e.g. the existing addDockerComposeEnvironment, addKubernetesEnvironment, addContainer, addNodeApp examples).
  • Confirmed the local CLI in this environment is 13.4.0-preview.1.26269.1, which matches the PR's release/13.4 target where microsoft/aspire#17093 lights up the polyglot withComputeEnvironment export.

Overall the PR does exactly what the description says, and the rendering is solid.

Findings

Minor

1. title= inconsistency on the Kubernetes C# block.
src/frontend/src/content/docs/integrations/compute/kubernetes.mdx line 117 uses:

```csharp title="AppHost.cs"

but every other C# code block on that page uses title="C# — AppHost.cs" (e.g. lines 39, 78, 142, 190). For consistency with the rest of the page, consider:

```csharp title="C# — AppHost.cs"

(Docker is fine — docker.mdx already uses bare title="AppHost.cs" everywhere, so the PR matches its page convention there.)

2. C# fluent-call indentation differs from the surrounding file style.
The new C# snippet uses aligned indentation:

builder.AddProject<Projects.MyApi>("api")
       .WithComputeEnvironment(compose);

…whereas every other multi-line fluent call in both files uses a 4-space continuation:

var api = builder.AddProject<Projects.Api>("api")
    .WithReference(cache)
    .PublishAsDockerComposeService(...);

Not wrong, just stylistically inconsistent with the rest of these two pages.

Nit

3. Asymmetric resource type between C# and TypeScript in the Docker tip.
The Docker C# example adds a project:

builder.AddProject<Projects.MyApi>("api").WithComputeEnvironment(compose);

The Docker TypeScript example adds a container instead:

const api = await builder.addContainer("api", "nginx:alpine");
await api.withComputeEnvironment(compose);

The Kubernetes tip is symmetric (project ↔ addNodeApp). For Docker, consider using addProject(...) in the TypeScript variant too so the languages tell the same story — or alternatively keep the divergence on purpose but call it out.

4. Project type names drift from the section above.
The main "Add Docker Compose environment resource" example just above uses Projects.Api, Projects.Web. The new tip introduces a fresh Projects.MyApi. Not a problem on its own, but a reader scrolling continuously sees three different project type names in adjacent code blocks. (The Kubernetes page already establishes Projects.MyApi higher up, so it's fine there.)

Knowledge gap

5. "C# and polyglot (TypeScript, Python, Java, Go)" but only TS is shown.
The new prose explicitly calls out Python, Java, and Go as supported, but only TypeScript appears in the tabs. A reader writing a Python or Go AppHost has no concrete syntax to copy and must guess the casing/builder pattern in their language. A few options:

  • Soften the claim to "available in polyglot app hosts" without enumerating every language, OR
  • Add Python/Java/Go tabs (matches the claim, but is a heavier lift), OR
  • Add a one-line pointer ("See the polyglot reference for Python/Java/Go syntax") so users aren't left guessing.

This is the kind of gap the doc-tester skill specifically asks to flag — I had to fall back on my prior knowledge of polyglot naming conventions to be confident the unshown languages mirror the TS shape.

Suggested wording (optional)

For the new sentence in both Asides:

This API is available in C# and polyglot (TypeScript, Python, Java, Go) app hosts.

Could be tightened to either:

This API is available in C# AppHosts and in all polyglot AppHosts (TypeScript, Python, Java, Go).

…or, if not adding examples for every language:

This API is available in C# AppHosts and, starting in 13.4, in polyglot AppHosts. The TypeScript snippet below applies analogously to Python, Java, and Go.

Things I explicitly did not flag

  • The MDX shape (<Aside> wrapping <Tabs> wrapping fenced code blocks with 2-space indentation) — I was initially worried CommonMark indentation would eat the fences, but Starlight's MDX handles it correctly. Renders fine in both pages.
  • The lack of a twoslash directive on the new TypeScript blocks — this is appropriate, since the bundled aspire.d.ts snapshot is still 13.3 and doesn't yet expose withComputeEnvironment; running twoslash on these snippets right now would falsely fail.
  • The await on a synchronous-looking addContainer / addNodeApp call — this matches the existing polyglot convention used throughout the same files.

Generated by running the doc-tester skill against PR #997.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-from-code Copilot initiated issue from dotnet/aspire repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants