Repository navigation
Add Radius recipe parameters and secret management - #18778
Nell Shamrell-Harrington (nellshamrell) wants to merge 7 commits into
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18778Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18778" |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR introduces Radius “production & platform” capabilities: recipe parameters and secret-store support (including GitOps sealed secrets), plus publishing/deploy pipeline gates and associated tests/documentation.
Changes:
- Add recipe-parameter annotations + Bicep emission (with ParameterResource bindings and provider references).
- Add Radius secret-store resources, validation gate, consumers, and sealed-secret publish/deploy flow (manifest validation, artifact copy, kubectl apply + wait).
- Add extensive test coverage for validation, Bicep output, and sealed-secret deploy behavior.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Aspire.Hosting.Radius/Secrets/SealedSecretManifest.cs | Adds sealed-secret manifest validation + metadata extraction used by publish/deploy. |
| src/Aspire.Hosting.Radius/Publishing/SealedSecretApplyStep.cs | Adds deploy-time kubectl apply + poll gate for sealed secrets. |
| src/Aspire.Hosting.Radius/Secrets/RadiusSecretStoreValidation.cs | Adds fail-fast model validation for secret stores and consumer wiring. |
| src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs | Emits secretStores + recipe parameters into Bicep and deploy bindings. |
| src/Aspire.Hosting.Radius/Publishing/RadiusBicepPublishingContext.cs | Copies validated sealed-secret manifests into the publish artifact. |
| src/Aspire.Hosting.Radius/README.md | Documents recipe parameters and secret management capabilities and diagnostics. |
| tests/Aspire.Hosting.Radius.Tests/** | Adds unit tests for recipe parameters, secret-store validation, Bicep emission, and sealed-secret deploy logic. |
Comments suppressed due to low confidence (1)
src/Aspire.Hosting.Radius/README.md:1
- Code paths in
RadiusInfrastructureBuilderthrowASPIRERADIUS050when an environment references a secret store that is not emitted for that environment. This diagnostic is not currently listed in the README’s “Runtime validation codes” table; please document it (or remove/replace the diagnostic if it’s not intended to be user-facing).
# Radius hosting integration
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
PR Testing ReportPR Information
Artifact Version Verification
Changes AnalyzedChange Categories
Public API surface exercised
Test Scenarios ExecutedScenario 1: Recipe parameters + inline (Radius-created) secret store — happy pathObjective: Confirm recipe-parameter type fidelity and that secret parameter values are never inlined into Bicep. Steps: New file-based AppHost referencing PR hive
Observations (from generated
Scenario 2a:
|
| Scenario | Type | Status | Notes |
|---|---|---|---|
| 1. Recipe params + inline secret store | Happy | ✅ Passed | Type fidelity; secrets via @secure(), never inlined |
| 2a. ASPIRERADIUS062 | Unhappy | ✅ Passed | Materialization timeout on non-sealed store rejected |
| 2b. ASPIRERADIUS041 | Unhappy | ✅ Passed | Two population modes rejected |
| 2c. ASPIRERADIUS054 | Unhappy | ✅ Passed | Gateway TLS on app-scoped store fails closed |
| 3. Secret-store consumers | Happy | ✅ Passed | recipeConfig authentication + envSecrets reference store .id |
Notes / Minor Observations
- App-scoped secret store with no
AddRadiusEnvironmentis a silent no-op: the secret-store validation
gate is registered byRadiusEnvironmentResource, so an AppHost that addsAddRadiusSecretStore(...)but
no Radius environment publishes successfully (4/4 steps) with the store neither validated nor emitted.
This matches the "Radius participates only when an environment is present" model, but a user who forgets
the environment gets no diagnostic. Non-blocking; worth considering a warning in a follow-up. - Gateway TLS is unreachable by design in this release:
WithSecretStorereturns an environment
builder, so the onlyIResourceBuilder<RadiusSecretStoreResource>obtainable (viaAddRadiusSecretStore)
is application-scoped and rejected byWithTlsCertificate(054). Consistent with the README "not yet supported (060)".
Overall Result
✅ PR VERIFIED
All 5 scenarios (2 happy-path, 3 unhappy-path) passed against the dogfood PR CLI at head 426f90ee.
Recipe-parameter type fidelity, secret non-inlining (@secure()), consumer recipeConfig wiring, and the
new config-time/publish validation gates (041/054/062) all behave as documented. The 307-test unit suite is
also green. Sealed-secret deploy-time paths (cluster-dependent) were out of scope for this environment.
Recommendations
- Consider a warning when a Radius secret store is declared without any
AddRadiusEnvironment(silent no-op today).
Second slice of the Aspire→Radius integration, layered on the merged compute-environment baseline (microsoft#18696). Recipe parameters (`WithRecipeParameters`): - Flow environment-wide and resource-type-scoped values onto the recipe pack and legacy environment recipe entries. - ParameterResource-backed values emit as valueless `@secure()` Bicep params bound at deploy time; provider references resolve at publish. - ASPIRERADIUS028 guards recipe-parameter identifier collisions. Secret management (gated behind experimental ASPIRERADIUS006): - `AddRadiusSecretStore` / `WithSecretStore` with inline, existing-secret, and sealed-secret population modes plus `recipeConfig` consumers. - Sealed secrets are applied via a dedicated pipeline step after publish and before deploy; secret values are never inlined into Bicep. - Validation surfaces actionable ASPIRERADIUS040–055 diagnostics. Recipe and secret parameters are unified with the existing container env-var parameter registry so a parameter shared across both emits a single Bicep `param` and one deploy binding; distinct parameters whose names collide to the same identifier fail loudly (ASPIRERADIUS056) rather than silently misbinding. Co-authored-by: Copilot <[email protected]> Copilot-Session: f19583f4-384b-4601-a94b-290d9b0d4ed5
Address four findings from the code review of the sealed-secret path: - Replace the regex/line-oriented SealedSecret manifest validator with a YamlDotNet parser. Reject duplicate keys, multi-document/non-mapping roots, anchors/aliases/merge keys, top-level data/stringData, and non-empty spec.template.data so a plaintext Kubernetes Secret can no longer be smuggled past validation into published artifacts or applied to a cluster. - Close the validate/copy TOCTOU: read and validate the manifest once, carry the validated bytes, and write those exact bytes into the artifact instead of re-reading the source file. - Gate the deploy-time materialization wait on the SealedSecret's status (observedGeneration match + Synced=True) before confirming the Secret, so a redeploy no longer proceeds with a stale Secret. Fast-fail on Synced=False or generation advance, enforce a per-probe remaining-time budget, and fail with ASPIRERADIUS058 on timeout. Raw kubectl -o json output is never logged. - Fail closed (ASPIRERADIUS059) when the active rad workspace's Kubernetes context cannot be resolved, instead of silently using kubectl's ambient context, with an ASPIRE_RADIUS_KUBE_CONTEXT override escape hatch. Update the README diagnostics table (broaden 044; add 058/059) and add tests. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9
…tic doc Address review feedback on the Radius secret-store API: - Rename FromExistingSecret/FromSealedSecret to WithExistingSecret/ WithSealedSecret so the configuration methods follow Aspire's With* convention (they configure an existing resource builder). Update all call sites, XML docs, validation messages, README examples, and tests. - Remove the retired ASPIRERADIUS046 entry from the README diagnostics table; its "sealed Secret never materialized before deploy" meaning is now covered by the status-gated ASPIRERADIUS058. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9
Fixes five design findings surfaced by architecture/hosting/api reviews on the Radius recipe & secret-store surface: 1. Gateway TLS (WithTlsCertificate) now fails loud instead of silently dropping: rejected at the validation gate (ASPIRERADIUS060), with a defensive throw at emission. 2. Remove the unusable WithTerraformProviderSecret API (and its enum member, ASPIRERADIUS053 validation, emission case, test, and README refs). 3. Restrict WithMaterializationTimeout to sealed stores: reject an explicit override on a non-sealed store (ASPIRERADIUS062). 4. Validate declared keys exist in the materialized sealed Secret at deploy (ASPIRERADIUS061); Secret values are never logged, only key names read. 5. ATS export conformance: add Reason to every [AspireExportIgnore] on the new Radius surface and [ResourceName] to the secret-store name params. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9
- SealedSecretManifest.ValidateStructure: guard Stack.Pop() on MappingEnd/ SequenceEnd so a malformed or out-of-sync YAML event stream fails as ASPIRERADIUS044 instead of escaping as a raw InvalidOperationException. - README: use the modern canonical resource-type string Radius.Data/redisCaches in the recipe-parameter scoping example (matches WithRecipeParametersTests and RadiusResourceTypes.RedisCaches); Applications.Datastores/redisCaches is only the legacy fallback emission type. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9
abd3cae to
52bd211
Compare
WaitForSealedSecretSynced_StatusMatchesButSecretAbsent_KeepsWaitingThenTimesOut used a 10ms wall-clock timeout and asserted secretCalls > 1. On a loaded CI runner a slow cold-JIT first iteration could consume the whole 10ms budget before a second poll, so only one secretExists call happened and the assertion failed. The probe now reports the Secret absent on the first call (so the loop keeps waiting past one iteration) and hangs on the second so the SUT's remaining-budget guard cancels it and surfaces the real ASPIRERADIUS058 timeout, guaranteeing at least two polls regardless of runner speed. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 40 out of 40 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
src/Aspire.Hosting.Radius/README.md:1
- The code now throws
ASPIRERADIUS050inRadiusInfrastructureBuilder.ResolveSecretStoreReference(...)when an environment references a secret store that is not emitted for that environment, but this diagnostic code does not appear in the README’s “Runtime validation codes” table (which lists 028, 040–062, 056, etc.). Add an entry forASPIRERADIUS050(area: publish; meaning: secret-store consumer references a store not routed/emitted for the environment) so users can look it up and understand remediation.
# Radius hosting integration
| var declaredKeys = population.HasInlineData | ||
| ? population.Data.Keys.ToList() | ||
| : population.Keys; |
| // ASPIRERADIUS040 — type-aware required keys. | ||
| foreach (var required in store.Type.RequiredKeys()) | ||
| { | ||
| if (!declaredKeys.Contains(required, StringComparer.Ordinal)) | ||
| { | ||
| throw new InvalidOperationException( | ||
| $"Secret store '{store.Name}' of type '{store.Type.ToRadiusTypeString()}' is missing " + | ||
| $"the required key '{required}'. Diagnostic: ASPIRERADIUS040."); | ||
| } | ||
| } |
| // Scope is implied by the declaring API form: application-scoped stores reference the | ||
| // application; environment-scoped stores reference the environment. | ||
| if (store.Scope == RadiusSecretStoreScope.Application && legacyAppConstruct is not null) | ||
| { | ||
| construct.ApplicationId = BuildIdExpression(legacyAppConstruct); | ||
| } | ||
| else if (legacyEnvConstruct is not null) | ||
| { | ||
| construct.EnvironmentId = BuildIdExpression(legacyEnvConstruct); | ||
| } |
| private static async Task<long> ApplyManifestAsync(string manifestPath, string? @namespace, string? kubeContext, ILogger logger, CancellationToken cancellationToken) | ||
| { | ||
| var args = BuildApplyArgs(manifestPath, kubeContext, @namespace); | ||
| var (exitCode, stdout, stderr) = await RunKubectlAsync(args, logger, cancellationToken, logStdout: false).ConfigureAwait(false); | ||
| if (exitCode != 0) | ||
| { | ||
| throw new InvalidOperationException( | ||
| $"'kubectl apply -f {manifestPath}' failed with exit code {exitCode}: {stderr.Trim()}"); | ||
| } |
| internal static string RelativePath(string storeName, string sourceManifestPath) => | ||
| Path.Combine(RootDirectoryName, storeName, Path.GetFileName(sourceManifestPath)); |
…ostics Address re-review feedback on PR microsoft#18778: - SealedSecretManifest.ReadValidated: File.ReadAllBytes can throw ArgumentException (empty/whitespace/invalid-character path) and PathTooLongException, which previously escaped the catch filter without the ASPIRERADIUS044 wrapping promised by the XML-doc/README contract. Broaden the filter so every unreadable-manifest failure normalizes to ASPIRERADIUS044. - SealedSecretApplyStep.ParseGeneration: the "did not return metadata.generation" throw omitted the SealedSecret/store identity and a diagnostic code. Thread the store name + namespace/name through and map the failure to ASPIRERADIUS058 for consistent triage. Adds targeted tests for both paths. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9
| var requiredType = consumer.Kind switch | ||
| { | ||
| RadiusSecretStoreConsumerKind.BicepRegistryAuth => (RadiusSecretStoreType?)RadiusSecretStoreType.BasicAuthentication, | ||
| RadiusSecretStoreConsumerKind.TerraformGitPat => RadiusSecretStoreType.BasicAuthentication, |
| ? store.Population.Data.Keys.ToList() | ||
| : store.Population.Keys; | ||
|
|
||
| if (declaredKeys.Count > 0 && !declaredKeys.Contains(key, StringComparer.Ordinal)) |
| foreach (var c in name) | ||
| { | ||
| if (!(char.IsAsciiLetterOrDigit(c) || c is '-' or '_' or '.')) | ||
| { |
| public static IResourceBuilder<T> WithTlsCertificate<T>( | ||
| this IResourceBuilder<T> gateway, | ||
| IResourceBuilder<RadiusSecretStoreResource> store) | ||
| where T : IResource |
| s.WithExistingSecret("app/tls-cert", "tls.crt", "tls.key")); | ||
|
|
||
| // GitOps sealed secrets — the encrypted manifest is applied before rad deploy and awaited. | ||
| radius.WithSecretStore("db-creds", RadiusSecretStoreType.BasicAuthentication, s => |
|
Closing while I land a fix to the E2E Radius tests first, will re-open later. |
…ostics Address re-review feedback on PR microsoft#18778: - SealedSecretManifest.ReadValidated: File.ReadAllBytes can throw ArgumentException (empty/whitespace/invalid-character path) and PathTooLongException, which previously escaped the catch filter without the ASPIRERADIUS044 wrapping promised by the XML-doc/README contract. Broaden the filter so every unreadable-manifest failure normalizes to ASPIRERADIUS044. - SealedSecretApplyStep.ParseGeneration: the "did not return metadata.generation" throw omitted the SealedSecret/store identity and a diagnostic code. Thread the store name + namespace/name through and map the failure to ASPIRERADIUS058 for consistent triage. Adds targeted tests for both paths. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9
…ostics Address re-review feedback on PR microsoft#18778: - SealedSecretManifest.ReadValidated: File.ReadAllBytes can throw ArgumentException (empty/whitespace/invalid-character path) and PathTooLongException, which previously escaped the catch filter without the ASPIRERADIUS044 wrapping promised by the XML-doc/README contract. Broaden the filter so every unreadable-manifest failure normalizes to ASPIRERADIUS044. - SealedSecretApplyStep.ParseGeneration: the "did not return metadata.generation" throw omitted the SealedSecret/store identity and a diagnostic code. Thread the store name + namespace/name through and map the failure to ASPIRERADIUS058 for consistent triage. Adds targeted tests for both paths. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9
…ostics Address re-review feedback on PR microsoft#18778: - SealedSecretManifest.ReadValidated: File.ReadAllBytes can throw ArgumentException (empty/whitespace/invalid-character path) and PathTooLongException, which previously escaped the catch filter without the ASPIRERADIUS044 wrapping promised by the XML-doc/README contract. Broaden the filter so every unreadable-manifest failure normalizes to ASPIRERADIUS044. - SealedSecretApplyStep.ParseGeneration: the "did not return metadata.generation" throw omitted the SealedSecret/store identity and a diagnostic code. Thread the store name + namespace/name through and map the failure to ASPIRERADIUS058 for consistent triage. Adds targeted tests for both paths. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9
…ostics Address re-review feedback on PR microsoft#18778: - SealedSecretManifest.ReadValidated: File.ReadAllBytes can throw ArgumentException (empty/whitespace/invalid-character path) and PathTooLongException, which previously escaped the catch filter without the ASPIRERADIUS044 wrapping promised by the XML-doc/README contract. Broaden the filter so every unreadable-manifest failure normalizes to ASPIRERADIUS044. - SealedSecretApplyStep.ParseGeneration: the "did not return metadata.generation" throw omitted the SealedSecret/store identity and a diagnostic code. Thread the store name + namespace/name through and map the failure to ASPIRERADIUS058 for consistent triage. Adds targeted tests for both paths. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9
* Add Radius recipe parameters and secret management Second slice of the Aspire→Radius integration, layered on the merged compute-environment baseline (#18696). Recipe parameters (`WithRecipeParameters`): - Flow environment-wide and resource-type-scoped values onto the recipe pack and legacy environment recipe entries. - ParameterResource-backed values emit as valueless `@secure()` Bicep params bound at deploy time; provider references resolve at publish. - ASPIRERADIUS028 guards recipe-parameter identifier collisions. Secret management (gated behind experimental ASPIRERADIUS006): - `AddRadiusSecretStore` / `WithSecretStore` with inline, existing-secret, and sealed-secret population modes plus `recipeConfig` consumers. - Sealed secrets are applied via a dedicated pipeline step after publish and before deploy; secret values are never inlined into Bicep. - Validation surfaces actionable ASPIRERADIUS040–055 diagnostics. Recipe and secret parameters are unified with the existing container env-var parameter registry so a parameter shared across both emits a single Bicep `param` and one deploy binding; distinct parameters whose names collide to the same identifier fail loudly (ASPIRERADIUS056) rather than silently misbinding. Co-authored-by: Copilot <[email protected]> Copilot-Session: f19583f4-384b-4601-a94b-290d9b0d4ed5 * Harden Radius sealed-secret handling from code-review findings Address four findings from the code review of the sealed-secret path: - Replace the regex/line-oriented SealedSecret manifest validator with a YamlDotNet parser. Reject duplicate keys, multi-document/non-mapping roots, anchors/aliases/merge keys, top-level data/stringData, and non-empty spec.template.data so a plaintext Kubernetes Secret can no longer be smuggled past validation into published artifacts or applied to a cluster. - Close the validate/copy TOCTOU: read and validate the manifest once, carry the validated bytes, and write those exact bytes into the artifact instead of re-reading the source file. - Gate the deploy-time materialization wait on the SealedSecret's status (observedGeneration match + Synced=True) before confirming the Secret, so a redeploy no longer proceeds with a stale Secret. Fast-fail on Synced=False or generation advance, enforce a per-probe remaining-time budget, and fail with ASPIRERADIUS058 on timeout. Raw kubectl -o json output is never logged. - Fail closed (ASPIRERADIUS059) when the active rad workspace's Kubernetes context cannot be resolved, instead of silently using kubectl's ambient context, with an ASPIRE_RADIUS_KUBE_CONTEXT override escape hatch. Update the README diagnostics table (broaden 044; add 058/059) and add tests. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9 * Rename secret-store population methods to With* and fix stale diagnostic doc Address review feedback on the Radius secret-store API: - Rename FromExistingSecret/FromSealedSecret to WithExistingSecret/ WithSealedSecret so the configuration methods follow Aspire's With* convention (they configure an existing resource builder). Update all call sites, XML docs, validation messages, README examples, and tests. - Remove the retired ASPIRERADIUS046 entry from the README diagnostics table; its "sealed Secret never materialized before deploy" meaning is now covered by the status-gated ASPIRERADIUS058. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9 * Address Radius secret-store design-review findings Fixes five design findings surfaced by architecture/hosting/api reviews on the Radius recipe & secret-store surface: 1. Gateway TLS (WithTlsCertificate) now fails loud instead of silently dropping: rejected at the validation gate (ASPIRERADIUS060), with a defensive throw at emission. 2. Remove the unusable WithTerraformProviderSecret API (and its enum member, ASPIRERADIUS053 validation, emission case, test, and README refs). 3. Restrict WithMaterializationTimeout to sealed stores: reject an explicit override on a non-sealed store (ASPIRERADIUS062). 4. Validate declared keys exist in the materialized sealed Secret at deploy (ASPIRERADIUS061); Secret values are never logged, only key names read. 5. ATS export conformance: add Reason to every [AspireExportIgnore] on the new Radius surface and [ResourceName] to the secret-store name params. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9 * Address Copilot review feedback on Radius secret stores - SealedSecretManifest.ValidateStructure: guard Stack.Pop() on MappingEnd/ SequenceEnd so a malformed or out-of-sync YAML event stream fails as ASPIRERADIUS044 instead of escaping as a raw InvalidOperationException. - README: use the modern canonical resource-type string Radius.Data/redisCaches in the recipe-parameter scoping example (matches WithRecipeParametersTests and RadiusResourceTypes.RedisCaches); Applications.Datastores/redisCaches is only the legacy fallback emission type. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9 * Make sealed-secret timeout test deterministic (fix CI flake) WaitForSealedSecretSynced_StatusMatchesButSecretAbsent_KeepsWaitingThenTimesOut used a 10ms wall-clock timeout and asserted secretCalls > 1. On a loaded CI runner a slow cold-JIT first iteration could consume the whole 10ms budget before a second poll, so only one secretExists call happened and the assertion failed. The probe now reports the Secret absent on the first call (so the loop keeps waiting past one iteration) and hangs on the second so the SUT's remaining-budget guard cancels it and surfaces the real ASPIRERADIUS058 timeout, guaranteeing at least two polls regardless of runner speed. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9 * Normalize manifest-path and apply-generation failures to Radius diagnostics Address re-review feedback on PR #18778: - SealedSecretManifest.ReadValidated: File.ReadAllBytes can throw ArgumentException (empty/whitespace/invalid-character path) and PathTooLongException, which previously escaped the catch filter without the ASPIRERADIUS044 wrapping promised by the XML-doc/README contract. Broaden the filter so every unreadable-manifest failure normalizes to ASPIRERADIUS044. - SealedSecretApplyStep.ParseGeneration: the "did not return metadata.generation" throw omitted the SealedSecret/store identity and a diagnostic code. Thread the store name + namespace/name through and map the failure to ASPIRERADIUS058 for consistent triage. Adds targeted tests for both paths. Co-authored-by: Copilot <[email protected]> Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9 * Address code-review findings in Radius recipes + secrets Fixes findings from code-review, rubber-duck, security, architecture, and hosting-integration-authoring passes on the recipe-parameter and secret-store work in Aspire.Hosting.Radius. Secret handling: - Reject plaintext `kind: Secret` embedded in a SealedSecret's last-applied-configuration annotation; fail closed on malformed/non-scalar annotation values and non-object data/stringData (ASPIRERADIUS063). - Require an explicit metadata.namespace for application-scoped sealed stores so the namespace can't silently diverge per environment (ASPIRERADIUS055). - Bound the kubectl apply/sync/verify sequence with a shared timeout budget (ASPIRERADIUS066); tolerate transient/NotFound `kubectl get sealedsecret` failures during polling instead of aborting the deploy. - Reject key-specific envSecret consumers against keyless stores (ASPIRERADIUS064) and repeated population of a store (ASPIRERADIUS065); validate keys before mutating so a bad first key can't poison a retry. - Fire the targeted duplicate-identifier diagnostic (ASPIRERADIUS048) for app-vs-env Bicep identifier collisions, matching the actual emission scope. Recipe parameters: - Convert ParameterResource/RadiusProviderReference nested inside recipe parameter objects/arrays recursively so they stay late-bound, with cycle and depth guards. Cleanup: - Remove the dead WithTlsCertificate/GatewayTls consumer API and stale gateway-TLS doc comments. Adds unit tests for each finding and updates the README diagnostics table. Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3 * Address PR #18834 review feedback for Radius secrets Harden and tighten the Radius secret-store surface in response to Copilot review comments: - SealedSecretManifest: fail closed in EmbedsPlaintextSecret when the embedded last-applied-configuration has duplicate/missing/non-string kind or duplicate data/stringData, so a crafted payload cannot smuggle plaintext past a single TryGetProperty lookup. - WithSealedSecret: resolve a relative manifest path against the AppHost directory (matching other hosting file APIs) so it works regardless of the process working directory. - RadiusSecretStoreNaming: align the store-name grammar with Aspire's resource-name grammar (letters/digits/hyphens, start-with-letter, no consecutive/trailing hyphen, <=64) so publish mode (AddResource) never rejects a name run mode accepted. Update the ASPIRERADIUS049 message. - WithData: add a single-key convenience overload binding a data key to a secret parameter, delegating transactionally to the callback form. - SealedSecretApplyStep.GetSealedSecretStatusAsync: only treat SealedSecret NotFound or transient connectivity failures as retryable; surface permanent kubectl failures (auth/RBAC/context/missing plugin) immediately instead of waiting out the whole materialization budget. Adds 22 targeted tests (357 total, all passing). Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3 * Address Radius re-review: Terraform Git PAT key requirement, duplicate inline key rejection, existing-secret reference validation Re-review of PR #18834 raised three additional findings on the Radius secret-store surface: - Terraform Git PAT auth now requires the referenced store to declare a 'pat' key (optionally 'username'), matching what Radius reads for recipeConfig.terraform.authentication.git.pat, instead of accepting a basicAuthentication username/password store it cannot use (ASPIRERADIUS051). - RadiusSecretStoreDataBuilder.Add rejects a duplicate inline key via TryAdd instead of silently overwriting through the dictionary indexer, so a double-declared key surfaces at the call site (ASPIRERADIUS043). - WithExistingSecret validates the '[namespace/]name' reference at the API boundary (single separator, DNS-1123 name/namespace) rather than deferring a malformed reference to deploy time (ASPIRERADIUS046). Adds targeted tests and updates the README diagnostics table and xmldoc. Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3 * Address Radius re-review: rewire secret stores on rename, bound materialization timeout, validate sealed manifest names A second re-review round on PR #18834 raised three findings: - ConfigureRadiusInfrastructure exposes secret stores (opts.SecretStores), but the identifier snapshot/rewire logic ignored them. Renaming a store construct left recipeConfig referencing the old <identifier>.id, and renaming the legacy application/environment left the store's ApplicationId/EnvironmentId pointing at stale symbols. Extended IdentifierSnapshot and added RewireSecretStoreReferences to rewrite both consumer references and parent scope IDs. - WithMaterializationTimeout accepted values above int.MaxValue milliseconds (e.g. TimeSpan.MaxValue) that CancellationTokenSource.CancelAfter / the deploy deadline cannot represent, so they passed publish validation but threw at deploy. Reject them at configuration time. - SealedSecret manifest parsing accepted any nonblank metadata.name (e.g. Bad_Name, a/b, an overlong namespace), deferring the failure to kubectl apply. Validate the name as a DNS-1123 subdomain and any explicit namespace as a DNS-1123 label at publish time, mirroring the WithExistingSecret fast-fail. Extracted the DNS-1123 helpers into a shared KubernetesName class and added tests for all three findings. Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3 * Address Radius PR re-review round B (R1-R6) - WithExistingSecret validates reference and keys before marking the store populated so a corrected retry is not blocked by ASPIRERADIUS065 (R1). - Reject secret data keys that are not valid Kubernetes Secret keys at the API boundary for inline/existing/sealed populations (ASPIRERADIUS067) (R2). - rad workspace kube-context fallback now returns the single distinct context only; multiple contexts fail closed instead of guessing (R3). - Application-scoped store declared without any Radius environment now fails fast via a store-registered pipeline gate (ASPIRERADIUS068) (R4). - Add remarks/example xmldoc to AddRadiusSecretStore and WithRecipeParameters (R5/R6). Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3 * Address Radius PR re-review rounds B2/B3 (N1-N8) - IsValidSecretDataKey now matches apimachinery IsConfigMapKey semantics: reject keys >253 chars, '.'/'..', and keys starting with '..' (N1). - IsTransientKubectlFailure no longer treats permanent x509 TLS trust failures as retryable; they fail fast instead of polling to the sync timeout (N2). - Secret-store validation test uses Directory.CreateTempSubdirectory (N3). - SealedSecret manifest requires the exact bitnami.com/v1alpha1 group/version instead of a bitnami.com/ prefix (N4). - Embedded SealedSecret in last-applied-configuration is now validated recursively for plaintext spec.template.data/stringData (ASPIRERADIUS063) (N5). - Recipe-parameter Merge validates all keys before applying (transactional) (N6). - Deploy-parameters test now exercises the production WriteDeployParametersFile helper and asserts the owner-only ARM JSON file contract (N7). - README secret-store diagnostics range lists only secret-store codes and notes 056/057 are separate and 053/054/060 retired (N8). Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3 * Parse rad workspace config with YamlDotNet in SealedSecretApplyStep The hand-rolled line/regex parser in ParseActiveWorkspaceContext did not honor real YAML syntax, so valid rad configs (trailing inline comments on values such as `default: prod # active`, quoted mapping keys, or flow-style mappings) failed to resolve the active workspace context and aborted every SealedSecret deployment with ASPIRERADIUS059 unless the override was set. Parse ~/.rad/config.yaml with YamlDotNet (already a dependency), reading workspaces.default then workspaces.items.<default>.connection.context, and keep the fail-closed behavior for missing/ambiguous values (default present but context missing -> null; no default -> single distinct context only). Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3 * Address PR review feedback on Radius secret stores - SealedSecret apply: close TOCTOU by streaming the exact validated manifest bytes to `kubectl apply -f -` over stdin instead of re-reading the (mutable) manifest path. - Reject uppercase inline secret-store names: the name is used verbatim as the backing Kubernetes Secret name (DNS-1123), so require lowercase to fail fast at the API/publish boundary instead of at deploy. - ASPIRERADIUS067: include the 253-char limit and `.`/`..` prefix restrictions in the invalid-secret-data-key message. Co-authored-by: Copilot <[email protected]> Copilot-Session: a79a2e75-6c34-40f1-8b75-dcd5ca8b2b16 * Address PR re-review on Radius sealed-secret deploy/publish - SecretExistsAsync: treat transient connectivity/apiserver failures as "keep polling" (like the status probe) so a brief blip after Synced=True no longer aborts an otherwise healthy deploy. Refactored to an injectable overload and added unit coverage. - RunKubectlAsync: stream stdin inside the same cancellation handler as WaitForExitAsync so a cancel while writing/flushing stdin terminates the kubectl process tree instead of leaking it. - CopySealedSecretManifests: clear the integration-owned sealed-secrets subtree before writing so republishing after a store is removed or renamed no longer retains obsolete encrypted manifests. Co-authored-by: Copilot <[email protected]> Copilot-Session: a79a2e75-6c34-40f1-8b75-dcd5ca8b2b16 * Validate spec.encryptedData in SealedSecret manifests A SealedSecret with a missing, scalar, empty, or plaintext-looking spec.encryptedData previously passed publish validation and was copied verbatim into the artifact, even though that path promises a structurally valid encrypted manifest. Require spec to be a mapping containing a non-empty spec.encryptedData mapping whose values are non-empty standard-base64 scalars, failing with ASPIRERADIUS044. The gate runs after the existing plaintext and last-applied-configuration leak checks so a leaking manifest still reports the more specific ASPIRERADIUS063. Co-authored-by: Copilot <[email protected]> Copilot-Session: 8674d1f9-7353-40df-b64d-31803c6dbdd3 --------- Co-authored-by: Copilot <[email protected]> Copilot-Session: f19583f4-384b-4601-a94b-290d9b0d4ed5 Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9 Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3 Copilot-Session: a79a2e75-6c34-40f1-8b75-dcd5ca8b2b16 Copilot-Session: 8674d1f9-7353-40df-b64d-31803c6dbdd3
Description
This is the second slice of the Aspire→Radius integration, layered on the merged compute-environment baseline (#18696). It adds two independent, opt-in capabilities, plus hardening from code-review and architectural/API design review.
Recipe parameters —
WithRecipeParameters(...)Flow platform/recipe configuration values from the AppHost to the Radius recipe pack:
ParameterResource-backed values emit as valueless@secure()Bicep params bound at deploy time — values are never inlined into the generated Bicep.RadiusProviderReference.AwsRegion) resolve at publish.ASPIRERADIUS028guards recipe-parameter identifier collisions with an actionable message.Secret management (experimental —
ASPIRERADIUS006)AddRadiusSecretStore/WithSecretStoremodel Radius secret stores with three population modes andrecipeConfigconsumers:WithData), existing cluster secrets (WithExistingSecret), and sealed secrets (WithSealedSecret, applied via a dedicated pipeline step after publish and before deploy).ASPIRERADIUS040–062diagnostics with actionable messages.Hardening (review follow-ups on this branch)
Subsequent commits address code-review and design-review findings:
044); deploy waits on the controller'sSyncedstatus for the applied generation before checking theSecret(058); the kube-context is resolved from the activeradworkspace and fails closed rather than applying tokubectl's ambient context (059, overridable viaASPIRE_RADIUS_KUBE_CONTEXT); declared keys are verified to exist in the materializedSecret(061); rawkubectlJSON containing secret material is never logged.WithTlsCertificate) is rejected until Radius gateways are modeled (060);WithMaterializationTimeoutis restricted to sealed stores (062); the unusableWithTerraformProviderSecretAPI was removed.[AspireExportIgnore]on the new surface carries aReason, and secret-store name params carry[ResourceName].SealedSecretManifest.ValidateStructurenow guards the mapping/sequence stack so malformed YAML fails asASPIRERADIUS044instead of a rawInvalidOperationException; the recipe-parameter README example uses the modern canonical typeRadius.Data/redisCaches; and the sealed-secret materialization-timeout test was made deterministic (removing a wall-clock flake).Design notes
paramwith one deploy binding. Two distinct parameters whose names normalize to the same Bicep identifier fail loudly withASPIRERADIUS056rather than silently misbinding.options.Parametersemission, the secure-parameters deploy path) is preserved unchanged.Testing
Aspire.Hosting.Radius.Testspass (307 tests), including new coverage for recipe parameters, all three secret-store modes, sealed-secret publish/apply/materialization, deploy-parameter unification, fail-closed kube-context resolution, declared-key validation, and identifier-collision regression cases.srcand test projects build clean under warnings-as-errors.Follow-up
Gateway TLS emission (Radius gateways), multiple Radius resource groups, and per-instance recipe/type customization (
PublishAsRadiusResource) are intentionally not in this PR and are planned for follow-up releases.Checklist
<remarks />and<code />elements on your triple slash comments?