GCP Topology Provider
The GCP topology provider relies on the Google Cloud Compute Engine API
to retrieve a list of VM instances. Each instance record may include the
physicalHostTopology field, which describes the network topology of the
underlying compute node.
Access to the Compute Engine API must be authorized.
Authentication When Running on GCP
If Topograph is running on a GCP compute service, you can authenticate without service account keys.
Attach or use a service account that grants the
compute.instances.list permission on the target project and zone.
A common example is the roles/compute.viewer role.
For more information about IAM roles and how to grant permissions, refer to the following documentation:
- Roles overview
- Manage access to projects, folders, and organizations
- Grant a role using the Google Cloud console
- Grant a role using gcloud
Authentication Using a Service Account (ADC)
When running Topograph outside of GCP, one supported authentication method is to use a Google Cloud service account with Application Default Credentials (ADC).
1. Create a service account
2. Grant minimum required permissions
Grant the service account read-only access to Compute Engine resources:
3. Create a service account key
4. Create a Kubernetes Secret from the key
5. Configure Helm values
In your Helm values file, set config.credentialsSecret to the name of the
created secret. This instructs the Helm chart to set the
GOOGLE_APPLICATION_CREDENTIALS environment variable for Topograph.
Example:
Authentication Using GCP Workload Identity Federation (EKS)
When running Topograph in Kubernetes cluster, one supported authentication method is to use a GCP Workload Identity Federation with Application Default Credentials (ADC).
1. Identify the values for the parameters
Identify the values specific to the setup, and replace the env variables with the corresponding values.
2. Create a GCP service account (GSA)
Create a GCP Service Account (if it doesn’t exist already).
3. Grant minimum required permissions
Grant the GSA read-only access to Compute Engine resources:
4. Create a GCP Workload Identity Pool
5. Create a GCP Workload Identity Provider
6. Grant Kubernetes Service Account (KSA) permission to impersonate GCP Service Account (GSA)
7. Create credential configuration file
8. Create a Kubernetes Config Map
Create a k8s config map from the output of the previous command.
9. Configure Helm values
In the Helm values file for the deployment, set the following parameters :
global.provider.params.workloadIdentityFederation.credentialsConfigmapto the name of the created config map in step 8.global.provider.params.workloadIdentityFederation.audienceto theaudienceattribute in thecredentials-config.jsoncreated in step 7.
This instructs the Helm chart to set the GOOGLE_APPLICATION_CREDENTIALS environment variable for Topograph.
Example:
For more information about setting Google Workload Identity Federation, refer to the following documentation:
Setting Project ID
When calling the GCP API, the project ID is provided to specify the scope of the request. By default, when using ADC, the project ID is fetched from the service account key. When running on a GCP compute node, the project ID is extracted from the node metadata.
You can override the project ID by setting project_id provider parameter in the topology request payload: