-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider update maintenancy_policy after cluster version update #20556
Consider update maintenancy_policy after cluster version update #20556
Comments
Should be a straight forward update assuming this is an allowable order of operations change. |
Hi @NickElliot Thank you for the reply, here is the reproducible step:
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 6.0"
}
}
}
provider "google" {
project = "<project-id>"
region = "us-central1" # Or your preferred region
zone = "us-central1-a" # Or your preferred zone
}
resource "google_container_cluster" "primary" {
name = "test-gke-cluster-1"
location = "us-central1" # Or your preferred region
initial_node_count = 1
remove_default_node_pool = true
master_auth {
client_certificate_config {
issue_client_certificate = false
}
}
}
resource "google_container_node_pool" "default-pool" {
name = "default-node-pool"
location = "us-central1"
cluster = google_container_cluster.primary.name
node_count = 1
node_config {
machine_type = "e2-medium"
oauth_scopes = [
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
}
}
output "cluster_name" {
value = google_container_cluster.primary.name
}
output "cluster_endpoint" {
value = google_container_cluster.primary.endpoint
}
output "node_pool_name" {
value = google_container_node_pool.default-pool.name
}
at the moment, the created cluster should be with default version which is 1.30.* in Regular Channel, and the support date end on 2025-09-30 as it shows here, https://cloud.google.com/kubernetes-engine/docs/release-schedule
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 6.0"
}
}
}
provider "google" {
project = "<project-id>"
region = "us-central1" # Or your preferred region
zone = "us-central1-a" # Or your preferred zone
}
resource "google_container_cluster" "primary" {
name = "test-gke-cluster-1"
location = "us-central1" # Or your preferred region
initial_node_count = 1
remove_default_node_pool = true
min_master_version = "1.31"
maintenance_policy {
recurring_window {
start_time = "2019-01-01T00:00:00Z"
end_time = "2019-01-02T00:00:00Z"
recurrence = "FREQ=DAILY"
}
maintenance_exclusion{
exclusion_name = "testname"
start_time = "2019-05-01T00:00:00Z"
end_time = "2025-10-30T00:00:00Z"
exclusion_options {
scope = "NO_MINOR_UPGRADES"
}
}
}
master_auth {
client_certificate_config {
issue_client_certificate = false
}
}
}
resource "google_container_node_pool" "default-pool" {
name = "default-node-pool"
location = "us-central1"
cluster = google_container_cluster.primary.name
node_count = 1
node_config {
machine_type = "e2-medium"
oauth_scopes = [
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
}
}
output "cluster_name" {
value = google_container_cluster.primary.name
}
output "cluster_endpoint" {
value = google_container_cluster.primary.endpoint
}
output "node_pool_name" {
value = google_container_node_pool.default-pool.name
} note that the end time is set to
|
I can look at this |
Community Note
Terraform Version & Provider Version(s)
Terraform vX.X.X
on
Affected Resource(s)
google_container_cluster
Terraform Configuration
Debug Output
No response
Expected Behavior
maintenance_policy.maintenance_exclusion update should happen after min_master_version update or these two updates should happen in the same request, this allows users to configure maintenance_exclusion end_time for cluster version specified in min_master_version, if both are set explicitly.
Actual Behavior
When updating min_master_version and maintenance_exclusion at the same time, we could get an error, as the maintenance_exclusion update request sent before min_master_version update, so gcp side check the maintenance_exclusion.end_time against the existing cluster version which may not be the same as what specified in terraform file, the new min_master_version may be newer than the existing one and the exclusion_rule.end_time was set for that new version, hence it is possible the end_time exceeds the existing cluster support date, then the gcp server will throw us an error.
Steps to reproduce
terraform apply
Important Factoids
No response
References
No response
b/382558706
The text was updated successfully, but these errors were encountered: