Skip to content

Resolve ${connection:<key>.<prop>} sentinels in container env values - #198

Closed
willdavsmith wants to merge 1 commit into
mainfrom
willdavsmith-containers-connection-sentinel
Closed

Resolve ${connection:<key>.<prop>} sentinels in container env values#198
willdavsmith wants to merge 1 commit into
mainfrom
willdavsmith-containers-connection-sentinel

Conversation

@willdavsmith

Copy link
Copy Markdown
Contributor

What

Teaches the Kubernetes Radius.Compute/containers recipe to resolve ${connection:<key>.<prop>} sentinels placed in a container env value. A new connectionTokens table is built from the same decrypted resourceConnections (and the same exclusions) as the existing connectionEnvVars, then each env value is passed through a reduce(... replace ...) that substitutes any sentinel with the connected resource's real property value. Both top-level connection properties and the nested properties bag are covered.

env: {
  API_KEY: { value: '${connection:provider.apiKey}' }
}

Why

Today an application can only receive connected-resource properties under the fixed CONNECTION_<KEY>_<PROP> names. Apps that expect a specific env var name (e.g. a third-party image) otherwise need a per-app startup shim or a custom image to remap the value. The sentinel lets the app author name the target env var directly and pull any single property — including a sensitive property that is delivered decrypted through connection injection — with no shim and no custom image.

Backward compatibility

  • Env values with no sentinel pass through unchanged.
  • Secrets-resource connections and disableDefaultEnvVars are skipped exactly as for the default connection env vars.

Dependency

The sensitive-value path relies on the connection being delivered decrypted at runtime, which comes from radius-project/radius#12286 (connection-injection decrypt + x-radius-retain). Non-sensitive properties resolve on radius main today; sensitive ones require #12286. Marking this draft until #12286 lands.

Verification

Proven end-to-end by a cloud-free kind-only test in resource-types-verification: a synthetic connected resource exposes a non-sensitive canary and a sensitive (x-radius-sensitive + x-radius-retain) canary; a busybox container consumes both via sentinels. The resolved Deployment-spec env showed the plain canary and the sensitive canary delivered decrypted:

PASS: plain sentinel resolved to the connection value
PASS: sensitive sentinel resolved to the DECRYPTED connection value

Add a connectionTokens table built from the same decrypted resourceConnections
(and the same exclusions) as connectionEnvVars, then resolve any
${connection:<key>.<prop>} sentinel found in a container env `value` to the
connected resource's real property value. Both top-level connection properties
and the nested `properties` bag are covered.

This lets an application reference a specific connected-resource property by name
in an env var — including a sensitive property delivered decrypted through
connection injection — without relying on the fixed CONNECTION_<KEY>_<PROP>
naming, and without a per-app startup shim or custom image.

Backward-compatible: env values that contain no sentinel pass through unchanged,
and secrets-resource connections / disableDefaultEnvVars are skipped exactly as
for the default connection env vars.

Signed-off-by: willdavsmith <willdavsmith@gmail.com>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant