GCP
The procedure to set up CCM for GCP by using Harness Self-Managed Enterprise Edition.
This topic walks you through the steps required to set up CACM for GCP in a self-managed platform.
Figure: GCP CACM Self-Managed Enterprise Edition architecture diagram

Major Components
K8s Job: In the cloud-hosted infra, a K8s Job is configured to run daily. This job performs all necessary steps to ingest GCP billing data from BigQuery to ClickHouse, utilizing a GCS bucket as an intermediary and then eventually to ClickHouse table.
BigQuery: The GCP project's billing data resides in a BigQuery table.
Google Cloud Storage (GCS): Billing data is stored in the parquet format in GCS bucket. Parquet, as a column-oriented format, represents a better interchange format since it is inherently compressed and faster for BigQuery to export and ClickHouse to query.
ClickHouse: Serves as the datastore where GCP billing data is finally ingested.
Service Account Key: It is a JSON file that contains the information needed to authenticate and authorize requests made by an application or a service.
HMAC Key: HMAC (Hash-based Message Authentication Code) keys are used for authentication and ensuring the integrity of requests made to GCS.
Data Flow
Steps
Authenticate and initialize clients for BigQuery, GCS and ClickHouse using SA and HMAC keys.
Create a dedicated GCS bucket to store billing data in Parquet format. The sub-folders will be organized based on timestamps or dates to precisely track when each bucket was created.
Initiate an export query to transfer data from BigQuery to the GCS bucket in Parquet format with GZIP compression. The export query employs a SELECT statement, resulting in charges based solely on the data scan.
Check if the billing table exists in ClickHouse; create it if not.
Initiate an insert query to efficiently move data from the GCS bucket to the ClickHouse table in batch.
You need to perform the following tasks to set up CACM for GCP:
GCP Setup
Step 1: Create Service Account
A GCP service account is needed to be able to authenticate and perform operations on the customer’s BQ and GCS buckets.You will need one SA and its JSON key during onboarding.
Before creating a Service Account, you have to create Custom Role and provide necessary permissions to it. Follow these steps to create Custom Role and add below permissions:
Follow these steps to create Service Account and add the above IAM custom role to it.
Follow these steps to create Service Account Credential Key.
Please refer this doc if you encounter any difficulties understanding the process. It provides a comprehensive explanation of all steps accompanied by screenshots.
Step 2: Create HMAC Key
To be able to make use of ClickHouse methods to ingest data from GCS, you will need HMAC key.
Follow these steps to create HMAC key for the Service Account created above.
Deploying workloads via Helm charts
Step 1: Clone chart repository
Step 2: Already using harness services OnPrem? Upgrade charts
Example: helm upgrade ccm . -n harness -f old_values.yaml
Step 3: Handling Kubernetes Secrets
On installing/upgrading charts you will see K8s secrets created with default value in the cluster. You need to update these secrets with the above noted values. Before updating the secrets you need to convert the secret into base64 encoded, let say the HMAC_ACCESS_KEY value is: accessKey, then it would it be stored as YWNjZXNzS2V5. After changing secrets, we will provide directives to kubectl delete the corresponding pods in order for your release to inherit new changes.
Command: echo -n "accessKey" | base64
The -n option with echo prevents the trailing newline character from being included in the output. To encode service account credential JSON file, use below command:
base64 -i service-account.json -o service-account-base64-encoded.txt
Following are the secrets specific to CACM services:
1. batch-processing kubectl edit secret batch-processing -n <namespace>
2. cloud-info-secret-mount [config-file] kubectl edit secret cloud-info-secret-mount -n <namespace>
3. ceng-secret-mount
4. nextgen-ce configmap
Following are some secrets from platform-service that you will need to update:
smtp-secret [Required to support budget alerts E-mail]
kubectl edit secret smtp-secret -n <namespace>
GCP Connector Setup
Authorize Service Account to access BigQuery and GCS buckets in other projects
In the Grant Permissions step of GCP Connector flow, follow below steps:
Create same Custom Role with different name in the project for which you are setting up the billing report (refer Step 1 of GCP Setup for creating Custom Role).
Follow these steps to grant role to Service Account to access other project.
Click on Continue to test the connection.
Please refer this doc if you encounter any difficulties understanding the process. It provides a comprehensive explanation of all steps accompanied by screenshots.
Replay GCP Billing Export data
Step 1: Get GCP Connector details
Use below API to get GCP Connector details for your account.
Body:
Step 2: Update GCP Sync Replay yaml file
Replace each <placeHolder> in the YAML below with the corresponding value from the connector response retrieved in Step 1.
image
Path to the GCP Sync K8s Job image. Example: docker.io/harness/ccm-gcp-smp-signed:100079
accountId
accountIdentifier from the connector
sourceGcpProjectId
spec.projectId from the connector
sourceDataSetId
spec.billingExportSpec.datasetId from the connector
sourceDataSetRegion
Check the Details section of the billing export table's dataset in GCP
connectorId
identifier from the connector
sourceGcpTableName
spec.billingExportSpec.tableId from the connector
replayIntervalInDays
Number of days for which you want to replay billing data
http_proxy / https_proxy
Your environment's proxy URL (e.g. https://proxy.example.com:3128)
Step 3: Apply/Delete GCP Sync Replay yaml file
Last updated
Was this helpful?