Skip to content

Commit 306a821

Browse files
Remove relay_mode field support (#10274) (#7930)
[upstream:4f39da51c0464ab867e96abba3168d78841a86e1] Signed-off-by: Modular Magician <[email protected]>
1 parent d206144 commit 306a821

File tree

5 files changed

+46
-174
lines changed

5 files changed

+46
-174
lines changed

.changelog/10274.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```release-note:breaking-change
2+
container: removed deprecated field `advanced_datapath_observability_config.relay_mode` from `google_container_cluster` resource. Users are expected to use `enable_relay` field instead.
3+
```
4+
```release-note:breaking-change
5+
container: made field `advanced_datapath_observability_config.enable_relay` required in `google_container_cluster` resource
6+
```

google-beta/services/container/resource_container_cluster.go

+7-48
Original file line numberDiff line numberDiff line change
@@ -1267,20 +1267,9 @@ func ResourceContainerCluster() *schema.Resource {
12671267
Description: `Whether or not the advanced datapath metrics are enabled.`,
12681268
},
12691269
"enable_relay": {
1270-
Type: schema.TypeBool,
1271-
Optional: true,
1272-
Description: `Whether or not Relay is enabled.`,
1273-
Default: false,
1274-
ConflictsWith: []string{"monitoring_config.0.advanced_datapath_observability_config.0.relay_mode"},
1275-
},
1276-
"relay_mode": {
1277-
Type: schema.TypeString,
1278-
Optional: true,
1279-
Computed: true,
1280-
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.",
1281-
Description: `Mode used to make Relay available.`,
1282-
ValidateFunc: validation.StringInSlice([]string{"DISABLED", "INTERNAL_VPC_LB", "EXTERNAL_LB"}, false),
1283-
ConflictsWith: []string{"monitoring_config.0.advanced_datapath_observability_config.0.enable_relay"},
1270+
Type: schema.TypeBool,
1271+
Required: true,
1272+
Description: `Whether or not Relay is enabled.`,
12841273
},
12851274
},
12861275
},
@@ -5502,21 +5491,10 @@ func expandMonitoringConfig(configured interface{}) *container.MonitoringConfig
55025491

55035492
if v, ok := config["advanced_datapath_observability_config"]; ok && len(v.([]interface{})) > 0 {
55045493
advanced_datapath_observability_config := v.([]interface{})[0].(map[string]interface{})
5505-
55065494
mc.AdvancedDatapathObservabilityConfig = &container.AdvancedDatapathObservabilityConfig{
5507-
EnableMetrics: advanced_datapath_observability_config["enable_metrics"].(bool),
5508-
}
5509-
5510-
enable_relay := advanced_datapath_observability_config["enable_relay"].(bool)
5511-
relay_mode := advanced_datapath_observability_config["relay_mode"].(string)
5512-
if enable_relay {
5513-
mc.AdvancedDatapathObservabilityConfig.EnableRelay = enable_relay
5514-
} else if relay_mode == "INTERNAL_VPC_LB" || relay_mode == "EXTERNAL_LB" {
5515-
mc.AdvancedDatapathObservabilityConfig.RelayMode = relay_mode
5516-
} else {
5517-
mc.AdvancedDatapathObservabilityConfig.EnableRelay = enable_relay
5518-
mc.AdvancedDatapathObservabilityConfig.RelayMode = "DISABLED"
5519-
mc.AdvancedDatapathObservabilityConfig.ForceSendFields = []string{"EnableRelay"}
5495+
EnableMetrics: advanced_datapath_observability_config["enable_metrics"].(bool),
5496+
EnableRelay: advanced_datapath_observability_config["enable_relay"].(bool),
5497+
ForceSendFields: []string{"EnableRelay"},
55205498
}
55215499
}
55225500

@@ -6393,29 +6371,10 @@ func flattenAdvancedDatapathObservabilityConfig(c *container.AdvancedDatapathObs
63936371
return nil
63946372
}
63956373

6396-
if c.EnableRelay {
6397-
return []map[string]interface{}{
6398-
{
6399-
"enable_metrics": c.EnableMetrics,
6400-
"enable_relay": c.EnableRelay,
6401-
},
6402-
}
6403-
}
6404-
6405-
if c.RelayMode == "INTERNAL_VPC_LB" || c.RelayMode == "EXTERNAL_LB" {
6406-
return []map[string]interface{}{
6407-
{
6408-
"enable_metrics": c.EnableMetrics,
6409-
"relay_mode": c.RelayMode,
6410-
},
6411-
}
6412-
}
6413-
64146374
return []map[string]interface{}{
64156375
{
64166376
"enable_metrics": c.EnableMetrics,
6417-
"enable_relay": false,
6418-
"relay_mode": "DISABLED",
6377+
"enable_relay": c.EnableRelay,
64196378
},
64206379
}
64216380
}

google-beta/services/container/resource_container_cluster_test.go

-118
Original file line numberDiff line numberDiff line change
@@ -3383,24 +3383,6 @@ func TestAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityCo
33833383
ImportStateVerify: true,
33843384
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
33853385
},
3386-
{
3387-
Config: testAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityConfigEnabledOld(clusterName),
3388-
},
3389-
{
3390-
ResourceName: "google_container_cluster.primary",
3391-
ImportState: true,
3392-
ImportStateVerify: true,
3393-
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
3394-
},
3395-
{
3396-
Config: testAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityConfigDisabledOld(clusterName),
3397-
},
3398-
{
3399-
ResourceName: "google_container_cluster.primary",
3400-
ImportState: true,
3401-
ImportStateVerify: true,
3402-
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
3403-
},
34043386
},
34053387
})
34063388
}
@@ -9650,56 +9632,6 @@ resource "google_container_cluster" "primary" {
96509632
`, name, name)
96519633
}
96529634

9653-
func testAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityConfigEnabledOld(name string) string {
9654-
return fmt.Sprintf(`
9655-
resource "google_compute_network" "container_network" {
9656-
name = "%s-nw"
9657-
auto_create_subnetworks = false
9658-
}
9659-
9660-
resource "google_compute_subnetwork" "container_subnetwork" {
9661-
name = google_compute_network.container_network.name
9662-
network = google_compute_network.container_network.name
9663-
ip_cidr_range = "10.0.36.0/24"
9664-
region = "us-central1"
9665-
private_ip_google_access = true
9666-
9667-
secondary_ip_range {
9668-
range_name = "services-range"
9669-
ip_cidr_range = "192.168.1.0/24"
9670-
}
9671-
9672-
secondary_ip_range {
9673-
range_name = "pod-ranges"
9674-
ip_cidr_range = "192.168.64.0/22"
9675-
}
9676-
}
9677-
9678-
resource "google_container_cluster" "primary" {
9679-
name = "%s"
9680-
location = "us-central1-a"
9681-
initial_node_count = 1
9682-
datapath_provider = "ADVANCED_DATAPATH"
9683-
9684-
network = google_compute_network.container_network.name
9685-
subnetwork = google_compute_subnetwork.container_subnetwork.name
9686-
ip_allocation_policy {
9687-
cluster_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[0].range_name
9688-
services_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[1].range_name
9689-
}
9690-
9691-
monitoring_config {
9692-
enable_components = []
9693-
advanced_datapath_observability_config {
9694-
enable_metrics = true
9695-
relay_mode = "INTERNAL_VPC_LB"
9696-
}
9697-
}
9698-
deletion_protection = false
9699-
}
9700-
`, name, name)
9701-
}
9702-
97039635
func testAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityConfigDisabled(name string) string {
97049636
return fmt.Sprintf(`
97059637
resource "google_compute_network" "container_network" {
@@ -9750,56 +9682,6 @@ resource "google_container_cluster" "primary" {
97509682
`, name, name)
97519683
}
97529684

9753-
func testAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityConfigDisabledOld(name string) string {
9754-
return fmt.Sprintf(`
9755-
resource "google_compute_network" "container_network" {
9756-
name = "%s-nw"
9757-
auto_create_subnetworks = false
9758-
}
9759-
9760-
resource "google_compute_subnetwork" "container_subnetwork" {
9761-
name = google_compute_network.container_network.name
9762-
network = google_compute_network.container_network.name
9763-
ip_cidr_range = "10.0.36.0/24"
9764-
region = "us-central1"
9765-
private_ip_google_access = true
9766-
9767-
secondary_ip_range {
9768-
range_name = "services-range"
9769-
ip_cidr_range = "192.168.1.0/24"
9770-
}
9771-
9772-
secondary_ip_range {
9773-
range_name = "pod-ranges"
9774-
ip_cidr_range = "192.168.64.0/22"
9775-
}
9776-
}
9777-
9778-
resource "google_container_cluster" "primary" {
9779-
name = "%s"
9780-
location = "us-central1-a"
9781-
initial_node_count = 1
9782-
datapath_provider = "ADVANCED_DATAPATH"
9783-
9784-
network = google_compute_network.container_network.name
9785-
subnetwork = google_compute_subnetwork.container_subnetwork.name
9786-
ip_allocation_policy {
9787-
cluster_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[0].range_name
9788-
services_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[1].range_name
9789-
}
9790-
9791-
monitoring_config {
9792-
enable_components = []
9793-
advanced_datapath_observability_config {
9794-
enable_metrics = false
9795-
relay_mode = "DISABLED"
9796-
}
9797-
}
9798-
deletion_protection = false
9799-
}
9800-
`, name, name)
9801-
}
9802-
98039685
func testAccContainerCluster_withSoleTenantGroup(name, networkName, subnetworkName string) string {
98049686
return fmt.Sprintf(`
98059687
resource "google_compute_node_template" "soletenant-tmpl" {

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

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)