Skip to content

Commit

Permalink
feat: manage DigitalOcean service DNS records (#161)
Browse files Browse the repository at this point in the history
* feat: add a DNS zone with records for doks-public, archives(ipv4) and archives(ipv6)

Signed-off-by: Damien Duportal <[email protected]>

* fixup: change puppet hostname for archives.jenkins.io to map to DNS

Signed-off-by: Damien Duportal <[email protected]>

---------

Signed-off-by: Damien Duportal <[email protected]>
  • Loading branch information
dduportal authored Sep 25, 2023
1 parent 4532114 commit 38f166e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion archives.jenkins.io.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "digitalocean_droplet" "archives_jenkins_io" {
ipv6 = true
resize_disk = true
ssh_keys = [digitalocean_ssh_key.archives_jenkins_io.fingerprint]
user_data = templatefile("${path.root}/.shared-tools/terraform/cloudinit.tftpl", { hostname = "do.archives.jenkins.io" })
user_data = templatefile("${path.root}/.shared-tools/terraform/cloudinit.tftpl", { hostname = "archives.do.jenkins.io" })

}

Expand Down
26 changes: 26 additions & 0 deletions dns.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Child DNS Zone delegated from Azure
# https://docs.digitalocean.com/products/networking/dns/getting-started/dns-registrars/
resource "digitalocean_domain" "do_jenkins_io" {
name = "do.jenkins.io"
}

resource "digitalocean_record" "repo_ipv4" {
domain = digitalocean_domain.do_jenkins_io.id
type = "A"
name = "repo"
value = data.digitalocean_loadbalancer.doks_public.ip
}

resource "digitalocean_record" "archives_ipv4" {
domain = digitalocean_domain.do_jenkins_io.id
type = "A"
name = "archives"
value = digitalocean_droplet.archives_jenkins_io.ipv4_address
}

resource "digitalocean_record" "archives_ipv6" {
domain = digitalocean_domain.do_jenkins_io.id
type = "AAAA"
name = "archives"
value = digitalocean_droplet.archives_jenkins_io.ipv6_address
}
6 changes: 5 additions & 1 deletion doks-public-cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ output "kubeconfig_doks_public" {
value = module.doks_public_admin_sa.kubeconfig
}

data "digitalocean_loadbalancer" "doks_public" {
name = "a04ff19a8410b4ac5a2b5c383b23a8b2"
}

output "doks_public_public_ipv4_address" {
value = digitalocean_kubernetes_cluster.doks_public_cluster.ipv4_address
value = data.digitalocean_loadbalancer.doks_public.ip
}

0 comments on commit 38f166e

Please sign in to comment.