Skip to content

Commit

Permalink
clean up unused cluster-wide IP and dns WRR configs (#707)
Browse files Browse the repository at this point in the history
* clean up unused cluster-wide IP and dns WRR configs

Signed-off-by: Bob Callaway <[email protected]>

* fix tf fmt lint

Signed-off-by: Bob Callaway <[email protected]>

---------

Signed-off-by: Bob Callaway <[email protected]>
  • Loading branch information
bobcallaway committed Aug 14, 2023
1 parent 72caff5 commit 4e9f2ff
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 242 deletions.
12 changes: 1 addition & 11 deletions terraform/gcp/modules/ctlog/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,7 @@ resource "google_dns_record_set" "A_ctfe" {
project = var.project_id
managed_zone = var.dns_zone_name

routing_policy {
wrr {
weight = var.nginx_traffic_weight
rrdatas = [var.load_balancer_ipv4]
}

wrr {
weight = var.gcp_lb_traffic_weight
rrdatas = [google_compute_global_address.gce_lb_ipv4.address]
}
}
rrdatas = [google_compute_global_address.gce_lb_ipv4.address]
}

// Create a static global IP for the external IPV4 GCE L7 load balancer
Expand Down
18 changes: 0 additions & 18 deletions terraform/gcp/modules/ctlog/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,3 @@ variable "dns_domain_name" {
description = "Name of DNS domain name in Google Cloud DNS"
type = string
}

variable "load_balancer_ipv4" {
description = "IPv4 adddress of external load balancer"
type = string
}

// temporary variables to facilitate traffic shift
variable "nginx_traffic_weight" {
description = "weight for DNS weighted round robin for NGINX-based ingress"
type = number
default = 1
}

variable "gcp_lb_traffic_weight" {
description = "weight for DNS weighted round robin for GCP-based load balancer"
type = number
default = 0
}
12 changes: 1 addition & 11 deletions terraform/gcp/modules/dex/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,7 @@ resource "google_dns_record_set" "A_dex" {
project = var.project_id
managed_zone = var.dns_zone_name

routing_policy {
wrr {
weight = var.nginx_traffic_weight
rrdatas = [var.load_balancer_ipv4]
}

wrr {
weight = var.gcp_lb_traffic_weight
rrdatas = [google_compute_global_address.gce_lb_ipv4.address]
}
}
rrdatas = [google_compute_global_address.gce_lb_ipv4.address]
}

// Create a static global IP for the external IPV4 GCE L7 load balancer
Expand Down
18 changes: 0 additions & 18 deletions terraform/gcp/modules/dex/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,7 @@ variable "dns_domain_name" {
type = string
}

variable "load_balancer_ipv4" {
description = "IPv4 adddress of external load balancer"
type = string
}

variable "cluster_name" {
type = string
default = ""
}

// temporary variables to facilitate traffic shift
variable "nginx_traffic_weight" {
description = "weight for DNS weighted round robin for NGINX-based ingress"
type = number
default = 1
}

variable "gcp_lb_traffic_weight" {
description = "weight for DNS weighted round robin for GCP-based load balancer"
type = number
default = 0
}
12 changes: 1 addition & 11 deletions terraform/gcp/modules/fulcio/fulcio.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,7 @@ resource "google_dns_record_set" "A_fulcio" {
project = var.project_id
managed_zone = var.dns_zone_name

routing_policy {
wrr {
weight = var.nginx_traffic_weight
rrdatas = [var.load_balancer_ipv4]
}

wrr {
weight = var.gcp_lb_traffic_weight
rrdatas = [google_compute_global_address.gce_lb_ipv4.address]
}
}
rrdatas = [google_compute_global_address.gce_lb_ipv4.address]
}

// Create a static global IP for the external IPV4 GCE L7 load balancer
Expand Down
18 changes: 0 additions & 18 deletions terraform/gcp/modules/fulcio/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,3 @@ variable "dns_domain_name" {
description = "Name of DNS domain name in Google Cloud DNS"
type = string
}

variable "load_balancer_ipv4" {
description = "IPv4 adddress of external load balancer"
type = string
}

// temporary variables to facilitate traffic shift
variable "nginx_traffic_weight" {
description = "weight for DNS weighted round robin for NGINX-based ingress"
type = number
default = 1
}

variable "gcp_lb_traffic_weight" {
description = "weight for DNS weighted round robin for GCP-based load balancer"
type = number
default = 0
}
9 changes: 0 additions & 9 deletions terraform/gcp/modules/network/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,3 @@ resource "google_compute_router_nat" "nat" {
}
depends_on = [google_compute_subnetwork.subnetwork]
}

// Create a static IP for the external IPV4 L7 load balancer
resource "google_compute_address" "default_ipv4" {
name = format("%s-ext-lb", var.cluster_name)
address = var.requested_external_ipv4_address
address_type = "EXTERNAL"
project = var.project_id
region = var.region
}
8 changes: 0 additions & 8 deletions terraform/gcp/modules/network/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,3 @@ output "subnetwork_self_link" {
output "secondary_ip_range" {
value = google_compute_subnetwork.subnetwork.secondary_ip_range
}

output "external_ipv4_name" {
value = google_compute_address.default_ipv4.name
}

output "external_ipv4_address" {
value = google_compute_address.default_ipv4.address
}
6 changes: 0 additions & 6 deletions terraform/gcp/modules/network/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,3 @@ variable "cluster_name" {
type = string
default = ""
}

variable "requested_external_ipv4_address" {
type = string
description = "External IPv4 address to request"
default = ""
}
12 changes: 1 addition & 11 deletions terraform/gcp/modules/rekor/rekor.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,7 @@ resource "google_dns_record_set" "A_rekor" {
project = var.project_id
managed_zone = var.dns_zone_name

routing_policy {
wrr {
weight = var.nginx_traffic_weight
rrdatas = [var.load_balancer_ipv4]
}

wrr {
weight = var.gcp_lb_traffic_weight
rrdatas = [google_compute_global_address.gce_lb_ipv4.address]
}
}
rrdatas = [google_compute_global_address.gce_lb_ipv4.address]
}

// Create a static global IP for the external IPV4 GCE L7 load balancer
Expand Down
18 changes: 0 additions & 18 deletions terraform/gcp/modules/rekor/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,8 @@ variable "dns_domain_name" {
type = string
}

variable "load_balancer_ipv4" {
description = "IPv4 adddress of external load balancer"
type = string
}

variable "redis_cluster_memory_size_gb" {
description = "size of redis cluster expressed in whole GB"
type = number
default = 30
}

// temporary variables to facilitate traffic shift
variable "nginx_traffic_weight" {
description = "weight for DNS weighted round robin for NGINX-based ingress"
type = number
default = 1
}

variable "gcp_lb_traffic_weight" {
description = "weight for DNS weighted round robin for GCP-based load balancer"
type = number
default = 0
}
10 changes: 0 additions & 10 deletions terraform/gcp/modules/sigstore/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,3 @@ output "bastion_kubectl" {
description = "kubectl command using the local proxy once the bastion_ssh command is running"
value = "HTTPS_PROXY=socks5://localhost:8118 kubectl get pods --all-namespaces"
}

output "external_ipv4_name" {
description = "Name of the external IPv4 address resource for services on the cluster"
value = module.network.external_ipv4_name
}

output "external_ipv4_address" {
description = "External IPv4 Address for services on the cluster"
value = module.network.external_ipv4_address
}
39 changes: 10 additions & 29 deletions terraform/gcp/modules/sigstore/sigstore.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ module "network" {

cluster_name = var.cluster_name

requested_external_ipv4_address = var.static_external_ipv4_address

depends_on = [
module.project_roles
]
Expand Down Expand Up @@ -208,15 +206,11 @@ module "rekor" {
gcs_logging_bucket = var.gcs_logging_bucket
storage_class = var.attestation_storage_class

dns_zone_name = var.dns_zone_name
dns_domain_name = var.dns_domain_name
load_balancer_ipv4 = module.network.external_ipv4_address
dns_zone_name = var.dns_zone_name
dns_domain_name = var.dns_domain_name

redis_cluster_memory_size_gb = var.redis_cluster_memory_size_gb

nginx_traffic_weight = var.rekor_nginx_traffic_weight
gcp_lb_traffic_weight = var.rekor_gcp_lb_traffic_weight

depends_on = [
module.network,
module.gke-cluster,
Expand All @@ -240,12 +234,8 @@ module "fulcio" {
fulcio_keyring_name = var.fulcio_keyring_name
fulcio_key_name = var.fulcio_intermediate_key_name

dns_zone_name = var.dns_zone_name
dns_domain_name = var.dns_domain_name
load_balancer_ipv4 = module.network.external_ipv4_address

nginx_traffic_weight = var.fulcio_nginx_traffic_weight
gcp_lb_traffic_weight = var.fulcio_gcp_lb_traffic_weight
dns_zone_name = var.dns_zone_name
dns_domain_name = var.dns_domain_name

depends_on = [
module.gke-cluster,
Expand All @@ -270,9 +260,8 @@ module "timestamp" {
timestamp_encryption_key_name = var.timestamp_encryption_key_name
timestamp_intermediate_ca_key_name = var.timestamp_intermediate_ca_key_name

dns_zone_name = var.dns_zone_name
dns_domain_name = var.dns_domain_name
load_balancer_ipv4 = module.network.external_ipv4_address
dns_zone_name = var.dns_zone_name
dns_domain_name = var.dns_domain_name

depends_on = [
module.gke-cluster,
Expand Down Expand Up @@ -322,12 +311,8 @@ module "ctlog" {
project_id = var.project_id
cluster_name = var.cluster_name

dns_zone_name = var.dns_zone_name
dns_domain_name = var.dns_domain_name
load_balancer_ipv4 = module.network.external_ipv4_address

nginx_traffic_weight = var.ctlog_nginx_traffic_weight
gcp_lb_traffic_weight = var.ctlog_gcp_lb_traffic_weight
dns_zone_name = var.dns_zone_name
dns_domain_name = var.dns_domain_name

depends_on = [
module.gke-cluster,
Expand Down Expand Up @@ -439,12 +424,8 @@ module "dex" {

cluster_name = var.cluster_name

dns_zone_name = var.dns_zone_name
dns_domain_name = var.dns_domain_name
load_balancer_ipv4 = module.network.external_ipv4_address

nginx_traffic_weight = var.dex_nginx_traffic_weight
gcp_lb_traffic_weight = var.dex_gcp_lb_traffic_weight
dns_zone_name = var.dns_zone_name
dns_domain_name = var.dns_domain_name

depends_on = [
module.gke-cluster,
Expand Down
58 changes: 0 additions & 58 deletions terraform/gcp/modules/sigstore/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,6 @@ variable "dns_domain_name" {
type = string
}

variable "static_external_ipv4_address" {
description = "Static IPv4 Address to request for external services"
type = string
default = ""
}

variable "ctlog_shards" {
type = list(string)
description = "Array of CTLog shards to create. Entry should be something like [2021, 2022], which would then have 2 independent CTLog shards backed by ctlog-2021 and ctlog-2022 Cloud SQL instances."
Expand Down Expand Up @@ -351,55 +345,3 @@ variable "redis_cluster_memory_size_gb" {
type = number
default = 30
}

// temporary variables to facilitate traffic shift for rekor
variable "rekor_nginx_traffic_weight" {
description = "weight for DNS weighted round robin for NGINX-based ingress"
type = number
default = 1
}

variable "rekor_gcp_lb_traffic_weight" {
description = "weight for DNS weighted round robin for GCP-based load balancer"
type = number
default = 0
}

// temporary variables to facilitate traffic shift for dex
variable "dex_nginx_traffic_weight" {
description = "weight for DNS weighted round robin for NGINX-based ingress"
type = number
default = 1
}

variable "dex_gcp_lb_traffic_weight" {
description = "weight for DNS weighted round robin for GCP-based load balancer"
type = number
default = 0
}

// temporary variables to facilitate traffic shift for fulcio
variable "fulcio_nginx_traffic_weight" {
description = "weight for DNS weighted round robin for NGINX-based ingress"
type = number
default = 1
}

variable "fulcio_gcp_lb_traffic_weight" {
description = "weight for DNS weighted round robin for GCP-based load balancer"
type = number
default = 0
}

// temporary variables to facilitate traffic shift for fulcio
variable "ctlog_nginx_traffic_weight" {
description = "weight for DNS weighted round robin for NGINX-based ingress"
type = number
default = 1
}

variable "ctlog_gcp_lb_traffic_weight" {
description = "weight for DNS weighted round robin for GCP-based load balancer"
type = number
default = 0
}
9 changes: 8 additions & 1 deletion terraform/gcp/modules/timestamp/timestamp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,12 @@ resource "google_dns_record_set" "A_timestamp" {
project = var.project_id
managed_zone = var.dns_zone_name

rrdatas = [var.load_balancer_ipv4]
rrdatas = [google_compute_global_address.gce_lb_ipv4.address]
}

// Create a static global IP for the external IPV4 GCE L7 load balancer
resource "google_compute_global_address" "gce_lb_ipv4" {
name = format("timestamp-%s-gce-ext-lb", var.cluster_name)
address_type = "EXTERNAL"
project = var.project_id
}
5 changes: 0 additions & 5 deletions terraform/gcp/modules/timestamp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,3 @@ variable "dns_domain_name" {
description = "Name of DNS domain name in Google Cloud DNS"
type = string
}

variable "load_balancer_ipv4" {
description = "IPv4 adddress of external load balancer"
type = string
}

0 comments on commit 4e9f2ff

Please sign in to comment.