feat: add PPM authenticated repos via Identity Federation#112
feat: add PPM authenticated repos via Identity Federation#112ian-flores wants to merge 3 commits intomainfrom
Conversation
Enable Connect and Workbench to authenticate against PPM using Kubernetes Identity Federation (RFC 8693 token exchange). Adds OIDC and Identity Federation config types for PPM, shared token exchange init container and sidecar helpers, and opt-in AuthenticatedRepos flag on Connect/Workbench specs.
All 8 findings addressed. Build passes and tests pass. Here's the summary: Changes: - Install curl and jq in token exchange script (`apk add --no-cache`) so alpine:3 default image works - Add null/empty token validation after jq extraction to fail fast instead of writing "null" as password - Add `OIDCAudience` field to `SiteSpec` so OIDC audience is configurable (defaults to `sts.amazonaws.com` for backwards compatibility) - Revert `AutomountServiceAccountToken` to `ptr.To(false)` in Connect — projected volume works independently - Add `PPMAuthImage` to `InternalConnectSpec` and `InternalWorkbenchSpec` and propagate from Site controllers - Add gcfg injection validation for `IdentityFederation` Name (reject `"`, `]`, newlines) - Add `cleanupPPMAuthConfigMap` to delete the ConfigMap when authenticated repos feature is disabled - Add `SanitizePPMUrl` helper to strip existing scheme before prepending `https://`, preventing double-prefix
|
Claude finished @ian-flores's task —— View job Review: feat: add PPM authenticated repos via Identity Federation
OverallWell-structured feature. The separation of concerns (shared helpers in Below are findings organized by severity. Critical: Audience mismatch between projected SA token and Identity Federation config
These must match for the token exchange to succeed. If the PPM-side
Important: Shell script installs packages at runtime
Consider using a Posit-owned image with Important: Sidecar exits on transient token refresh failure
Consider: if [ "${MODE}" = "sidecar" ]; then
while true; do
sleep "$REFRESH_INTERVAL"
exchange_token || echo "WARNING: token refresh failed, will retry" >&2
done
fiImportant: Connect sets
|
Description
Enable Connect and Workbench to authenticate against PPM using Kubernetes Identity Federation (RFC 8693 token exchange). When
authenticatedRepos: trueis set on a product spec, the operator automatically injects init container + sidecar pods that exchange K8s projected service account tokens for PPM API tokens, writing netrc/curlrc files for Python and R package installation.Issue
Code Flow
Authentication Flow
Key Components
PPM OIDC Config Types (
package_manager_config.go): NewPackageManagerOIDCConfigandPackageManagerIdentityFederationConfigstructs. ExtendedGenerateGcfg()to emit named[IdentityFederation "connect"]sections.Token Exchange Helpers (
ppm_auth.go): Shared functions for init container, sidecar container, volumes, volume mounts, and env vars. Shell script in ConfigMap does the token exchange via curl+jq on alpine:3.Product Integration (
connect.go,workbench.go): WhenAuthenticatedRepos=true, adds projected SA token volume, shared emptyDir, script ConfigMap volume, init container, sidecar container, NETRC + CURL_HOME env vars.Site Controller (
site_controller.go): Creates{site}-ppm-auth-scriptConfigMap when any product has authenticated repos enabled. Auto-configures Identity Federation entries on PPM based on product flags.OIDC Client Secret Mount (
packagemanager_types.go,package_manager.go): Mounts the OIDC client secret at/etc/rstudio-pm/oidc-client-secretvia SecretProviderClass (AWS) or K8s Secret volume (K8s).Category of change
Checklist
just testand all tests pass