Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions installing/installing_gcp/installing-gcp-user-infra-vpc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ include::modules/installation-gcp-user-infra-config-host-project-vpc.adoc[levelo

include::modules/installation-gcp-dns.adoc[leveloffset=+2]

include::modules/installation-creating-gcp-vpc.adoc[leveloffset=+2]

include::modules/installation-deployment-manager-vpc.adoc[leveloffset=+3]

include::modules/installation-user-infra-generate.adoc[leveloffset=+1]

include::modules/installation-initializing-manual.adoc[leveloffset=+2]
Expand Down Expand Up @@ -125,9 +121,9 @@ include::modules/installation-network-user-infra.adoc[leveloffset=+1]

include::modules/installation-creating-gcp-lb.adoc[leveloffset=+1]

include::modules/installation-deployment-manager-ext-lb.adoc[leveloffset=+2]
include::modules/installation-infrastructure-manager-ext-lb.adoc[leveloffset=+2]

include::modules/installation-deployment-manager-int-lb.adoc[leveloffset=+2]
include::modules/installation-infrastructure-manager-int-lb.adoc[leveloffset=+2]

include::modules/installation-creating-gcp-private-dns.adoc[leveloffset=+1]

Expand Down
6 changes: 3 additions & 3 deletions installing/installing_gcp/installing-gcp-user-infra.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ include::modules/installation-user-infra-exporting-common-variables.adoc[levelof

include::modules/installation-creating-gcp-vpc.adoc[leveloffset=+1]

include::modules/installation-deployment-manager-vpc.adoc[leveloffset=+2]
include::modules/installation-infrastructure-manager-vpc.adoc[leveloffset=+2]

include::modules/installation-network-user-infra.adoc[leveloffset=+1]

include::modules/installation-creating-gcp-lb.adoc[leveloffset=+1]

include::modules/installation-deployment-manager-ext-lb.adoc[leveloffset=+2]
include::modules/installation-infrastructure-manager-ext-lb.adoc[leveloffset=+2]

include::modules/installation-deployment-manager-int-lb.adoc[leveloffset=+2]
include::modules/installation-infrastructure-manager-int-lb.adoc[leveloffset=+2]

include::modules/installation-creating-gcp-private-dns.adoc[leveloffset=+1]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ include::modules/installation-user-infra-exporting-common-variables.adoc[levelof

include::modules/installation-creating-gcp-vpc.adoc[leveloffset=+1]

include::modules/installation-deployment-manager-vpc.adoc[leveloffset=+2]
include::modules/installation-infrastructure-manager-vpc.adoc[leveloffset=+2]

include::modules/installation-network-user-infra.adoc[leveloffset=+1]

include::modules/installation-creating-gcp-lb.adoc[leveloffset=+1]

include::modules/installation-deployment-manager-ext-lb.adoc[leveloffset=+2]
include::modules/installation-infrastructure-manager-ext-lb.adoc[leveloffset=+2]

include::modules/installation-deployment-manager-int-lb.adoc[leveloffset=+2]
include::modules/installation-infrastructure-manager-int-lb.adoc[leveloffset=+2]

include::modules/installation-creating-gcp-private-dns.adoc[leveloffset=+1]

Expand Down
128 changes: 27 additions & 101 deletions modules/installation-creating-gcp-lb.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,137 +11,63 @@ endif::[]
[id="installation-creating-gcp-lb_{context}"]
= Creating load balancers in {gcp-short}

You must configure load balancers in {gcp-first} for your
{product-title} cluster to use. One way to create these components is
to modify the provided Deployment Manager template.
You must configure load balancers in {gcp-first} for your {product-title} cluster to use. One way to create these components is to modify the provided Infrastructure Manager template.

[NOTE]
====
If you do not use the provided Deployment Manager template to create your {gcp-short}
infrastructure, you must review the provided information and manually create
the infrastructure. If your cluster does not initialize correctly, you might
have to contact Red Hat support with your installation logs.
If you do not use the provided template to create your {gcp-short} infrastructure, you must review the provided information and manually create the infrastructure.
If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.
====

.Prerequisites

* You have defined the variables in the _Exporting common variables_ section.
* You have defined the variables in the _Creating a VPC in {gcp-short}_ section.

.Procedure

. Copy the template from the *Deployment Manager template for the internal load balancer*
section of this topic and save it as `02_lb_int.py` on your computer. This
template describes the internal load balancing objects that your cluster
requires.
. Copy the template from the *Infrastructure Manager template for the internal load balancer* section of this topic and save it as `02_lb_int.tf` in a directory called `02_lb_int` on your computer. This template describes the internal load balancing objects that your cluster requires.

. For an external cluster, also copy the template from the *Deployment Manager template for the external load balancer*
section of this topic and save it as `02_lb_ext.py` on your computer. This
template describes the external load balancing objects that your cluster
requires.

. Export the variables that the deployment template uses:

.. Export the cluster network location:
.. Create an internal load balancer by running the following command:
+
ifdef::shared-vpc[]
[source,terminal]
----
$ export CLUSTER_NETWORK=(`gcloud compute networks describe ${HOST_PROJECT_NETWORK} --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT} --format json | jq -r .selfLink`)
----
endif::shared-vpc[]
ifndef::shared-vpc[]
[source,terminal]
----
$ export CLUSTER_NETWORK=(`gcloud compute networks describe ${INFRA_ID}-network --format json | jq -r .selfLink`)
$ gcloud infra-manager deployments apply <internal_lb_name> \
Comment thread
bscott-rh marked this conversation as resolved.
Outdated
--location=${REGION} \
--input-values=infra_id=${INFRA_ID},project=${PROJECT_NAME},region=${REGION},cluster_network=${CLUSTER_NETWORK},control_subnet=${CONTROL_SUBNET},zone_0=${ZONE_0},zone_1=${ZONE_1},zone_2=${ZONE_2} \
--project=${PROJECT_NAME} \
--local-source=./02_lb_int \
--service-account=${INSTALL_SERVICE_ACCOUNT}
----
endif::shared-vpc[]

.. Export the control plane subnet location:
+
ifdef::shared-vpc[]
[source,terminal]
----
$ export CONTROL_SUBNET=(`gcloud compute networks subnets describe ${HOST_PROJECT_CONTROL_SUBNET} --region=${REGION} --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT} --format json | jq -r .selfLink`)
----
endif::shared-vpc[]
ifndef::shared-vpc[]
[source,terminal]
----
$ export CONTROL_SUBNET=(`gcloud compute networks subnets describe ${INFRA_ID}-master-subnet --region=${REGION} --format json | jq -r .selfLink`)
----
endif::shared-vpc[]
`<internal_lb_name>` specifies the name of the internal load balancer you create.

.. Export the three zones that the cluster uses:
+
[source,terminal]
----
$ export ZONE_0=(`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[0] | cut -d "/" -f9`)
----
.. Export the `CLUSTER_IP` variable by running the following command:
+
[source,terminal]
----
$ export ZONE_1=(`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[1] | cut -d "/" -f9`)
----
+
[source,terminal]
----
$ export ZONE_2=(`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[2] | cut -d "/" -f9`)
$ export CLUSTER_IP=$(gcloud compute addresses describe ${INFRA_ID}-cluster-ip --region=${REGION} --format json | jq -r .address)
----

. Create a `02_infra.yaml` resource definition file:
+
[source,terminal]
----
$ cat <<EOF >02_infra.yaml
imports:
- path: 02_lb_ext.py
- path: 02_lb_int.py <1>
resources:
- name: cluster-lb-ext <1>
type: 02_lb_ext.py
properties:
infra_id: '${INFRA_ID}' <2>
region: '${REGION}' <3>
- name: cluster-lb-int
type: 02_lb_int.py
properties:
cluster_network: '${CLUSTER_NETWORK}'
control_subnet: '${CONTROL_SUBNET}' <4>
infra_id: '${INFRA_ID}'
region: '${REGION}'
zones: <5>
- '${ZONE_0}'
- '${ZONE_1}'
- '${ZONE_2}'
EOF
----
<1> Required only when deploying an external cluster.
<2> `infra_id` is the `INFRA_ID` infrastructure name from the extraction step.
<3> `region` is the region to deploy the cluster into, for example `us-central1`.
<4> `control_subnet` is the URI to the control subnet.
<5> `zones` are the zones to deploy the control plane instances into, like `us-east1-b`, `us-east1-c`, and `us-east1-d`.
. Optional: For a public or externally available cluster, copy the template from the *Infrastructure Manager template for the external load balancer* section of this topic and save it as `02_lb_ext.tf` in a directory called `02_lb_ext` on your computer. This template describes the external load balancing objects that your cluster requires.

. Create the deployment by using the `gcloud` CLI:
.. Create an external load balancer by running the following command:
+
[source,terminal]
----
$ gcloud deployment-manager deployments create ${INFRA_ID}-infra --config 02_infra.yaml
$ gcloud infra-manager deployments apply <external_lb_name> \
Comment thread
bscott-rh marked this conversation as resolved.
Outdated
--location=${REGION} \
--input-values=infra_id=${INFRA_ID},project=${PROJECT_NAME},region=${REGION} \
--project=${PROJECT_NAME} \
--local-source=./02_lb_ext \
--service-account=${INSTALL_SERVICE_ACCOUNT}
----

. Export the cluster IP address:
+
[source,terminal]
----
$ export CLUSTER_IP=(`gcloud compute addresses describe ${INFRA_ID}-cluster-ip --region=${REGION} --format json | jq -r .address`)
----
`<external_lb_name>` specifies the name of the external load balancer you create.

. For an external cluster, also export the cluster public IP address:
.. Export the `CLUSTER_PUBLIC_IP` variable by running the following command:
+
[source,terminal]
----
$ export CLUSTER_PUBLIC_IP=(`gcloud compute addresses describe ${INFRA_ID}-cluster-public-ip --region=${REGION} --format json | jq -r .address`)
----

ifeval::["{context}" == "installing-gcp-user-infra-vpc"]
:!shared-vpc:
endif::[]
$ export CLUSTER_PUBLIC_IP=$(gcloud compute addresses describe ${INFRA_ID}-cluster-public-ip --region=${REGION} --format json | jq -r .address)
----
125 changes: 18 additions & 107 deletions modules/installation-creating-gcp-vpc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@
//
// * installing/installing_gcp/installing-gcp-user-infra.adoc
// * installing/installing_gcp/installing-restricted-networks-gcp.adoc
// * installing/installing_gcp/installing-gcp-user-infra-vpc.adoc

ifeval::["{context}" == "installing-gcp-user-infra-vpc"]
:shared-vpc:
endif::[]

:_mod-docs-content-type: PROCEDURE
[id="installation-creating-gcp-vpc_{context}"]
= Creating a VPC in {gcp-short}

You must create a VPC in {gcp-first} for your {product-title}
cluster to use. You can customize the VPC to meet your requirements. One way to
create the VPC is to modify the provided Deployment Manager template.
You must create a VPC in {gcp-first} for your {product-title} cluster to use. You can customize the VPC to meet your requirements. One way to create the VPC is to modify the provided Infrastructure Manager template.

[NOTE]
====
If you do not use the provided Deployment Manager template to create your {gcp-short}
infrastructure, you must review the provided information and manually create
the infrastructure. If your cluster does not initialize correctly, you might
have to contact Red Hat support with your installation logs.
If you do not use the provided Infrastructure Manager template to create your {gcp-short} infrastructure, you must review the provided information and manually create the infrastructure. If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.
====

.Prerequisites
Expand All @@ -30,120 +20,41 @@ have to contact Red Hat support with your installation logs.

.Procedure

. Copy the template from the *Deployment Manager template for the VPC*
section of this topic and save it as `01_vpc.py` on your computer. This template
describes the VPC that your cluster requires.

ifdef::shared-vpc[]
. Export the following variables required by the resource definition:
. Copy the template from the *Infrastructure Manager template for the VPC* section of this topic and save it as `01_vpc.tf` in a directory called `01_vpc` on your computer. This template describes the VPC that your cluster requires.

.. Export the control plane CIDR:
. Create a VPC by running the following command:
+
[source,terminal]
----
$ export MASTER_SUBNET_CIDR='10.0.0.0/17'
$ gcloud infra-manager deployments apply <vpc_name> \
Comment thread
bscott-rh marked this conversation as resolved.
Outdated
--location=${REGION} \
--input-values=infra_id=${INFRA_ID},project=${PROJECT_NAME},region=${REGION},master_subnet_cidr=${MASTER_SUBNET_CIDR},worker_subnet_cidr=${WORKER_SUBNET_CIDR} \
--project=${PROJECT_NAME} \
--local-source=./01_vpc \
--service-account=${INSTALL_SERVICE_ACCOUNT}
----

.. Export the compute CIDR:
+
[source,terminal]
----
$ export WORKER_SUBNET_CIDR='10.0.128.0/17'
----
`<vpc_name>` specifies the name of the VPC you create.

.. Export the region to deploy the VPC network and cluster to:
+
[source,terminal]
----
$ export REGION='<region>'
----

. Export the variable for the ID of the project that hosts the shared VPC:
+
[source,terminal]
----
$ export HOST_PROJECT=<host_project>
----

. Export the variable for the email of the service account that belongs to host project:
+
[source,terminal]
----
$ export HOST_PROJECT_ACCOUNT=<host_service_account_email>
----
endif::shared-vpc[]
. Configure environment variables that will be used to create other cluster infrastructure.

. Create a `01_vpc.yaml` resource definition file:
.. Configure the `CLUSTER_NETWORK` environment variable by running the following command:
+
[source,terminal]
----
$ cat <<EOF >01_vpc.yaml
imports:
- path: 01_vpc.py

resources:
- name: cluster-vpc
type: 01_vpc.py
properties:
ifndef::shared-vpc[]
infra_id: '${INFRA_ID}' <1>
endif::shared-vpc[]
ifdef::shared-vpc[]
infra_id: '<prefix>' <1>
endif::shared-vpc[]
region: '${REGION}' <2>
master_subnet_cidr: '${MASTER_SUBNET_CIDR}' <3>
worker_subnet_cidr: '${WORKER_SUBNET_CIDR}' <4>
EOF
$ export CLUSTER_NETWORK=$(gcloud compute networks describe ${INFRA_ID}-network --format json | jq -r .selfLink)
----
ifndef::shared-vpc[]
<1> `infra_id` is the `INFRA_ID` infrastructure name from the extraction step.
endif::shared-vpc[]
ifdef::shared-vpc[]
<1> `infra_id` is the prefix of the network name.
endif::shared-vpc[]
<2> `region` is the region to deploy the cluster into, for example `us-central1`.
<3> `master_subnet_cidr` is the CIDR for the master subnet, for example `10.0.0.0/17`.
<4> `worker_subnet_cidr` is the CIDR for the worker subnet, for example `10.0.128.0/17`.

. Create the deployment by using the `gcloud` CLI:
.. Configure the `CONTROL_SUBNET` environment variable by running the following command:
+
ifndef::shared-vpc[]
[source,terminal]
----
$ gcloud deployment-manager deployments create ${INFRA_ID}-vpc --config 01_vpc.yaml
$ export CONTROL_SUBNET=$(gcloud compute networks subnets describe ${INFRA_ID}-master-subnet --region=${REGION} --format json | jq -r .selfLink)
----
endif::shared-vpc[]
ifdef::shared-vpc[]
[source,terminal]
----
$ gcloud deployment-manager deployments create <vpc_deployment_name> --config 01_vpc.yaml --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT} <1>
----
<1> For `<vpc_deployment_name>`, specify the name of the VPC to deploy.

. Export the VPC variable that other components require:
.. Export the name of the host project network:
.. Configure the `COMPUTE_SUBNET` environment variable by running the following command:
+
[source,terminal]
----
$ export HOST_PROJECT_NETWORK=<vpc_network>
$ export COMPUTE_SUBNET=$(gcloud compute networks subnets describe ${INFRA_ID}-worker-subnet --region=${REGION} --format json | jq -r .selfLink)
----
.. Export the name of the host project control plane subnet:
+
[source,terminal]
----
$ export HOST_PROJECT_CONTROL_SUBNET=<control_plane_subnet>
----
.. Export the name of the host project compute subnet:
+
[source,terminal]
----
$ export HOST_PROJECT_COMPUTE_SUBNET=<compute_subnet>
----

. Set up the shared VPC. See link:https://cloud.google.com/vpc/docs/provisioning-shared-vpc#setting_up[Setting up Shared VPC] in the {gcp-short} documentation.
endif::shared-vpc[]

ifeval::["{context}" == "installing-gcp-user-infra-vpc"]
:!shared-vpc:
endif::[]
Loading