Browse Source

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.
pull/5102/head
mcayland 5 years ago
committed by Kubernetes Prow Robot
parent
commit
3732c3a9b1
5 changed files with 17 additions and 6 deletions
  1. 1
      contrib/terraform/openstack/README.md
  2. 13
      contrib/terraform/openstack/kubespray.tf
  3. 1
      contrib/terraform/openstack/modules/network/main.tf
  4. 2
      contrib/terraform/openstack/modules/network/variables.tf
  5. 6
      contrib/terraform/openstack/variables.tf

1
contrib/terraform/openstack/README.md

@ -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`. |
|`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. |
|`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 |

13
contrib/terraform/openstack/kubespray.tf

@ -5,12 +5,13 @@ provider "openstack" {
module "network" {
source = "./modules/network"
external_net = "${var.external_net}"
network_name = "${var.network_name}"
subnet_cidr = "${var.subnet_cidr}"
cluster_name = "${var.cluster_name}"
dns_nameservers = "${var.dns_nameservers}"
use_neutron = "${var.use_neutron}"
external_net = "${var.external_net}"
network_name = "${var.network_name}"
subnet_cidr = "${var.subnet_cidr}"
cluster_name = "${var.cluster_name}"
dns_nameservers = "${var.dns_nameservers}"
network_dns_domain = "${var.network_dns_domain}"
use_neutron = "${var.use_neutron}"
}
module "ips" {

1
contrib/terraform/openstack/modules/network/main.tf

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

2
contrib/terraform/openstack/modules/network/variables.tf

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

6
contrib/terraform/openstack/variables.tf

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

Loading…
Cancel
Save