Files
OpenShell/providers/google-cloud.yaml
Philippe Martin df15133c89 refactor(providers)!: declare imported profile behavior safely
Move non-secret environment defaults and discovery keys into bounded profile
declarations. Validate credential collisions and required platform adapters,
and keep profile revision encoding deterministic.

Preserve sandbox template and spec environment values, including empty values,
over non-secret profile defaults in both launch paths. Keep provider credential
placeholders authoritative. Allow identical non-secret values from attached
providers while rejecting conflicting values and credential key collisions.

Never expose GOOGLE_SERVICE_ACCOUNT_KEY through credentials or non-secret
defaults, including older stored profiles. Omit stale private-key records
without withholding remaining Vertex tokens or SDK configuration. Remove
ID-selected adapters and orphaned GCP metadata helpers; document migration
and compatible example imports.

Closes #3442

BREAKING CHANGE: Google Cloud and Vertex profiles must declare their
environment and discovery effects. The Google Cloud metadata profile requires
the currently unavailable gcp-metadata adapter. Configure Vertex private key
material through credential refresh instead of GOOGLE_SERVICE_ACCOUNT_KEY.

Signed-off-by: Philippe Martin <phmartin@redhat.com>
2026-10-08 08:30:22 +02:00

102 lines
4.1 KiB
YAML

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Example provider profile. OpenShell does not load it; import it explicitly:
# openshell provider profile lint -f providers/google-cloud.yaml
# openshell provider profile import -f providers/google-cloud.yaml --global
#
# Copy and edit this file rather than importing it unchanged. `binaries` is the
# least-privilege control that decides which processes may reach the endpoints
# below, so it has to name the paths in *your* image.
#
# Client binaries: none declared — this profile grants no egress.
# Reference layout: requires the gcp-metadata platform adapter, provided by
# the supervisor for Linux sandboxes. Windows/MXC does not
# provide this service.
# Credential scope: a gateway-refreshed GCP access token, as GCP_SA_ACCESS_TOKEN
# (service-account JWT flow) or GCP_ADC_ACCESS_TOKEN (gcloud
# ADC flow). Configure the refresh material with
# `openshell provider refresh configure`; the private key and
# refresh token stay at the gateway and are never injected.
# Endpoint access: none. The profile declares no endpoints, so it grants no
# network access on its own. Add the Google API hosts your
# workload needs to the sandbox policy, or import a profile
# that declares them.
# Smoke test: openshell sandbox create --provider <name> -- \
# gcloud auth print-access-token
id: google-cloud
display_name: Google Cloud (GCP APIs)
description: Native GCP SDK credentials for sandboxes via metadata emulator
category: other
inference_capable: false
required_platform_adapter: gcp-metadata
environment:
config:
GCP_PROJECT_ID: project_id
GOOGLE_CLOUD_PROJECT: project_id
CLOUD_ML_REGION: region
GCP_LOCATION: region
GCP_SERVICE_ACCOUNT_EMAIL: service_account_email
fixed:
GCE_METADATA_HOST: "127.0.0.1:8174"
GCE_METADATA_IP: "127.0.0.1:8174"
METADATA_SERVER_DETECTION: assume-present
credentials:
# Service account JWT flow: gateway signs a JWT and exchanges it for an
# access token. Configure with `openshell provider refresh configure`.
- name: service_account_token
description: GCP access token minted from service account JWT
env_vars: [GCP_SA_ACCESS_TOKEN]
required: false
auth_style: bearer
header_name: authorization
refresh:
strategy: google_service_account_jwt
token_url: https://oauth2.googleapis.com/token
scopes: [https://www.googleapis.com/auth/cloud-platform]
refresh_before_seconds: 300
max_lifetime_seconds: 3600
material:
- name: client_email
description: Service account email address
required: true
- name: private_key
description: Service account RSA private key (PEM)
required: true
secret: true
- name: subject
description: Email for domain-wide delegation (optional)
# ADC OAuth2 flow: gateway exchanges a gcloud ADC refresh token for an
# access token. Configure with `openshell provider refresh configure`.
- name: adc_token
description: GCP access token from gcloud application default credentials
env_vars: [GCP_ADC_ACCESS_TOKEN]
required: false
auth_style: bearer
header_name: authorization
refresh:
strategy: oauth2_refresh_token
token_url: https://oauth2.googleapis.com/token
scopes: [https://www.googleapis.com/auth/cloud-platform]
refresh_before_seconds: 300
max_lifetime_seconds: 3600
material:
- name: client_id
description: OAuth2 client ID from ADC JSON
required: true
- name: client_secret
description: OAuth2 client secret from ADC JSON
required: true
secret: true
- name: refresh_token
description: OAuth2 refresh token from ADC JSON
required: true
secret: true
discovery:
credentials: [service_account_token, adc_token]