Skip to content

Commit 9e0d554

Browse files
gke_backup_agent_config: support from beta to ga (#6898) (#4970)
* promote backup to ga * gke_backup_agent_config: doc update * fix typo in a test func name * retrigger checks * update test for gke backup config in ga Co-authored-by: Shubham Singh <[email protected]> Signed-off-by: Modular Magician <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Shubham Singh <[email protected]>
1 parent 64bbf98 commit 9e0d554

File tree

5 files changed

+44
-40
lines changed

5 files changed

+44
-40
lines changed

.changelog/6898.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
container: promoted `gke_backup_agent_config` in `google_container_cluster` to GA
3+
```

google-beta/resource_container_cluster.go

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ var (
6868
"addons_config.0.gcp_filestore_csi_driver_config",
6969
"addons_config.0.dns_cache_config",
7070
"addons_config.0.gce_persistent_disk_csi_driver_config",
71+
"addons_config.0.gke_backup_agent_config",
7172
"addons_config.0.istio_config",
7273
"addons_config.0.kalm_config",
7374
"addons_config.0.config_connector_config",
74-
"addons_config.0.gke_backup_agent_config",
7575
}
7676

7777
privateClusterConfigKeys = []string{
@@ -371,6 +371,22 @@ func resourceContainerCluster() *schema.Resource {
371371
},
372372
},
373373
},
374+
"gke_backup_agent_config": {
375+
Type: schema.TypeList,
376+
Optional: true,
377+
Computed: true,
378+
AtLeastOneOf: addonsConfigKeys,
379+
MaxItems: 1,
380+
Description: `The status of the Backup for GKE Agent addon. It is disabled by default. Set enabled = true to enable.`,
381+
Elem: &schema.Resource{
382+
Schema: map[string]*schema.Schema{
383+
"enabled": {
384+
Type: schema.TypeBool,
385+
Required: true,
386+
},
387+
},
388+
},
389+
},
374390
"istio_config": {
375391
Type: schema.TypeList,
376392
Optional: true,
@@ -428,22 +444,6 @@ func resourceContainerCluster() *schema.Resource {
428444
},
429445
},
430446
},
431-
"gke_backup_agent_config": {
432-
Type: schema.TypeList,
433-
Optional: true,
434-
Computed: true,
435-
AtLeastOneOf: addonsConfigKeys,
436-
MaxItems: 1,
437-
Description: `The status of the Backup for GKE Agent addon. It is disabled by default. Set enabled = true to enable.`,
438-
Elem: &schema.Resource{
439-
Schema: map[string]*schema.Schema{
440-
"enabled": {
441-
Type: schema.TypeBool,
442-
Required: true,
443-
},
444-
},
445-
},
446-
},
447447
},
448448
},
449449
},
@@ -3714,6 +3714,13 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
37143714
ForceSendFields: []string{"Enabled"},
37153715
}
37163716
}
3717+
if v, ok := config["gke_backup_agent_config"]; ok && len(v.([]interface{})) > 0 {
3718+
addon := v.([]interface{})[0].(map[string]interface{})
3719+
ac.GkeBackupAgentConfig = &container.GkeBackupAgentConfig{
3720+
Enabled: addon["enabled"].(bool),
3721+
ForceSendFields: []string{"Enabled"},
3722+
}
3723+
}
37173724

37183725
if v, ok := config["istio_config"]; ok && len(v.([]interface{})) > 0 {
37193726
addon := v.([]interface{})[0].(map[string]interface{})
@@ -3738,13 +3745,6 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
37383745
ForceSendFields: []string{"Enabled"},
37393746
}
37403747
}
3741-
if v, ok := config["gke_backup_agent_config"]; ok && len(v.([]interface{})) > 0 {
3742-
addon := v.([]interface{})[0].(map[string]interface{})
3743-
ac.GkeBackupAgentConfig = &container.GkeBackupAgentConfig{
3744-
Enabled: addon["enabled"].(bool),
3745-
ForceSendFields: []string{"Enabled"},
3746-
}
3747-
}
37483748

37493749
return ac
37503750
}
@@ -4669,6 +4669,13 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
46694669
},
46704670
}
46714671
}
4672+
if c.GkeBackupAgentConfig != nil {
4673+
result["gke_backup_agent_config"] = []map[string]interface{}{
4674+
{
4675+
"enabled": c.GkeBackupAgentConfig.Enabled,
4676+
},
4677+
}
4678+
}
46724679

46734680
if c.IstioConfig != nil {
46744681
result["istio_config"] = []map[string]interface{}{
@@ -4693,13 +4700,6 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
46934700
},
46944701
}
46954702
}
4696-
if c.GkeBackupAgentConfig != nil {
4697-
result["gke_backup_agent_config"] = []map[string]interface{}{
4698-
{
4699-
"enabled": c.GkeBackupAgentConfig.Enabled,
4700-
},
4701-
}
4702-
}
47034703
return []map[string]interface{}{result}
47044704
}
47054705

google-beta/resource_container_cluster_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3702,6 +3702,9 @@ resource "google_container_cluster" "primary" {
37023702
gce_persistent_disk_csi_driver_config {
37033703
enabled = false
37043704
}
3705+
gke_backup_agent_config {
3706+
enabled = false
3707+
}
37053708
istio_config {
37063709
disabled = true
37073710
auth = "AUTH_MUTUAL_TLS"
@@ -3712,9 +3715,6 @@ resource "google_container_cluster" "primary" {
37123715
config_connector_config {
37133716
enabled = false
37143717
}
3715-
gke_backup_agent_config {
3716-
enabled = false
3717-
}
37183718
}
37193719
}
37203720
`, projectID, clusterName)
@@ -3761,6 +3761,9 @@ resource "google_container_cluster" "primary" {
37613761
gce_persistent_disk_csi_driver_config {
37623762
enabled = true
37633763
}
3764+
gke_backup_agent_config {
3765+
enabled = true
3766+
}
37643767
istio_config {
37653768
disabled = false
37663769
auth = "AUTH_NONE"
@@ -3771,9 +3774,6 @@ resource "google_container_cluster" "primary" {
37713774
config_connector_config {
37723775
enabled = true
37733776
}
3774-
gke_backup_agent_config {
3775-
enabled = true
3776-
}
37773777
}
37783778
}
37793779
`, projectID, clusterName)

google-beta/validation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
1111
)
1212

13-
func TestvalidateGCEName(t *testing.T) {
13+
func TestValidateGCEName(t *testing.T) {
1414
x := []StringValidationTestCase{
1515
// No errors
1616
{TestName: "basic", Value: "foobar"},

website/docs/r/container_cluster.html.markdown

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,14 +403,15 @@ subnetwork in which the cluster's instances are launched.
403403
* `gce_persistent_disk_csi_driver_config` - (Optional).
404404
Whether this cluster should enable the Google Compute Engine Persistent Disk Container Storage Interface (CSI) Driver. Defaults to disabled; set `enabled = true` to enabled.
405405

406+
* `gke_backup_agent_config` - (Optional).
407+
The status of the Backup for GKE agent addon. It is disabled by default; Set `enabled = true` to enable.
408+
406409
* `kalm_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
407410
Configuration for the KALM addon, which manages the lifecycle of k8s. It is disabled by default; Set `enabled = true` to enable.
408411

409412
* `config_connector_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
410413
The status of the ConfigConnector addon. It is disabled by default; Set `enabled = true` to enable.
411414

412-
* `gke_backup_agent_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
413-
The status of the Backup for GKE agent addon. It is disabled by default; Set `enabled = true` to enable.
414415

415416
This example `addons_config` disables two addons:
416417

0 commit comments

Comments
 (0)