From 6e2cada9040771180e4488f7a56d63b3b946e6c8 Mon Sep 17 00:00:00 2001 From: Abhinav Dahiya Date: Thu, 1 Nov 2018 16:55:55 -0700 Subject: [PATCH] data/data: update etcd srv records to cluster-name subdomain https://github.com/openshift/installer/pull/526 added the etcd srv records on basedomain, this can be problematic and might collide. This was working on AWS right now due to the fact that we were using internal route53 zone. This keeps the old srvs inplace for now, so that when MCO switches to these new records we can comeback and remove `*_old_srvs` --- data/data/aws/main.tf | 10 +++++++++- data/data/libvirt/main.tf | 13 ++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/data/data/aws/main.tf b/data/data/aws/main.tf index c018f9858e4..4e02bc114e2 100644 --- a/data/data/aws/main.tf +++ b/data/data/aws/main.tf @@ -117,7 +117,7 @@ resource "aws_route53_record" "etcd_a_nodes" { records = ["${module.masters.ip_addresses[count.index]}"] } -resource "aws_route53_record" "etcd_cluster" { +resource "aws_route53_record" "etcd_cluster_old_srvs" { type = "SRV" ttl = "60" zone_id = "${local.private_zone_id}" @@ -125,6 +125,14 @@ resource "aws_route53_record" "etcd_cluster" { records = ["${formatlist("0 10 2380 %s", aws_route53_record.etcd_a_nodes.*.fqdn)}"] } +resource "aws_route53_record" "etcd_cluster" { + type = "SRV" + ttl = "60" + zone_id = "${local.private_zone_id}" + name = "_etcd-server-ssl._tcp.${var.tectonic_cluster_name}" + records = ["${formatlist("0 10 2380 %s", aws_route53_record.etcd_a_nodes.*.fqdn)}"] +} + resource "aws_route53_zone" "tectonic_int" { count = "${local.private_endpoints ? "${var.tectonic_aws_external_private_zone == "" ? 1 : 0 }" : 0}" vpc_id = "${module.vpc.vpc_id}" diff --git a/data/data/libvirt/main.tf b/data/data/libvirt/main.tf index 946a99ef81a..99bbe42d9aa 100644 --- a/data/data/libvirt/main.tf +++ b/data/data/libvirt/main.tf @@ -51,6 +51,7 @@ resource "libvirt_network" "tectonic_net" { srvs = ["${flatten(list( data.libvirt_network_dns_srv_template.etcd_cluster.*.rendered, + data.libvirt_network_dns_srv_template.etcd_cluster_old_srvs.*.rendered, ))}"] hosts = ["${flatten(list( @@ -120,7 +121,7 @@ data "libvirt_network_dns_host_template" "workers" { hostname = "${var.tectonic_cluster_name}" } -data "libvirt_network_dns_srv_template" "etcd_cluster" { +data "libvirt_network_dns_srv_template" "etcd_cluster_old_srvs" { count = "${var.tectonic_master_count}" service = "etcd-server-ssl" protocol = "tcp" @@ -129,3 +130,13 @@ data "libvirt_network_dns_srv_template" "etcd_cluster" { weight = 10 target = "${var.tectonic_cluster_name}-etcd-${count.index}.${var.tectonic_base_domain}" } + +data "libvirt_network_dns_srv_template" "etcd_cluster" { + count = "${var.tectonic_master_count}" + service = "etcd-server-ssl" + protocol = "tcp" + domain = "${var.tectonic_cluster_name}.${var.tectonic_base_domain}" + port = 2380 + weight = 10 + target = "${var.tectonic_cluster_name}-etcd-${count.index}.${var.tectonic_base_domain}" +}