Skip to main content
Version: 15.2.2

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 RESOURCE content 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​

VariableRequiredDescription
GOOGLE_CLOUD_SYNC_PARENTSyncName 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_PROJECTRunProject hosting the Pub/Sub subscription.
GOOGLE_CLOUD_PUBSUB_SUBSCRIPTIONRunName of the Pub/Sub subscription the source consumes events from.
GOOGLE_APPLICATION_CREDENTIALSOptionalPath 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).

MappingRelationshipTypeBuilt from
clustersCluster → NetworkdependencynetworkConfig.network of the cluster
routersRouter → Networkpart-ofnetwork of the router
addressesRouter → Addressdependencythe router in the users of the address
addressesComputeInstance → Addressdependencythe instance in the users of the address
disksDisk → ComputeInstancedependencythe instance in the users of the disk
snapshotsSnapshot → DiskdependencysourceDisk of the snapshot
dnsrecordsetsDnsRecordSet → DnsZonepart-ofthe 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:

  1. from the Cluster to its Network;
  2. from the Network to the Router items that are part of it, and keep the ones whose spec.location is the region of the cluster (spec.location of the cluster);
  3. from each Router to the Address items it depends on: they are the NAT IPs, whether they were reserved by you (MANUAL_ONLY NAT) or allocated by Google Cloud (AUTO_ONLY NAT, spec.purpose is nat_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 run receives as a deletion event. ibdm sync never deletes, and a change that detaches an address from a router, without deleting the address, leaves the previous relationship in place.

See also​