Skip to content

Commit 377e39f

Browse files
feat: allow module to use legacy logging options, define maintenance windows and allow intranode visibility (#62)
* feat: allow module to use legacy logging options, define maintenance windows and allow intranode visibility * docs: docs * fix: allow customization of maintenance times
1 parent 98c5e2f commit 377e39f

File tree

3 files changed

+69
-21
lines changed

3 files changed

+69
-21
lines changed

vpc-native-beta/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## vpc-native-beta-v1.7.0
2+
3+
- Enables Intranode Visibility Customization
4+
- Adds 9am-5pm Monday-Friday maintenance window
5+
- Allows using legacy logging and monitoring service variables
6+
7+
## vpc-native-beta-v1.6.0
8+
9+
- Enables logging and monitoring config values in module
10+
111
## vpc-native-beta-v1.5.2
212

313
- Enables GCP cost allocation for clusters

vpc-native-beta/inputs.tf

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,21 @@ variable "master_authorized_network_cidrs" {
4949
]
5050
}
5151

52-
variable "maintenance_policy_start_time" {
52+
53+
variable "maintenance_policy_window_start_time" {
54+
description = "The time (in GMT) when the cluster maintenance window will start."
55+
default = "1970-01-01T13:00:00Z"
56+
type = string
57+
}
58+
variable "maintenance_policy_window_end_time" {
59+
description = "The time (in GMT) when the cluster maintenance window will start."
60+
default = "1970-01-01T21:00:00Z"
61+
type = string
62+
}
63+
variable "maintenance_policy_window_recurrence" {
5364
description = "The time (in GMT) when the cluster maintenance window will start."
54-
default = "06:00"
65+
default = "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR"
66+
type = string
5567
}
5668

5769
variable "enable_private_endpoint" {
@@ -71,12 +83,22 @@ variable "master_ipv4_cidr_block" {
7183

7284
variable "monitoring_config" {
7385
description = "Exposes metrics cluster components."
74-
default = [ "SYSTEM_COMPONENTS" ]
86+
default = null
7587
}
7688

7789
variable "logging_config" {
7890
description = "Exposes logs for cluster components."
79-
default = [ "SYSTEM_COMPONENTS" ]
91+
default = null
92+
}
93+
94+
variable "monitoring_service" {
95+
description = "Exposes metrics cluster components."
96+
default = "monitoring.googleapis.com/kubernetes"
97+
}
98+
99+
variable "logging_service" {
100+
description = "Exposes logs for cluster components."
101+
default = "logging.googleapis.com/kubernetes"
80102
}
81103

82104
variable "vpa_enabled" {
@@ -96,6 +118,12 @@ variable "enable_shielded_nodes" {
96118
default = false
97119
}
98120

121+
variable "enable_intranode_visibility" {
122+
type = bool
123+
description = "A boolean to enable intranode-visbility in the cluster"
124+
default = false
125+
}
126+
99127
variable "enable_node_local_dns_cache" {
100128
type = bool
101129
description = "A boolean to enable NodeLocal DNSCache"

vpc-native-beta/main.tf

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ locals {
55
}
66

77
resource "google_container_cluster" "cluster" {
8-
provider = google-beta
9-
name = var.name
10-
location = var.region
11-
min_master_version = var.kubernetes_version
12-
network = var.network_name
13-
subnetwork = var.nodes_subnetwork_name
14-
enable_shielded_nodes = var.enable_shielded_nodes
15-
16-
8+
provider = google-beta
9+
name = var.name
10+
location = var.region
11+
min_master_version = var.kubernetes_version
12+
network = var.network_name
13+
subnetwork = var.nodes_subnetwork_name
14+
enable_shielded_nodes = var.enable_shielded_nodes
15+
enable_intranode_visibility = var.enable_intranode_visibility
16+
monitoring_service = var.monitoring_service
17+
logging_service = var.logging_service
1718
vertical_pod_autoscaling {
1819
enabled = var.vpa_enabled
1920
}
@@ -38,13 +39,20 @@ resource "google_container_cluster" "cluster" {
3839
channel = var.release_channel
3940
}
4041

41-
logging_config {
42-
enable_components = var.logging_config
42+
dynamic "logging_config" {
43+
for_each = var.logging_config != null ? [1] : []
44+
content {
45+
enable_components = var.logging_config
46+
}
4347
}
44-
monitoring_config {
45-
enable_components = var.monitoring_config
46-
managed_prometheus {
47-
enabled = var.enable_managed_prometheus
48+
49+
dynamic "monitoring_config" {
50+
for_each = var.monitoring_config != null ? [1] : []
51+
content {
52+
enable_components = var.monitoring_config
53+
managed_prometheus {
54+
enabled = var.enable_managed_prometheus
55+
}
4856
}
4957
}
5058
private_cluster_config {
@@ -115,8 +123,10 @@ resource "google_container_cluster" "cluster" {
115123
}
116124

117125
maintenance_policy {
118-
daily_maintenance_window {
119-
start_time = var.maintenance_policy_start_time
126+
recurring_window {
127+
start_time = var.maintenance_policy_window_start_time
128+
end_time = var.maintenance_policy_window_end_time
129+
recurrence = var.maintenance_policy_window_recurrence
120130
}
121131
}
122132

0 commit comments

Comments
 (0)