Skip to content

Commit

Permalink
chore: cleanup unused autopilot vars (#1170)
Browse files Browse the repository at this point in the history
* chore: cleanup unused autopilot vars

* address comments
  • Loading branch information
bharathkkb authored Mar 10, 2022
1 parent a68fe69 commit 325ee8e
Show file tree
Hide file tree
Showing 26 changed files with 1,034 additions and 1,496 deletions.
10 changes: 6 additions & 4 deletions autogen/main/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ locals {

release_channel = var.release_channel != null ? [{ channel : var.release_channel }] : []

{% if autopilot_cluster != true %}
autoscaling_resource_limits = var.cluster_autoscaling.enabled ? concat([{
resource_type = "cpu"
minimum = var.cluster_autoscaling.min_cpu_cores
Expand All @@ -65,6 +66,7 @@ locals {
minimum = var.cluster_autoscaling.min_memory_gb
maximum = var.cluster_autoscaling.max_memory_gb
}], var.cluster_autoscaling.gpu_resources) : []
{% endif %}


custom_kube_dns_config = length(keys(var.stub_domains)) > 0
Expand Down Expand Up @@ -92,7 +94,7 @@ locals {
provider = null
}]
{% endif %}
{% if beta_cluster %}
{% if beta_cluster and autopilot_cluster != true %}
cluster_cloudrun_config_load_balancer_config = (var.cloudrun && var.cloudrun_load_balancer_type != "") ? {
load_balancer_type = var.cloudrun_load_balancer_type
} : {}
Expand All @@ -104,21 +106,22 @@ locals {
local.cluster_cloudrun_config_load_balancer_config
)
] : []

cluster_cloudrun_enabled = var.cloudrun
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]

{% endif %}

cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
security_group = var.authenticator_security_group
}]

{% if autopilot_cluster != true %}
// legacy mappings https://github.com/hashicorp/terraform-provider-google/pull/10238
old_node_metadata_config_mapping = { GKE_METADATA_SERVER = "GKE_METADATA", GCE_METADATA = "EXPOSE" }

cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
mode = lookup(local.old_node_metadata_config_mapping, var.node_metadata, var.node_metadata)
}]
{% endif %}

cluster_output_name = google_container_cluster.primary.name
cluster_output_regional_zones = google_container_cluster.primary.node_locations
Expand Down Expand Up @@ -192,7 +195,6 @@ locals {
{% if beta_cluster %}
# BETA features
cluster_istio_enabled = ! local.cluster_output_istio_disabled
cluster_cloudrun_enabled = var.cloudrun
cluster_dns_cache_enabled = var.dns_cache
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
Expand Down
14 changes: 9 additions & 5 deletions autogen/main/outputs.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,18 @@ output "peering_name" {
{% endif %}
{% if beta_cluster %}

output "istio_enabled" {
description = "Whether Istio is enabled"
value = local.cluster_istio_enabled
}

output "cloudrun_enabled" {
description = "Whether CloudRun enabled"
{% if autopilot_cluster != true %}
value = local.cluster_cloudrun_enabled
{% else %}
value = false
{% endif %}
}

output "istio_enabled" {
description = "Whether Istio is enabled"
value = local.cluster_istio_enabled
}

output "dns_cache_enabled" {
Expand Down
Loading

0 comments on commit 325ee8e

Please sign in to comment.