Skip to content

Commit

Permalink
Merge pull request #3632 from iamemilio/byon_router_bugfix
Browse files Browse the repository at this point in the history
Bug 1838032: Don't create router to external network when BYO subnet is set
  • Loading branch information
openshift-merge-robot committed May 21, 2020
2 parents 254680f + 9859962 commit e2367c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions data/data/openstack/topology/private-network.tf
Expand Up @@ -2,6 +2,7 @@ locals {
nodes_cidr_block = var.cidr_block
nodes_subnet_id = var.machines_subnet_id != "" ? var.machines_subnet_id : openstack_networking_subnet_v2.nodes[0].id
nodes_network_id = var.machines_network_id != "" ? var.machines_network_id : openstack_networking_network_v2.openshift-private[0].id
create_router = var.machines_subnet_id != "" ? 0 : 1
}

data "openstack_networking_network_v2" "external_network" {
Expand Down Expand Up @@ -127,17 +128,18 @@ resource "openstack_networking_floatingip_associate_v2" "api_fip" {
count = length(var.lb_floating_ip) == 0 ? 0 : 1
port_id = openstack_networking_port_v2.api_port.id
floating_ip = var.lb_floating_ip
depends_on = [openstack_networking_router_interface_v2.nodes_router_interface]
}

resource "openstack_networking_router_v2" "openshift-external-router" {
count = local.create_router
name = "${var.cluster_id}-external-router"
admin_state_up = true
external_network_id = data.openstack_networking_network_v2.external_network.id
tags = ["openshiftClusterID=${var.cluster_id}"]
}

resource "openstack_networking_router_interface_v2" "nodes_router_interface" {
router_id = openstack_networking_router_v2.openshift-external-router.id
count = local.create_router
router_id = openstack_networking_router_v2.openshift-external-router[0].id
subnet_id = local.nodes_subnet_id
}
2 changes: 1 addition & 1 deletion docs/user/openstack/customization.md
Expand Up @@ -28,7 +28,7 @@ Beyond the [platform-agnostic `install-config.yaml` properties](../customization
* `clusterOSImage` (optional string): Either a URL with `http(s)` or `file` scheme to override the default OS image for cluster nodes or an existing Glance image name.
* `apiVIP` (optional string): An IP addresss on the machineNetwork that will be assigned to the API VIP. Be aware that the `10` and `11` of the machineNetwork will be taken by neutron dhcp by default, and wont be available.
* `ingressVIP` (optional string): An IP address on the machineNetwork that will be assigned to the ingress VIP. Be aware that the `10` and `11` of the machineNetwork will be taken by neutron dhcp by default, and wont be available.
* `machinesSubnet` (optional string): the UUID of an openstack subnet to install the nodes of the cluster onto. The first CIDR in `networks.machineNetwork` must match the cidr of the `machinesSubnet`. Also note that setting `externalDNS` while setting `machinesSubnet` is invalid usage. If you want to add a DNS to your cluster while using a custom subnet, add it to the subnet in openstack [like this](https://docs.openstack.org/neutron/rocky/admin/config-dns-res.html).
* `machinesSubnet` (optional string): the UUID of an openstack subnet to install the nodes of the cluster onto. The first CIDR in `networks.machineNetwork` must match the cidr of the `machinesSubnet`. In order to support more complex networking configurations, we expect the subnet passed to already be connected to an external network in some way. When this option is set, we will no longer attempt to create a router. Also note that setting `externalDNS` while setting `machinesSubnet` is invalid usage. If you want to add a DNS to your cluster while using a custom subnet, add it to the subnet in openstack [like this](https://docs.openstack.org/neutron/rocky/admin/config-dns-res.html).

## Machine pools

Expand Down

0 comments on commit e2367c4

Please sign in to comment.