Fix range names definition of GKE clusters

Fixes #1677
This commit is contained in:
Julio Castillo 2023-09-14 12:51:43 +02:00
parent 05c0195a06
commit c1be435b09
7 changed files with 37 additions and 42 deletions

View File

@ -20,12 +20,9 @@ module "cluster" {
name = "cluster" name = "cluster"
location = var.region location = var.region
vpc_config = { vpc_config = {
network = module.vpc.self_link network = module.vpc.self_link
subnetwork = module.vpc.subnet_self_links["${var.region}/subnet-apigee"] subnetwork = module.vpc.subnet_self_links["${var.region}/subnet-apigee"]
secondary_range_names = { secondary_range_names = {}
pods = "pods"
services = "services"
}
master_authorized_ranges = var.cluster_network_config.master_authorized_cidr_blocks master_authorized_ranges = var.cluster_network_config.master_authorized_cidr_blocks
master_ipv4_cidr_block = var.cluster_network_config.master_cidr_block master_ipv4_cidr_block = var.cluster_network_config.master_cidr_block
} }
@ -79,4 +76,4 @@ module "apigee-runtime-nodepool" {
create = true create = true
} }
tags = ["node"] tags = ["node"]
} }

View File

@ -20,12 +20,9 @@ module "cluster" {
name = "cluster" name = "cluster"
location = var.region location = var.region
vpc_config = { vpc_config = {
network = module.vpc.self_link network = module.vpc.self_link
subnetwork = module.vpc.subnet_self_links["${var.region}/subnet-cluster"] subnetwork = module.vpc.subnet_self_links["${var.region}/subnet-cluster"]
secondary_range_names = { secondary_range_names = {}
pods = "pods"
services = "services"
}
master_authorized_ranges = var.cluster_network_config.master_authorized_cidr_blocks master_authorized_ranges = var.cluster_network_config.master_authorized_cidr_blocks
master_ipv4_cidr_block = var.cluster_network_config.master_cidr_block master_ipv4_cidr_block = var.cluster_network_config.master_cidr_block
} }
@ -51,4 +48,4 @@ module "node_sa" {
source = "../../../modules/iam-service-account" source = "../../../modules/iam-service-account"
project_id = module.project.project_id project_id = module.project.project_id
name = "sa-node" name = "sa-node"
} }

View File

@ -1,5 +1,5 @@
/** /**
* Copyright 2022 Google LLC * Copyright 2023 Google LLC
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -82,9 +82,9 @@ variable "clusters" {
services = string services = string
})) }))
secondary_range_names = optional(object({ secondary_range_names = optional(object({
pods = string pods = optional(string, "pods")
services = string services = optional(string, "services")
}), { pods = "pods", services = "services" }) }))
master_authorized_ranges = optional(map(string)) master_authorized_ranges = optional(map(string))
master_ipv4_cidr_block = optional(string) master_ipv4_cidr_block = optional(string)
}) })

View File

@ -64,7 +64,7 @@ module "cluster-1" {
vpc_config = { vpc_config = {
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
secondary_range_names = { pods = "pods", services = "services" } secondary_range_names = {} # use default names "pods" and "services"
} }
enable_features = { enable_features = {
dns = { dns = {
@ -91,8 +91,9 @@ module "cluster-1" {
name = "cluster-1" name = "cluster-1"
location = "europe-west1" location = "europe-west1"
vpc_config = { vpc_config = {
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
secondary_range_names = {} # use default names "pods" and "services"
} }
logging_config = { logging_config = {
enable_api_server_logs = true enable_api_server_logs = true
@ -120,8 +121,9 @@ module "cluster-1" {
name = "cluster-1" name = "cluster-1"
location = "europe-west1" location = "europe-west1"
vpc_config = { vpc_config = {
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
secondary_range_names = {} # use default names "pods" and "services"
} }
monitoring_config = { monitoring_config = {
enable_api_server_metrics = true enable_api_server_metrics = true
@ -155,7 +157,7 @@ module "cluster-1" {
vpc_config = { vpc_config = {
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
secondary_range_names = { pods = "pods", services = "services" } secondary_range_names = { }
} }
backup_configs = { backup_configs = {
enable_backup_agent = true enable_backup_agent = true

View File

@ -233,9 +233,9 @@ variable "vpc_config" {
services = string services = string
})) }))
secondary_range_names = optional(object({ secondary_range_names = optional(object({
pods = string pods = optional(string, "pods")
services = string services = optional(string, "services")
}), { pods = "pods", services = "services" }) }))
master_authorized_ranges = optional(map(string)) master_authorized_ranges = optional(map(string))
stack_type = optional(string) stack_type = optional(string)
}) })

View File

@ -45,12 +45,9 @@ module "cluster-1" {
name = "cluster-dataplane-v2" name = "cluster-dataplane-v2"
location = "europe-west1-b" location = "europe-west1-b"
vpc_config = { vpc_config = {
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
secondary_range_names = { secondary_range_names = {} # use default names "pods" and "services"
pods = "pods"
services = "services"
}
master_authorized_ranges = { master_authorized_ranges = {
internal-vms = "10.0.0.0/8" internal-vms = "10.0.0.0/8"
} }
@ -84,8 +81,9 @@ module "cluster-1" {
name = "cluster-1" name = "cluster-1"
location = "europe-west1-b" location = "europe-west1-b"
vpc_config = { vpc_config = {
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
secondary_range_names = {}
} }
logging_config = { logging_config = {
enable_workloads_logs = true enable_workloads_logs = true
@ -113,8 +111,9 @@ module "cluster-1" {
name = "cluster-1" name = "cluster-1"
location = "europe-west1-b" location = "europe-west1-b"
vpc_config = { vpc_config = {
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
secondary_range_names = {}
} }
logging_config = { logging_config = {
enable_system_logs = false enable_system_logs = false
@ -136,7 +135,7 @@ module "cluster-1" {
vpc_config = { vpc_config = {
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
secondary_range_names = { pods = "pods", services = "services" } secondary_range_names = {}
} }
enable_features = { enable_features = {
dns = { dns = {
@ -162,7 +161,7 @@ module "cluster-1" {
vpc_config = { vpc_config = {
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
secondary_range_names = { pods = "pods", services = "services" } secondary_range_names = { }
} }
backup_configs = { backup_configs = {
enable_backup_agent = true enable_backup_agent = true

View File

@ -261,9 +261,9 @@ variable "vpc_config" {
services = string services = string
})) }))
secondary_range_names = optional(object({ secondary_range_names = optional(object({
pods = string pods = optional(string, "pods")
services = string services = optional(string, "services")
}), { pods = "pods", services = "services" }) }))
master_authorized_ranges = optional(map(string)) master_authorized_ranges = optional(map(string))
stack_type = optional(string) stack_type = optional(string)
}) })