terraform/openstack: add network_dns_domain variable (#5093)

This allows the user to optionally specify the dns_domain attribute on the
generated internal kubernetes network.
This commit is contained in:
mcayland 2019-08-21 13:09:15 +01:00 committed by Kubernetes Prow Robot
parent f6a63d88a7
commit 3732c3a9b1
5 changed files with 17 additions and 6 deletions

View file

@ -225,6 +225,7 @@ For your cluster, edit `inventory/$CLUSTER/cluster.tfvars`.
|---------|-------------| |---------|-------------|
|`cluster_name` | All OpenStack resources will use the Terraform variable`cluster_name` (default`example`) in their name to make it easier to track. For example the first compute resource will be named`example-kubernetes-1`. | |`cluster_name` | All OpenStack resources will use the Terraform variable`cluster_name` (default`example`) in their name to make it easier to track. For example the first compute resource will be named`example-kubernetes-1`. |
|`network_name` | The name to be given to the internal network that will be generated | |`network_name` | The name to be given to the internal network that will be generated |
|`network_dns_domain` | (Optional) The dns_domain for the internal network that will be generated |
|`dns_nameservers`| An array of DNS name server names to be used by hosts in the internal subnet. | |`dns_nameservers`| An array of DNS name server names to be used by hosts in the internal subnet. |
|`floatingip_pool` | Name of the pool from which floating IPs will be allocated | |`floatingip_pool` | Name of the pool from which floating IPs will be allocated |
|`external_net` | UUID of the external network that will be routed to | |`external_net` | UUID of the external network that will be routed to |

View file

@ -10,6 +10,7 @@ module "network" {
subnet_cidr = "${var.subnet_cidr}" subnet_cidr = "${var.subnet_cidr}"
cluster_name = "${var.cluster_name}" cluster_name = "${var.cluster_name}"
dns_nameservers = "${var.dns_nameservers}" dns_nameservers = "${var.dns_nameservers}"
network_dns_domain = "${var.network_dns_domain}"
use_neutron = "${var.use_neutron}" use_neutron = "${var.use_neutron}"
} }

View file

@ -8,6 +8,7 @@ resource "openstack_networking_router_v2" "k8s" {
resource "openstack_networking_network_v2" "k8s" { resource "openstack_networking_network_v2" "k8s" {
name = "${var.network_name}" name = "${var.network_name}"
count = "${var.use_neutron}" count = "${var.use_neutron}"
dns_domain = var.network_dns_domain != null ? "${var.network_dns_domain}" : null
admin_state_up = "true" admin_state_up = "true"
} }

View file

@ -2,6 +2,8 @@ variable "external_net" {}
variable "network_name" {} variable "network_name" {}
variable "network_dns_domain" {}
variable "cluster_name" {} variable "cluster_name" {}
variable "dns_nameservers" { variable "dns_nameservers" {

View file

@ -103,6 +103,12 @@ variable "network_name" {
default = "internal" default = "internal"
} }
variable "network_dns_domain" {
description = "dns_domain for the internal network"
type = "string"
default = null
}
variable "use_neutron" { variable "use_neutron" {
description = "Use neutron" description = "Use neutron"
default = 1 default = 1