Host project permission request

This self-contained request asks the administrator of the Shared VPC host project to grant three one-time role bindings to the Cloudera Cloud Factory service account, and describes what Cloudera Cloud Factory does and does not do on the host project.

Request

Grant the following three role bindings on the host project to a single, fixed Cloudera Cloud Factory service account. These are one-time bindings. Every cluster that Cloudera Cloud Factory provisions on Google Cloud, now and in the future, uses the same service account, so no access requests per cluster follow.

Target identity

The bindings apply to the following fixed member:

serviceAccount:[***SERVICE ACCOUNT EMAIL***]

Replace [***SERVICE ACCOUNT EMAIL***] with the exact service account email address that the requester supplies, for example, ccf-sa@my-service-project.iam.gserviceaccount.com.

Bindings on the host project

Table 1. Role bindings on the host project
RoleKindPurpose
projects/[***HOST PROJECT ID***]/roles/GKEFWRole Existing custom role on the host project Manages firewall rules on the Shared VPC network, which are created, updated, and deleted with the lifecycle of each cluster. Rules are scoped by a target tag per project, which is the unique cluster name [***PROJECT NAME***]-[***ORGANIZATION ID***]-[***PROJECT ID***], so the rules of a cluster match only its own virtual machines.
roles/compute.networkUser Managed by Google Cloud Allows virtual machine creation to attach network interfaces to shared subnetworks. Google Cloud checks the compute.subnetworks.use permission on the caller that creates the instance, which is this service account, not on the runtime identity of the virtual machine. This single grant covers every virtual machine in every future cluster.
roles/compute.networkViewer Managed by Google Cloud Reads the metadata of the VPC network and the subnetworks when Cloudera Cloud Factory plans the infrastructure.

Permissions from GKEFWRole

The three role bindings expand to the following IAM permissions on the host project. Cloudera Cloud Factory does not require or use any permission outside these lists.

The GKEFWRole custom role, which the host project owns, must contain the following permissions:

- compute.firewalls.create
- compute.firewalls.delete
- compute.firewalls.get
- compute.firewalls.list
- compute.firewalls.update

To verify the permissions that GKEFWRole currently contains, run the following command:

gcloud iam roles describe GKEFWRole --project="$HOST_PROJECT_ID" \
  --format='value(includedPermissions)' | tr ',' '\n' | grep firewalls

If any of the five permissions is missing, add it to the role with the gcloud iam roles update command.

Permissions from roles/compute.networkUser

The roles/compute.networkUser role contains the following permissions:

# Attach a network interface to a shared subnetwork when the instance is created.
- compute.subnetworks.use
- compute.subnetworks.useExternalIp

# Use forwarding rules and global addresses on the shared network.
# Part of the built-in role. Cloudera Cloud Factory does not use these permissions.
- compute.addresses.use
- compute.globalAddresses.use
- compute.forwardingRules.use
- compute.globalForwardingRules.use

# Read access to the network objects of the Shared VPC network.
# Part of the built-in role. Cloudera Cloud Factory uses only the network and subnetwork lookups.
- compute.networks.use
- compute.networks.useExternalIp
- compute.subnetworks.get
- compute.subnetworks.list

Permissions from roles/compute.networkViewer

The roles/compute.networkViewer role grants read-only access to all networking resources in the project:

- compute.addresses.get
- compute.addresses.list
- compute.firewalls.get
- compute.firewalls.list
- compute.forwardingRules.get
- compute.forwardingRules.list
- compute.globalAddresses.get
- compute.globalAddresses.list
- compute.globalForwardingRules.get
- compute.globalForwardingRules.list
- compute.networks.get
- compute.networks.list
- compute.routes.get
- compute.routes.list
- compute.routers.get
- compute.routers.list
- compute.subnetworks.get
- compute.subnetworks.list
- compute.vpnGateways.get
- compute.vpnGateways.list
- compute.vpnTunnels.get
- compute.vpnTunnels.list
- resourcemanager.projects.get

Of these permissions, Cloudera Cloud Factory uses only compute.networks.get, compute.networks.list, compute.subnetworks.get, compute.subnetworks.list, compute.firewalls.get, compute.firewalls.list, and resourcemanager.projects.get. The other permissions are read permissions that come with the built-in role and are not used.

Narrower custom role

If you prefer a single custom role over the two built-in roles, so that the service account receives only the permissions that Cloudera Cloud Factory uses, create a custom role on the host project with the following permissions:

# Firewall management, equivalent to GKEFWRole.
- compute.firewalls.create
- compute.firewalls.delete
- compute.firewalls.get
- compute.firewalls.list
- compute.firewalls.update

# Attach virtual machines to shared subnetworks, from roles/compute.networkUser.
- compute.subnetworks.use
- compute.subnetworks.useExternalIp

# Look up the VPC network and the subnetworks, from roles/compute.networkViewer.
- compute.networks.get
- compute.networks.list
- compute.subnetworks.get
- compute.subnetworks.list
- resourcemanager.projects.get

This role removes more than 20 unused permissions of roles/compute.networkViewer and is functionally identical for Cloudera Cloud Factory.

Commands for the administrator of the host project

Run the following commands to grant the three role bindings:

export HOST_PROJECT_ID="[***HOST PROJECT ID***]"
export CCF_SA="[***SERVICE ACCOUNT EMAIL***]"

gcloud projects add-iam-policy-binding "$HOST_PROJECT_ID" \
  --member="serviceAccount:${CCF_SA}" \
  --role="projects/${HOST_PROJECT_ID}/roles/GKEFWRole"

gcloud projects add-iam-policy-binding "$HOST_PROJECT_ID" \
  --member="serviceAccount:${CCF_SA}" \
  --role="roles/compute.networkUser"

gcloud projects add-iam-policy-binding "$HOST_PROJECT_ID" \
  --member="serviceAccount:${CCF_SA}" \
  --role="roles/compute.networkViewer"

Run the following command to verify the bindings:

gcloud projects get-iam-policy "$HOST_PROJECT_ID" \
  --flatten="bindings[].members" \
  --format='table(bindings.role,bindings.members)' \
  --filter="bindings.members:${CCF_SA}"

The output displays three rows, one for each role.

Scope of actions on the host project

Cloudera Cloud Factory performs the following actions on the host project:

  • Creates firewall rules for each cluster on the Shared VPC network, scoped to a target tag per project. The tag is the unique cluster name [***PROJECT NAME***]-[***ORGANIZATION ID***]-[***PROJECT ID***], so tags are unique on the Shared VPC network and the rules of a cluster match only its own virtual machines. A cluster typically uses 3 to 6 rules.
  • Tracks the lifecycle of those rules in its own state, and deletes them when the cluster is deleted.
  • Creates an additional firewall rule, k8s-fw-[***HASH***], at runtime for each Kubernetes Service of type LoadBalancer. These rules target the k8s-lb-[***CLUSTER NAME***] node tag of the cluster and are deleted when the corresponding Service is deleted.
  • Reads the metadata of the VPC network and the subnetworks through roles/compute.networkViewer.
  • Attaches the network interfaces of cluster virtual machines to subnetworks of the Shared VPC network through roles/compute.networkUser.

Cloudera Cloud Factory does not perform the following actions on the host project:

  • Modify VPC networks, subnetworks, routers, or Cloud NAT.
  • Create or modify IAM policies.
  • Provision compute instances, disks, or load balancer objects, such as forwarding rules, target pools, health checks, backend services, and instance groups. These resources are created in the service project, where the cluster virtual machines run.
  • Enable or disable APIs.