Add VPC networking to database clusters
Our current proposal has a single VPC per environment (production, staging, sb-alpha, sb-beta, etc), and within that VPC there will be multiple subnets, each subnet will be assigned to a cluster.
What we have done so far is assigned the following subnets to each environment, it is important for the sake of peering that these do not overlap, though we don't intend to peer the gitlab-sb-*
envs since they are individual sandboxes:
- gitlab-staging-db
10.176.0.0/16
- gitlab-production-db
10.177.0.0/16
- gitlab-sandbox-db
10.178.0.0/16
We intend to create a subnet per database cluster, so in production cluster1 will have 10.176.1.0/24
, cluster2 10.176.2.0/24
, etc. This will allow for 254 nodes per db cluster, and 254 shards per environment.
GET does not currently support passing in a subnet so we will need to add that in order to assign a specific subnet.
For db-provisioning, the VPC that is created takes a list of subnets. I think what we should do is switch this to a map, where the key is the cluster name.
In other modules where we create GCP instances, the subnet is created in the same module that creates the instance. This is not the case for https://gitlab.com/gitlab-org/quality/gitlab-environment-toolkit/-/tree/master/terraform/modules/gitlab_gcp_instance. I think it is probably best to create the subnet outside the module.