From patchwork Fri Nov 8 20:12:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13868941 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B84D21A9B42 for ; Fri, 8 Nov 2024 20:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731096769; cv=none; b=fGsMAprPguqj5N4PwvwqsGlwFCoPgwJ2DFBtIJWQz3SzKprxpUC32Chuh/SFRYvm62JWi1+pAELT/HneB80WdYcT9mOCtU0DewKPFi8n7tLQaYGWxoC9ENwichKGtpibvr920JEWMz7QKG3YrkfVjmAJEwWLBc1dpk8cwgt86VY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731096769; c=relaxed/simple; bh=mNV4GBMvSecXrzF8pYpfmlWcVCVGhoJ1xEUhjQXhk0w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rt/J/tL2Eaxfzow5XvUT/idD4SRgve9azzMTyAlyWOMO8OqbLfww68g25ZbSS8+wVA1V7IeoHCU6Qhsvc1UZ/NDafuwemLxqeWjEW3lrR0GWmkjMg9ISOJhXaJSkugIKEt/YAInoBQ9wIxMQD3iv3jf1zZSAPH7juqoisR1CXoQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rqChtnPi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rqChtnPi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17914C4CED0; Fri, 8 Nov 2024 20:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731096769; bh=mNV4GBMvSecXrzF8pYpfmlWcVCVGhoJ1xEUhjQXhk0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rqChtnPiwO0jUj0+tdRKbGqJTQlal7Q2/XFBiiWjvu9MZx6Sz1nwvnROeqUHKcNvo kYNmLiLmT2yh4l2aGy1/s7Fjnals7dS59gGAadWv1a2Sai54Xj2DPt3ZQSb0eMLDQc U99xIXTyvwBdVNIqaRGSWWIPcu/ZcHGiZIWv0VgawYt5by4Qbk3PMz+/X/cSSzee4j c3DcAT04y8U4PpzeMbIhUwJ6qpSx3zYBu9YdTjtgGZtIo/SalbxKJ20cM7JD9PLcuv pZwzcqiHZygb0YRj3o4qsjMBx+X4oEurbU7WI42y4X5FjHTtMmPMVDjm1b2iZG7nhx 9VPCxPyA+bXFg== From: cel@kernel.org To: Cc: Chuck Lever Subject: [RFC PATCH 2/2] aws: Add each test instance to the local DNS service Date: Fri, 8 Nov 2024 15:12:45 -0500 Message-ID: <20241108201245.561269-3-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241108201245.561269-1-cel@kernel.org> References: <20241108201245.561269-1-cel@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever The kdevops NFS workflows typically set up separate nodes for an NFS server and NFS clients. kdevops then provisions exports on the NFS server and mount points on the clients. For libvirt, kdevops adds the IP address of each test node to all of the /etc/hosts files. This enables the clients to mount the test NFS server conveniently by hostname. For AWS, kdevops can provision a private DNS service and add "A" records for each test host there. This patch implements that approach. Signed-off-by: Chuck Lever --- terraform/aws/main.tf | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/terraform/aws/main.tf b/terraform/aws/main.tf index 62730d77422c..77aabd79e658 100644 --- a/terraform/aws/main.tf +++ b/terraform/aws/main.tf @@ -184,3 +184,33 @@ resource "aws_route_table_association" "kdevops_rt_assoc" { route_table_id = aws_route_table.kdevops_rt.id } +resource "aws_vpc_dhcp_options" "kdevops_dhcp_opts" { + domain_name = "kdevops.local" + domain_name_servers = ["AmazonProvidedDNS"] + + tags = { + Name = "kdevops_dhcp_opts" + } +} + +resource "aws_vpc_dhcp_options_association" "kdevops_dhcp_association" { + vpc_id = aws_vpc.kdevops_vpc.id + dhcp_options_id = aws_vpc_dhcp_options.kdevops_dhcp_opts.id +} + +resource "aws_route53_zone" "kdevops_private_zone" { + name = "kdevops.local" + vpc { + vpc_id = aws_vpc.kdevops_vpc.id + } +} + +resource "aws_route53_record" "kdevops_dns_record" { + count = local.kdevops_num_boxes + zone_id = aws_route53_zone.kdevops_private_zone.zone_id + name = "${element(var.kdevops_nodes, count.index)}.kdevops.local" + type = "A" + ttl = "300" + records = ["${element(aws_instance.kdevops_instance.*.private_ip, count.index)}"] +} +