Google Cloud Connector
The Google Cloud connector ingests cloud resources from a Google Cloud Platform organization, folder, or project into the Catalog. It runs through the ibdm binary in one of two modes:
- Sync — pull-based: enumerates resources via the Cloud Asset API and exits. Only resource metadata is retrieved (the
RESOURCEcontent type) — IAM policies, org policies, and other Cloud Asset content types are not synced. - Run — push-based: subscribes to a Pub/Sub subscription fed by a Cloud Asset Feed. On delete events, the emitted item carries the last-known (
priorAsset) resource snapshot, since there is no current asset to report.
Commands
ibdm sync gcp --include-internal-mappings=all
ibdm run gcp --include-internal-mappings=all
The commands use every internal mapping of the source. To select only some of them, or to add mappings of your own, see Mappings.
Configuration
| Variable | Required | Description |
|---|---|---|
GOOGLE_CLOUD_SYNC_PARENT | Sync | Name of the organization, folder, or project containing the resources to sync. Must be one of organizations/{org-number}, folders/{folder-number}, projects/{project-id}, or projects/{project-number}. |
GOOGLE_CLOUD_PUBSUB_PROJECT | Run | Project hosting the Pub/Sub subscription. |
GOOGLE_CLOUD_PUBSUB_SUBSCRIPTION | Run | Name of the Pub/Sub subscription the source consumes events from. |
GOOGLE_APPLICATION_CREDENTIALS | Optional | Path to a service-account key file, used by Application Default Credentials. |
Authentication
The source authenticates through Application Default Credentials (ADC). You can supply credentials in any of the standard ADC ways, including pointing GOOGLE_APPLICATION_CREDENTIALS at a service-account key file. The principal must have read access to the resources you intend to ingest.
Internal mappings
ibdm mappings list gcp prints the internal mappings of this source, and the Internal Mappings reference lists the Item Type each one writes.
The source ships one internal mapping per supported asset type: addresses, buckets, clusters, computeinstances, disks, dnsrecordsets, dnszones, firewallrules, folders, jobs, networks, projects, routers, services, snapshots and sqlinstances. Every mapping is selected on its own: the sync asks the Cloud Asset API for the asset types of the selected mappings only, in one request, and the Pub/Sub stream keeps only the events of those asset types.
Some mappings also create relationships to the items of other mappings, described in Relationships. The Catalog accepts a relationship even when the item at its other end does not exist, so select all the mappings of a relationship to be able to navigate it.
Relationships
The mappings below create relationships items next to their own item. Each relationship is created with the item it is declared in and is deleted together with it (deletePolicy: cascade).
| Mapping | Relationship | Type | Built from |
|---|---|---|---|
clusters | Cluster → Network | dependency | networkConfig.network of the cluster |
routers | Router → Network | part-of | network of the router |
addresses | Router → Address | dependency | the router in the users of the address |
addresses | ComputeInstance → Address | dependency | the instance in the users of the address |
disks | Disk → ComputeInstance | dependency | the instance in the users of the disk |
snapshots | Snapshot → Disk | dependency | sourceDisk of the snapshot |
dnsrecordsets | DnsRecordSet → DnsZone | part-of | the zone in the asset name of the record set |
Finding the outbound NAT IPs of a cluster
The outbound IPs of a GKE cluster are the ones of the Cloud NAT gateways of its VPC network, in the region of the cluster. Select the clusters, routers and addresses mappings together with networks, then navigate:
- from the
Clusterto itsNetwork; - from the
Networkto theRouteritems that are part of it, and keep the ones whosespec.locationis the region of the cluster (spec.locationof the cluster); - from each
Routerto theAddressitems it depends on: they are the NAT IPs, whether they were reserved by you (MANUAL_ONLYNAT) or allocated by Google Cloud (AUTO_ONLYNAT,spec.purposeisnat_auto).
spec.nats of the router tells which NAT gateways it hosts, how they allocate IPs and which subnetworks they translate.
DNS records
The dnsrecordsets mapping brings every record set of every Cloud DNS managed zone, NS and SOA included, and relates it to its zone. The mapping writes two items for each record set, the record set and its relationship, and a zone can hold hundreds of record sets, so expect a large number of items when you select it. A record set is identified by a hash of its asset name, because DNS names can hold characters an identifier cannot, and shown with its DNS name.
Snapshots, disks and virtual machines
Select the snapshots, disks and computeinstances mappings together to go from a snapshot to the virtual machine that owns the disk it was taken from: a Snapshot depends on its Disk, which depends on the ComputeInstance using it. A disk that is not attached to any instance has no relationship to a virtual machine, and neither has a snapshot whose source disk was deleted or is not a disk of a project in scope. Snapshots made by a snapshot schedule are included, with spec.autoCreated set, and can be numerous.
Limitations
- The path goes through the VPC network, not through the exact cluster: a network with routers in several regions returns all of them, and the region of the cluster has to be used to select the right ones. A NAT that translates only some subnetworks (
LIST_OF_SUBNETWORKS) is not related to the clusters of the other subnetworks. - When the address has several routers or several instances in its
users, or the disk several instances, only the first of each kind is related. - A network of a Shared VPC is referenced with the project the network belongs to, which can differ from the one of the cluster.
- A relationship is deleted only when the item it is declared in is deleted, which
ibdm runreceives as a deletion event.ibdm syncnever deletes, and a change that detaches an address from a router, without deleting the address, leaves the previous relationship in place.
See also
- Connectors Installation Overview
- Azure Connector — sibling cloud source.