Browse Source

associate fips for masters with no etcd (#4657)

pull/4671/head
Jiang Yi Tao 5 years ago
committed by Kubernetes Prow Robot
parent
commit
f518b90c6b
5 changed files with 22 additions and 1 deletions
  1. 3
      contrib/terraform/openstack/kubespray.tf
  2. 6
      contrib/terraform/openstack/modules/compute/main.tf
  3. 4
      contrib/terraform/openstack/modules/compute/variables.tf
  4. 6
      contrib/terraform/openstack/modules/ips/main.tf
  5. 4
      contrib/terraform/openstack/modules/ips/outputs.tf

3
contrib/terraform/openstack/kubespray.tf

@ -53,6 +53,7 @@ module "compute" {
network_name = "${var.network_name}" network_name = "${var.network_name}"
flavor_bastion = "${var.flavor_bastion}" flavor_bastion = "${var.flavor_bastion}"
k8s_master_fips = "${module.ips.k8s_master_fips}" k8s_master_fips = "${module.ips.k8s_master_fips}"
k8s_master_no_etcd_fips = "${module.ips.k8s_master_no_etcd_fips}"
k8s_node_fips = "${module.ips.k8s_node_fips}" k8s_node_fips = "${module.ips.k8s_node_fips}"
bastion_fips = "${module.ips.bastion_fips}" bastion_fips = "${module.ips.bastion_fips}"
bastion_allowed_remote_ips = "${var.bastion_allowed_remote_ips}" bastion_allowed_remote_ips = "${var.bastion_allowed_remote_ips}"
@ -79,7 +80,7 @@ output "router_id" {
} }
output "k8s_master_fips" { output "k8s_master_fips" {
value = "${module.ips.k8s_master_fips}"
value = "${concat(module.ips.k8s_master_fips, module.ips.k8s_master_no_etcd_fips)}"
} }
output "k8s_node_fips" { output "k8s_node_fips" {

6
contrib/terraform/openstack/modules/compute/main.tf

@ -296,6 +296,12 @@ resource "openstack_compute_floatingip_associate_v2" "k8s_master" {
floating_ip = "${var.k8s_master_fips[count.index]}" floating_ip = "${var.k8s_master_fips[count.index]}"
} }
resource "openstack_compute_floatingip_associate_v2" "k8s_master_no_etcd" {
count = "${var.number_of_k8s_masters_no_etcd}"
instance_id = "${element(openstack_compute_instance_v2.k8s_master_no_etcd.*.id, count.index)}"
floating_ip = "${var.k8s_master_no_etcd_fips[count.index]}"
}
resource "openstack_compute_floatingip_associate_v2" "k8s_node" { resource "openstack_compute_floatingip_associate_v2" "k8s_node" {
count = "${var.number_of_k8s_nodes}" count = "${var.number_of_k8s_nodes}"
floating_ip = "${var.k8s_node_fips[count.index]}" floating_ip = "${var.k8s_node_fips[count.index]}"

4
contrib/terraform/openstack/modules/compute/variables.tf

@ -54,6 +54,10 @@ variable "k8s_master_fips" {
type = "list" type = "list"
} }
variable "k8s_master_no_etcd_fips" {
type = "list"
}
variable "k8s_node_fips" { variable "k8s_node_fips" {
type = "list" type = "list"
} }

6
contrib/terraform/openstack/modules/ips/main.tf

@ -10,6 +10,12 @@ resource "openstack_networking_floatingip_v2" "k8s_master" {
depends_on = ["null_resource.dummy_dependency"] depends_on = ["null_resource.dummy_dependency"]
} }
resource "openstack_networking_floatingip_v2" "k8s_master_no_etcd" {
count = "${var.number_of_k8s_masters_no_etcd}"
pool = "${var.floatingip_pool}"
depends_on = ["null_resource.dummy_dependency"]
}
resource "openstack_networking_floatingip_v2" "k8s_node" { resource "openstack_networking_floatingip_v2" "k8s_node" {
count = "${var.number_of_k8s_nodes}" count = "${var.number_of_k8s_nodes}"
pool = "${var.floatingip_pool}" pool = "${var.floatingip_pool}"

4
contrib/terraform/openstack/modules/ips/outputs.tf

@ -2,6 +2,10 @@ output "k8s_master_fips" {
value = ["${openstack_networking_floatingip_v2.k8s_master.*.address}"] value = ["${openstack_networking_floatingip_v2.k8s_master.*.address}"]
} }
output "k8s_master_no_etcd_fips" {
value = ["${openstack_networking_floatingip_v2.k8s_master_no_etcd.*.address}"]
}
output "k8s_node_fips" { output "k8s_node_fips" {
value = ["${openstack_networking_floatingip_v2.k8s_node.*.address}"] value = ["${openstack_networking_floatingip_v2.k8s_node.*.address}"]
} }

Loading…
Cancel
Save