Skip to content

Commit 4f39da5

Browse files
authored
Remove relay_mode field support (#10274)
Signed-off-by: Michal Siwinski <[email protected]>
1 parent 6106c33 commit 4f39da5

File tree

4 files changed

+39
-173
lines changed

4 files changed

+39
-173
lines changed

mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb

+6-47
Original file line numberDiff line numberDiff line change
@@ -1290,20 +1290,9 @@ func ResourceContainerCluster() *schema.Resource {
12901290
Description: `Whether or not the advanced datapath metrics are enabled.`,
12911291
},
12921292
"enable_relay": {
1293-
Type: schema.TypeBool,
1294-
Optional: true,
1295-
Description: `Whether or not Relay is enabled.`,
1296-
Default: false,
1297-
ConflictsWith: []string{"monitoring_config.0.advanced_datapath_observability_config.0.relay_mode"},
1298-
},
1299-
"relay_mode": {
1300-
Type: schema.TypeString,
1301-
Optional: true,
1302-
Computed: true,
1303-
Deprecated: "Deprecated in favor of enable_relay field. Remove this attribute's configuration as this field will be removed in the next major release and enable_relay will become a required field.",
1304-
Description: `Mode used to make Relay available.`,
1305-
ValidateFunc: validation.StringInSlice([]string{"DISABLED", "INTERNAL_VPC_LB", "EXTERNAL_LB"}, false),
1306-
ConflictsWith: []string{"monitoring_config.0.advanced_datapath_observability_config.0.enable_relay"},
1293+
Type: schema.TypeBool,
1294+
Required: true,
1295+
Description: `Whether or not Relay is enabled.`,
13071296
},
13081297
},
13091298
},
@@ -5587,21 +5576,10 @@ func expandMonitoringConfig(configured interface{}) *container.MonitoringConfig
55875576

55885577
if v, ok := config["advanced_datapath_observability_config"]; ok && len(v.([]interface{})) > 0 {
55895578
advanced_datapath_observability_config := v.([]interface{})[0].(map[string]interface{})
5590-
55915579
mc.AdvancedDatapathObservabilityConfig = &container.AdvancedDatapathObservabilityConfig{
55925580
EnableMetrics: advanced_datapath_observability_config["enable_metrics"].(bool),
5593-
}
5594-
5595-
enable_relay := advanced_datapath_observability_config["enable_relay"].(bool)
5596-
relay_mode := advanced_datapath_observability_config["relay_mode"].(string)
5597-
if enable_relay {
5598-
mc.AdvancedDatapathObservabilityConfig.EnableRelay = enable_relay
5599-
} else if relay_mode == "INTERNAL_VPC_LB" || relay_mode == "EXTERNAL_LB" {
5600-
mc.AdvancedDatapathObservabilityConfig.RelayMode = relay_mode
5601-
} else {
5602-
mc.AdvancedDatapathObservabilityConfig.EnableRelay = enable_relay
5603-
mc.AdvancedDatapathObservabilityConfig.RelayMode = "DISABLED"
5604-
mc.AdvancedDatapathObservabilityConfig.ForceSendFields = []string{"EnableRelay"}
5581+
EnableRelay: advanced_datapath_observability_config["enable_relay"].(bool),
5582+
ForceSendFields: []string{"EnableRelay"},
56055583
}
56065584
}
56075585

@@ -6496,29 +6474,10 @@ func flattenAdvancedDatapathObservabilityConfig(c *container.AdvancedDatapathObs
64966474
return nil
64976475
}
64986476

6499-
if c.EnableRelay {
6500-
return []map[string]interface{}{
6501-
{
6502-
"enable_metrics": c.EnableMetrics,
6503-
"enable_relay": c.EnableRelay,
6504-
},
6505-
}
6506-
}
6507-
6508-
if c.RelayMode == "INTERNAL_VPC_LB" || c.RelayMode == "EXTERNAL_LB" {
6509-
return []map[string]interface{}{
6510-
{
6511-
"enable_metrics": c.EnableMetrics,
6512-
"relay_mode": c.RelayMode,
6513-
},
6514-
}
6515-
}
6516-
65176477
return []map[string]interface{}{
65186478
{
65196479
"enable_metrics": c.EnableMetrics,
6520-
"enable_relay": false,
6521-
"relay_mode": "DISABLED",
6480+
"enable_relay": c.EnableRelay,
65226481
},
65236482
}
65246483
}

mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb

-118
Original file line numberDiff line numberDiff line change
@@ -3406,24 +3406,6 @@ func TestAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityCo
34063406
ImportStateVerify: true,
34073407
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
34083408
},
3409-
{
3410-
Config: testAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityConfigEnabledOld(clusterName),
3411-
},
3412-
{
3413-
ResourceName: "google_container_cluster.primary",
3414-
ImportState: true,
3415-
ImportStateVerify: true,
3416-
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
3417-
},
3418-
{
3419-
Config: testAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityConfigDisabledOld(clusterName),
3420-
},
3421-
{
3422-
ResourceName: "google_container_cluster.primary",
3423-
ImportState: true,
3424-
ImportStateVerify: true,
3425-
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
3426-
},
34273409
},
34283410
})
34293411
}
@@ -9704,56 +9686,6 @@ resource "google_container_cluster" "primary" {
97049686
`, name, name)
97059687
}
97069688

9707-
func testAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityConfigEnabledOld(name string) string {
9708-
return fmt.Sprintf(`
9709-
resource "google_compute_network" "container_network" {
9710-
name = "%s-nw"
9711-
auto_create_subnetworks = false
9712-
}
9713-
9714-
resource "google_compute_subnetwork" "container_subnetwork" {
9715-
name = google_compute_network.container_network.name
9716-
network = google_compute_network.container_network.name
9717-
ip_cidr_range = "10.0.36.0/24"
9718-
region = "us-central1"
9719-
private_ip_google_access = true
9720-
9721-
secondary_ip_range {
9722-
range_name = "services-range"
9723-
ip_cidr_range = "192.168.1.0/24"
9724-
}
9725-
9726-
secondary_ip_range {
9727-
range_name = "pod-ranges"
9728-
ip_cidr_range = "192.168.64.0/22"
9729-
}
9730-
}
9731-
9732-
resource "google_container_cluster" "primary" {
9733-
name = "%s"
9734-
location = "us-central1-a"
9735-
initial_node_count = 1
9736-
datapath_provider = "ADVANCED_DATAPATH"
9737-
9738-
network = google_compute_network.container_network.name
9739-
subnetwork = google_compute_subnetwork.container_subnetwork.name
9740-
ip_allocation_policy {
9741-
cluster_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[0].range_name
9742-
services_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[1].range_name
9743-
}
9744-
9745-
monitoring_config {
9746-
enable_components = []
9747-
advanced_datapath_observability_config {
9748-
enable_metrics = true
9749-
relay_mode = "INTERNAL_VPC_LB"
9750-
}
9751-
}
9752-
deletion_protection = false
9753-
}
9754-
`, name, name)
9755-
}
9756-
97579689
func testAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityConfigDisabled(name string) string {
97589690
return fmt.Sprintf(`
97599691
resource "google_compute_network" "container_network" {
@@ -9804,56 +9736,6 @@ resource "google_container_cluster" "primary" {
98049736
`, name, name)
98059737
}
98069738

9807-
func testAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityConfigDisabledOld(name string) string {
9808-
return fmt.Sprintf(`
9809-
resource "google_compute_network" "container_network" {
9810-
name = "%s-nw"
9811-
auto_create_subnetworks = false
9812-
}
9813-
9814-
resource "google_compute_subnetwork" "container_subnetwork" {
9815-
name = google_compute_network.container_network.name
9816-
network = google_compute_network.container_network.name
9817-
ip_cidr_range = "10.0.36.0/24"
9818-
region = "us-central1"
9819-
private_ip_google_access = true
9820-
9821-
secondary_ip_range {
9822-
range_name = "services-range"
9823-
ip_cidr_range = "192.168.1.0/24"
9824-
}
9825-
9826-
secondary_ip_range {
9827-
range_name = "pod-ranges"
9828-
ip_cidr_range = "192.168.64.0/22"
9829-
}
9830-
}
9831-
9832-
resource "google_container_cluster" "primary" {
9833-
name = "%s"
9834-
location = "us-central1-a"
9835-
initial_node_count = 1
9836-
datapath_provider = "ADVANCED_DATAPATH"
9837-
9838-
network = google_compute_network.container_network.name
9839-
subnetwork = google_compute_subnetwork.container_subnetwork.name
9840-
ip_allocation_policy {
9841-
cluster_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[0].range_name
9842-
services_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[1].range_name
9843-
}
9844-
9845-
monitoring_config {
9846-
enable_components = []
9847-
advanced_datapath_observability_config {
9848-
enable_metrics = false
9849-
relay_mode = "DISABLED"
9850-
}
9851-
}
9852-
deletion_protection = false
9853-
}
9854-
`, name, name)
9855-
}
9856-
98579739
func testAccContainerCluster_withSoleTenantGroup(name, networkName, subnetworkName string) string {
98589740
return fmt.Sprintf(`
98599741
resource "google_compute_node_template" "soletenant-tmpl" {

mmv1/third_party/terraform/website/docs/guides/version_6_upgrade.html.markdown

+32-6
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ An empty value now means 300.
201201
### `balancing_mode` default value changed
202202

203203
An empty value now means UTILIZATION.
204-
204+
205205
## Resource: `google_vpc_access_connector`
206206

207207
### Fields `min_throughput` and `max_throughput` no longer have default values
208208

209-
The fields `min_throughput` and `max_throughput` no longer have default values
209+
The fields `min_throughput` and `max_throughput` no longer have default values
210210
set by the provider. This was necessary to add conflicting field validation, also
211211
described in this guide.
212212

@@ -216,7 +216,7 @@ will default to values present in data returned from the API.
216216
### Conflicting field validation added for `min_throughput` and `min_instances`, and `max_throughput` and `max_instances`
217217

218218
The provider will now enforce that `google_vpc_access_connector` resources can only
219-
include one of `min_throughput` and `min_instances` and one of `max_throughput`and
219+
include one of `min_throughput` and `min_instances` and one of `max_throughput` and
220220
`max_instances`. Previously if a user included all four fields in a resource block
221221
they would experience a permadiff. This is a result of how `min_instances` and
222222
`max_instances` fields' values take precedence in the API, and how the API calculates
@@ -232,7 +232,7 @@ that are derived from the API.
232232
### Folder deletion now prevented by default with `deletion_protection`
233233

234234
The field `deletion_protection` has been added with a default value of `true`. This field prevents
235-
Terraform from destroying or recreating the Folder. In 6.0.0, existing folders will have
235+
Terraform from destroying or recreating the Folder. In 6.0.0, existing folders will have
236236
`deletion_protection` set to `true` during the next refresh unless otherwise set in configuration.
237237

238238
**`deletion_protection` does NOT prevent deletion outside of Terraform.**
@@ -246,9 +246,35 @@ and then run `terraform apply` to apply the change.
246246

247247
Previously `lifecycle_rule.condition.age` attirbute was being set zero value by default and `lifecycle_rule.condition.no_age` was introduced to prevent that.
248248
Now `lifecycle_rule.condition.no_age` is no longer supported and `lifecycle_rule.condition.age` won't set a zero value by default.
249-
Removed in favor of the field `lifecycle_rule.condition.send_age_if_zero` which can be used to set zero value for `lifecycle_rule.condition.age` attribute.
249+
Removed in favor of the field `lifecycle_rule.condition.send_age_if_zero` which can be used to set zero value for `lifecycle_rule.condition.age` attribute.
250+
251+
For a seamless update, if your state today uses `no_age=true`, update it to remove `no_age` and set `send_age_if_zero=false`. If you do not use `no_age=true`, you will need to add `send_age_if_zero=true` to your state to avoid any changes after updating to 6.0.0.
252+
253+
## Resource: `google_container_cluster`
254+
255+
### `advanced_datapath_observability_config.relay_mode` is now removed
256+
257+
Previously, through `relay_mode` field usage, users could both enable Dataplane V2
258+
Flow Observability feature (that deploys Hubble relay component) and configure
259+
managed load balancers. Due to users' needs to have better control over how
260+
Hubble relay components shall be exposed in their clusters, managed load
261+
balancer deployments are not supported anymore and users are expected to deploy
262+
their own load balancers.
263+
264+
If `advanced_datapath_observability_config` is defined, `enable_relay` is now a
265+
required field instead and users are expected to use this field instead.
266+
267+
Recommended migration from `relay_mode` to `enable_relay` depending on
268+
`relay_mode` value:
269+
* `DISABLED`: set `enable_relay` to `false`
270+
* `INTERNAL_VPC_LB`: set `enable_relay` to `true` and define internal load
271+
balancer with VPC scope
272+
* `EXTERNAL_LB`: set `enable_relay` to `true` and define external load balancer
273+
with public access
250274

251-
For a seamless update, if your state today uses `no_age=true`, update it to remove `no_age` and set `send_age_if_zero=false`. If you do not use `no_age=true`, you will need to add `send_age_if_zero=true` to your state to avoid any changes after updating to 6.0.0.
275+
See exported endpoints for Dataplane V2 Observability feature to learn what
276+
target you might wish to expose with load balancers:
277+
https://cloud.google.com/kubernetes-engine/docs/concepts/about-dpv2-observability#gke-dataplane-v2-observability-endpoints
252278

253279
## Removals
254280

mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown

+1-2
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,7 @@ This block also contains several computed attributes, documented below.
645645
<a name="nested_advanced_datapath_observability_config"></a>The `advanced_datapath_observability_config` block supports:
646646

647647
* `enable_metrics` - (Required) Whether or not to enable advanced datapath metrics.
648-
* `enable_relay` - (Optional) Whether or not Relay is enabled.
649-
* `relay_mode` - (Optional, Deprecated) Mode used to make Relay available. Deprecated in favor of `enable_relay` field. Remove this attribute's configuration as this field will be removed in the next major release and `enable_relay` will become a required field.
648+
* `enable_relay` - (Required) Whether or not Relay is enabled.
650649

651650
<a name="nested_maintenance_policy"></a>The `maintenance_policy` block supports:
652651
* `daily_maintenance_window` - (Optional) structure documented below.

0 commit comments

Comments
 (0)