Add AKS persistent volume support - #19226
Conversation
Expose the Kubernetes persistent volume API through Azure Kubernetes environments and document the managed disk default. Add unit, polyglot, and deployment coverage for persistence across redeployments. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 650be0fb-e3a4-44d8-81d1-1bf5ae2b5274
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19226Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19226" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Adds first-class persistent-volume support for AKS environments.
Changes:
- Adds the AKS
AddPersistentVolumeforwarding API. - Adds C#, TypeScript, Java, snapshot, and Azure deployment coverage.
- Documents AKS persistent-volume usage and defaults.
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Hosting.Azure.Kubernetes/AzureKubernetesPersistentVolumeExtensions.cs |
Adds the forwarding API. |
src/Aspire.Hosting.Azure.Kubernetes/Aspire.Hosting.Azure.Kubernetes.csproj |
Enables integration analyzers. |
src/Aspire.Hosting.Azure.Kubernetes/README.md |
Documents persistent volumes. |
tests/Aspire.Hosting.Azure.Kubernetes.Tests/AzureKubernetesPersistentVolumeTests.cs |
Tests parentage and generated claims. |
tests/Aspire.Hosting.Azure.Kubernetes.Tests/Snapshots/AzureKubernetesPersistentVolumeTests.AksAddPersistentVolume_GeneratesClaimUsingClusterDefaults.verified.yaml |
Verifies default claim output. |
tests/Aspire.Deployment.EndToEnd.Tests/AksPersistentVolumeDeploymentTests.cs |
Verifies persistence across AKS redeployment. |
tests/PolyglotAppHosts/Aspire.Hosting/TypeScript/apphost.mts |
Exercises TypeScript bindings. |
tests/PolyglotAppHosts/Aspire.Hosting/Java/AppHost.java |
Exercises Java bindings. |
Review details
Tip
Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 8/8 changed files
- Comments generated: 0
- Review effort level: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
🚀 Deployment tests starting on PR #19226... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
|
🚀 Deployment tests starting on PR #19226... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
I haven't tested this myself. I trust that this has been tested end to end. The dedicated deployment E2E job is still running at the time of this approval.
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
Found one additional blocking issue in the AKS deployment scenario: the default non-root .NET container cannot write to the fresh managed-disk mount without a pod fsGroup. Local publish proof confirmed the generated mount has no security context and the SDK image runs as UID 1654. The existing cleanup thread remains separate.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 650be0fb-e3a4-44d8-81d1-1bf5ae2b5274
|
🚀 Deployment tests starting on PR #19226... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Review details
Suppressed comments (1)
tests/Aspire.Deployment.EndToEnd.Tests/AksPersistentVolumeDeploymentTests.cs:112
- This writes the ephemeral AKS credentials into the caller's default
~/.kube/configand switches its current context. A local test run can therefore leave the developer pointed at a cluster that thefinallyblock deletes. Export a workspace-localKUBECONFIGbefore callingaz aks get-credentials, as the isolated deployment tests do.
$"az aks get-credentials --resource-group {resourceGroupName} --name \"$AKS_NAME\" --overwrite-existing",
- Files reviewed: 8/8 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 650be0fb-e3a4-44d8-81d1-1bf5ae2b5274
|
🚀 Deployment tests starting on PR #19226... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 650be0fb-e3a4-44d8-81d1-1bf5ae2b5274
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Review details
Suppressed comments (1)
tests/Aspire.Deployment.EndToEnd.Tests/AksPersistentVolumeDeploymentTests.cs:47
- Dispose the temporary workspace so its generated project and build artifacts are deleted after the deployment test. As written, every local run leaves the entire workspace behind.
var workspace = TemporaryWorkspace.Create(output);
- Files reviewed: 8/8 changed files
- Comments generated: 0 new
- Review effort level: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 650be0fb-e3a4-44d8-81d1-1bf5ae2b5274
Tests selector (audit mode)The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement. 3 / 100 test projects · 4 jobs, from 7 changed files. Selected test projects (3 / 100)
Selected jobs (4)
How these were chosen — grouped by what changed🔧 🔧 🧪 🧪 🧪 Job reasons
Selection computed for commit |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
/backport to release/13.5 |
|
Started backporting to |
|
Pull request created: #1474
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1474 targeting Added an "Add a persistent volume" section to the AKS integration page ( Note This draft PR needs human review before merging. |
|
The CI build failed due to test failure(s) that appear unrelated to the PR changes. These may be flaky tests. Suspected flaky test(s):
Suggested actions:
You can re-run the failed jobs from the workflow run page. |
Description
AKS users could use Kubernetes persistent volumes only by reaching through to the underlying Kubernetes integration. This change exposes
AddPersistentVolumedirectly onAzureKubernetesEnvironmentResource, so workloads targeting AKS can configure and mount persistent storage through the AKS API.The new API forwards to the AKS environment's existing Kubernetes publisher. When no storage class is specified, the generated claim uses the cluster default; standard AKS clusters dynamically provision an Azure managed disk. Azure Files-specific APIs are intentionally deferred until managed-identity mounting can be modeled securely.
User-facing usage
C# AppHost:
TypeScript AppHost:
The change also adds:
Validation:
dotnet test --project tests/Aspire.Hosting.Azure.Kubernetes.Tests/Aspire.Hosting.Azure.Kubernetes.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"— 69 passed.dotnet build tests/Aspire.Deployment.EndToEnd.Tests/Aspire.Deployment.EndToEnd.Tests.csproj --no-restore— succeeded.Fixes #19210
Checklist
<remarks />and<code />elements on your triple slash comments?