Skip to content

Commit 8e33d19

Browse files
DrFaust92apeabody
andauthored
feat(TPG>=6.27)!: add support for HPA profile + logs (#2323)
Signed-off-by: drfaust92 <[email protected]> Co-authored-by: Andrew Peabody <[email protected]>
1 parent f6d55e9 commit 8e33d19

File tree

40 files changed

+178
-61
lines changed

40 files changed

+178
-61
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ Then perform the following commands on the root folder:
203203
| ip\_range\_services | The _name_ of the secondary subnet range to use for services | `string` | n/a | yes |
204204
| issue\_client\_certificate | Issues a client certificate to authenticate to the cluster endpoint. To maximize the security of your cluster, leave this option disabled. Client certificates don't automatically rotate and aren't easily revocable. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
205205
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | `string` | `"latest"` | no |
206-
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, APISERVER, CONTROLLER\_MANAGER, KCP\_CONNECTION, KCP\_SSHD, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
206+
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, APISERVER, CONTROLLER\_MANAGER, KCP\_CONNECTION, KCP\_SSHD, KCP\_HPA, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
207207
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
208208
| logging\_variant | (Optional) The type of logging agent that is deployed by default for newly created node pools in the cluster. Valid values include DEFAULT and MAX\_THROUGHPUT. | `string` | `null` | no |
209209
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
@@ -399,7 +399,7 @@ The [project factory](https://github.com/terraform-google-modules/terraform-goog
399399
- [kubectl](https://github.com/kubernetes/kubernetes/releases) 1.9.x
400400
#### Terraform and Plugins
401401
- [Terraform](https://www.terraform.io/downloads.html) 1.3+
402-
- [Terraform Provider for GCP][terraform-provider-google] v6.14+
402+
- [Terraform Provider for GCP][terraform-provider-google] v6.27+
403403
#### gcloud
404404
Some submodules use the [terraform-google-gcloud](https://github.com/terraform-google-modules/terraform-google-gcloud) module. By default, this module assumes you already have gcloud installed in your $PATH.
405405
See the [module](https://github.com/terraform-google-modules/terraform-google-gcloud#downloading) documentation for more information.

autogen/main/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ The [project factory](https://github.com/terraform-google-modules/terraform-goog
290290
#### Terraform and Plugins
291291
- [Terraform](https://www.terraform.io/downloads.html) 1.3+
292292
{% if beta_cluster %}
293-
- [Terraform Provider for GCP Beta][terraform-provider-google-beta] v6.14+
293+
- [Terraform Provider for GCP Beta][terraform-provider-google-beta] v6.27+
294294
{% else %}
295-
- [Terraform Provider for GCP][terraform-provider-google] v6.14+
295+
- [Terraform Provider for GCP][terraform-provider-google] v6.27+
296296
{% endif %}
297297
#### gcloud
298298
Some submodules use the [terraform-google-gcloud](https://github.com/terraform-google-modules/terraform-google-gcloud) module. By default, this module assumes you already have gcloud installed in your $PATH.

autogen/main/cluster.tf.tmpl

+9
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,15 @@ resource "google_container_cluster" "primary" {
260260
}
261261
}
262262

263+
{% if beta_cluster %}
264+
dynamic "pod_autoscaling" {
265+
for_each = length(var.hpa_profile) > 0 ? [1] : []
266+
content {
267+
hpa_profile = var.hpa_profile
268+
}
269+
}
270+
{% endif %}
271+
263272
dynamic "enterprise_config" {
264273
for_each = var.enterprise_config != null ? [1] : []
265274
content {

autogen/main/variables.tf.tmpl

+11-2
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,14 @@ variable "enable_confidential_nodes" {
624624
description = "An optional flag to enable confidential node config."
625625
default = false
626626
}
627+
628+
{% if beta_cluster %}
629+
variable "hpa_profile" {
630+
description = "Enable the Horizontal Pod Autoscaling profile for this cluster. Values are \"NONE\" and \"PERFORMANCE\"."
631+
type = string
632+
default = ""
633+
}
634+
{% endif %}
627635
{% if autopilot_cluster != true %}
628636

629637
variable "enable_gcfs" {
@@ -907,7 +915,7 @@ variable "monitoring_enabled_components" {
907915

908916
variable "logging_enabled_components" {
909917
type = list(string)
910-
description = "List of services to monitor: SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, KCP_CONNECTION, KCP_SSHD, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration."
918+
description = "List of services to monitor: SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, KCP_CONNECTION, KCP_SSHD, KCP_HPA, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration."
911919
default = []
912920
validation {
913921
condition = alltrue([
@@ -919,10 +927,11 @@ variable "logging_enabled_components" {
919927
"SCHEDULER",
920928
"KCP_CONNECTION",
921929
"KCP_SSHD",
930+
"KCP_HPA",
922931
"WORKLOADS"
923932
], c)
924933
])
925-
error_message = "Valid values are SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, SCHEDULER, KCP_CONNECTION, KCP_SSHD and WORKLOADS."
934+
error_message = "Valid values are SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, SCHEDULER, KCP_CONNECTION, KCP_SSHD, KCP_HPA and WORKLOADS."
926935
}
927936
}
928937

autogen/main/versions.tf.tmpl

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,33 @@ terraform {
2424
required_providers {
2525
google = {
2626
source = "hashicorp/google"
27-
version = ">= 6.14.0, < 7"
27+
version = ">= 6.27.0, < 7"
2828
}
2929
google-beta = {
3030
source = "hashicorp/google-beta"
31-
version = ">= 6.14.0, < 7"
31+
version = ">= 6.27.0, < 7"
3232
}
3333
{% elif beta_cluster and autopilot_cluster %}
3434
required_providers {
3535
google = {
3636
source = "hashicorp/google"
37-
version = ">= 6.14.0, < 7"
37+
version = ">= 6.27.0, < 7"
3838
}
3939
google-beta = {
4040
source = "hashicorp/google-beta"
41-
version = ">= 6.14.0, < 7"
41+
version = ">= 6.27.0, < 7"
4242
}
4343
{% elif autopilot_cluster %}
4444
required_providers {
4545
google = {
4646
source = "hashicorp/google"
47-
version = ">= 6.14.0, < 7"
47+
version = ">= 6.27.0, < 7"
4848
}
4949
{% else %}
5050
required_providers {
5151
google = {
5252
source = "hashicorp/google"
53-
version = ">= 6.14.0, < 7"
53+
version = ">= 6.27.0, < 7"
5454
}
5555
{% endif %}
5656
kubernetes = {

cluster.tf

+1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ resource "google_container_cluster" "primary" {
199199
}
200200
}
201201

202+
202203
dynamic "enterprise_config" {
203204
for_each = var.enterprise_config != null ? [1] : []
204205
content {

modules/beta-autopilot-private-cluster/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ Then perform the following commands on the root folder:
113113
| gke\_backup\_agent\_config | Whether Backup for GKE agent is enabled for this cluster. | `bool` | `false` | no |
114114
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer and artifactregistry.reader roles. | `bool` | `false` | no |
115115
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | `bool` | `true` | no |
116+
| hpa\_profile | Enable the Horizontal Pod Autoscaling profile for this cluster. Values are "NONE" and "PERFORMANCE". | `string` | `""` | no |
116117
| http\_load\_balancing | Enable httpload balancer addon | `bool` | `true` | no |
117118
| identity\_namespace | The workload pool to attach all Kubernetes service accounts to. (Default value of `enabled` automatically sets project-based pool `[project_id].svc.id.goog`) | `string` | `"enabled"` | no |
118119
| insecure\_kubelet\_readonly\_port\_enabled | Whether or not to set `insecure_kubelet_readonly_port_enabled` for node pool defaults and autopilot clusters. | `bool` | `null` | no |
@@ -122,7 +123,7 @@ Then perform the following commands on the root folder:
122123
| ip\_range\_services | The _name_ of the secondary subnet range to use for services | `string` | n/a | yes |
123124
| issue\_client\_certificate | Issues a client certificate to authenticate to the cluster endpoint. To maximize the security of your cluster, leave this option disabled. Client certificates don't automatically rotate and aren't easily revocable. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
124125
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | `string` | `"latest"` | no |
125-
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, APISERVER, CONTROLLER\_MANAGER, KCP\_CONNECTION, KCP\_SSHD, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
126+
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, APISERVER, CONTROLLER\_MANAGER, KCP\_CONNECTION, KCP\_SSHD, KCP\_HPA, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
126127
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
127128
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
128129
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
@@ -219,7 +220,7 @@ The [project factory](https://github.com/terraform-google-modules/terraform-goog
219220
- [kubectl](https://github.com/kubernetes/kubernetes/releases) 1.9.x
220221
#### Terraform and Plugins
221222
- [Terraform](https://www.terraform.io/downloads.html) 1.3+
222-
- [Terraform Provider for GCP Beta][terraform-provider-google-beta] v6.14+
223+
- [Terraform Provider for GCP Beta][terraform-provider-google-beta] v6.27+
223224
#### gcloud
224225
Some submodules use the [terraform-google-gcloud](https://github.com/terraform-google-modules/terraform-google-gcloud) module. By default, this module assumes you already have gcloud installed in your $PATH.
225226
See the [module](https://github.com/terraform-google-modules/terraform-google-gcloud#downloading) documentation for more information.

modules/beta-autopilot-private-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ resource "google_container_cluster" "primary" {
119119
}
120120
}
121121

122+
dynamic "pod_autoscaling" {
123+
for_each = length(var.hpa_profile) > 0 ? [1] : []
124+
content {
125+
hpa_profile = var.hpa_profile
126+
}
127+
}
128+
122129
dynamic "enterprise_config" {
123130
for_each = var.enterprise_config != null ? [1] : []
124131
content {

modules/beta-autopilot-private-cluster/variables.tf

+9-2
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,12 @@ variable "enable_confidential_nodes" {
409409
default = false
410410
}
411411

412+
variable "hpa_profile" {
413+
description = "Enable the Horizontal Pod Autoscaling profile for this cluster. Values are \"NONE\" and \"PERFORMANCE\"."
414+
type = string
415+
default = ""
416+
}
417+
412418
variable "enable_secret_manager_addon" {
413419
description = "Enable the Secret Manager add-on for this cluster"
414420
type = bool
@@ -571,7 +577,7 @@ variable "monitoring_enabled_components" {
571577

572578
variable "logging_enabled_components" {
573579
type = list(string)
574-
description = "List of services to monitor: SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, KCP_CONNECTION, KCP_SSHD, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration."
580+
description = "List of services to monitor: SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, KCP_CONNECTION, KCP_SSHD, KCP_HPA, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration."
575581
default = []
576582
validation {
577583
condition = alltrue([
@@ -583,10 +589,11 @@ variable "logging_enabled_components" {
583589
"SCHEDULER",
584590
"KCP_CONNECTION",
585591
"KCP_SSHD",
592+
"KCP_HPA",
586593
"WORKLOADS"
587594
], c)
588595
])
589-
error_message = "Valid values are SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, SCHEDULER, KCP_CONNECTION, KCP_SSHD and WORKLOADS."
596+
error_message = "Valid values are SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, SCHEDULER, KCP_CONNECTION, KCP_SSHD, KCP_HPA and WORKLOADS."
590597
}
591598
}
592599

modules/beta-autopilot-private-cluster/versions.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ terraform {
2121
required_providers {
2222
google = {
2323
source = "hashicorp/google"
24-
version = ">= 6.14.0, < 7"
24+
version = ">= 6.27.0, < 7"
2525
}
2626
google-beta = {
2727
source = "hashicorp/google-beta"
28-
version = ">= 6.14.0, < 7"
28+
version = ">= 6.27.0, < 7"
2929
}
3030
kubernetes = {
3131
source = "hashicorp/kubernetes"

modules/beta-autopilot-public-cluster/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ Then perform the following commands on the root folder:
105105
| gke\_backup\_agent\_config | Whether Backup for GKE agent is enabled for this cluster. | `bool` | `false` | no |
106106
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer and artifactregistry.reader roles. | `bool` | `false` | no |
107107
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | `bool` | `true` | no |
108+
| hpa\_profile | Enable the Horizontal Pod Autoscaling profile for this cluster. Values are "NONE" and "PERFORMANCE". | `string` | `""` | no |
108109
| http\_load\_balancing | Enable httpload balancer addon | `bool` | `true` | no |
109110
| identity\_namespace | The workload pool to attach all Kubernetes service accounts to. (Default value of `enabled` automatically sets project-based pool `[project_id].svc.id.goog`) | `string` | `"enabled"` | no |
110111
| insecure\_kubelet\_readonly\_port\_enabled | Whether or not to set `insecure_kubelet_readonly_port_enabled` for node pool defaults and autopilot clusters. | `bool` | `null` | no |
@@ -114,7 +115,7 @@ Then perform the following commands on the root folder:
114115
| ip\_range\_services | The _name_ of the secondary subnet range to use for services | `string` | n/a | yes |
115116
| issue\_client\_certificate | Issues a client certificate to authenticate to the cluster endpoint. To maximize the security of your cluster, leave this option disabled. Client certificates don't automatically rotate and aren't easily revocable. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
116117
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | `string` | `"latest"` | no |
117-
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, APISERVER, CONTROLLER\_MANAGER, KCP\_CONNECTION, KCP\_SSHD, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
118+
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, APISERVER, CONTROLLER\_MANAGER, KCP\_CONNECTION, KCP\_SSHD, KCP\_HPA, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
118119
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
119120
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
120121
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
@@ -206,7 +207,7 @@ The [project factory](https://github.com/terraform-google-modules/terraform-goog
206207
- [kubectl](https://github.com/kubernetes/kubernetes/releases) 1.9.x
207208
#### Terraform and Plugins
208209
- [Terraform](https://www.terraform.io/downloads.html) 1.3+
209-
- [Terraform Provider for GCP Beta][terraform-provider-google-beta] v6.14+
210+
- [Terraform Provider for GCP Beta][terraform-provider-google-beta] v6.27+
210211
#### gcloud
211212
Some submodules use the [terraform-google-gcloud](https://github.com/terraform-google-modules/terraform-google-gcloud) module. By default, this module assumes you already have gcloud installed in your $PATH.
212213
See the [module](https://github.com/terraform-google-modules/terraform-google-gcloud#downloading) documentation for more information.

modules/beta-autopilot-public-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ resource "google_container_cluster" "primary" {
119119
}
120120
}
121121

122+
dynamic "pod_autoscaling" {
123+
for_each = length(var.hpa_profile) > 0 ? [1] : []
124+
content {
125+
hpa_profile = var.hpa_profile
126+
}
127+
}
128+
122129
dynamic "enterprise_config" {
123130
for_each = var.enterprise_config != null ? [1] : []
124131
content {

modules/beta-autopilot-public-cluster/variables.tf

+9-2
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,12 @@ variable "enable_confidential_nodes" {
373373
default = false
374374
}
375375

376+
variable "hpa_profile" {
377+
description = "Enable the Horizontal Pod Autoscaling profile for this cluster. Values are \"NONE\" and \"PERFORMANCE\"."
378+
type = string
379+
default = ""
380+
}
381+
376382
variable "enable_secret_manager_addon" {
377383
description = "Enable the Secret Manager add-on for this cluster"
378384
type = bool
@@ -535,7 +541,7 @@ variable "monitoring_enabled_components" {
535541

536542
variable "logging_enabled_components" {
537543
type = list(string)
538-
description = "List of services to monitor: SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, KCP_CONNECTION, KCP_SSHD, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration."
544+
description = "List of services to monitor: SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, KCP_CONNECTION, KCP_SSHD, KCP_HPA, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration."
539545
default = []
540546
validation {
541547
condition = alltrue([
@@ -547,10 +553,11 @@ variable "logging_enabled_components" {
547553
"SCHEDULER",
548554
"KCP_CONNECTION",
549555
"KCP_SSHD",
556+
"KCP_HPA",
550557
"WORKLOADS"
551558
], c)
552559
])
553-
error_message = "Valid values are SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, SCHEDULER, KCP_CONNECTION, KCP_SSHD and WORKLOADS."
560+
error_message = "Valid values are SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, SCHEDULER, KCP_CONNECTION, KCP_SSHD, KCP_HPA and WORKLOADS."
554561
}
555562
}
556563

modules/beta-autopilot-public-cluster/versions.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ terraform {
2121
required_providers {
2222
google = {
2323
source = "hashicorp/google"
24-
version = ">= 6.14.0, < 7"
24+
version = ">= 6.27.0, < 7"
2525
}
2626
google-beta = {
2727
source = "hashicorp/google-beta"
28-
version = ">= 6.14.0, < 7"
28+
version = ">= 6.27.0, < 7"
2929
}
3030
kubernetes = {
3131
source = "hashicorp/kubernetes"

0 commit comments

Comments
 (0)