Skip to content

Commit

Permalink
kalm (K8s Application lifecycle manager) addon config added (#3459)
Browse files Browse the repository at this point in the history
* kalm addon config added

* kalm addon tests added

* Update resource_container_cluster_test.go.erb

* PR comments fixed
  • Loading branch information
venkykuberan authored May 2, 2020
1 parent eae02d5 commit 3b86411
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
32 changes: 32 additions & 0 deletions third_party/terraform/resources/resource_container_cluster.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var (
"addons_config.0.cloudrun_config",
"addons_config.0.dns_cache_config",
"addons_config.0.gce_persistent_disk_csi_driver_config",
"addons_config.0.kalm_config",
<% end -%>
}
)
Expand Down Expand Up @@ -305,6 +306,21 @@ func resourceContainerCluster() *schema.Resource {
},
},
},
"kalm_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
AtLeastOneOf: addonsConfigKeys,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Type: schema.TypeBool,
Required: true,
},
},
},
},
<% end -%>
},
},
Expand Down Expand Up @@ -2250,6 +2266,14 @@ func expandClusterAddonsConfig(configured interface{}) *containerBeta.AddonsConf
ForceSendFields: []string{"Enabled"},
}
}

if v, ok := config["kalm_config"]; ok && len(v.([]interface{})) > 0 {
addon := v.([]interface{})[0].(map[string]interface{})
ac.KalmConfig = &containerBeta.KalmConfig{
Enabled: addon["enabled"].(bool),
ForceSendFields: []string{"Enabled"},
}
}
<% end -%>

return ac
Expand Down Expand Up @@ -2675,6 +2699,14 @@ func flattenClusterAddonsConfig(c *containerBeta.AddonsConfig) []map[string]inte
},
}
}

if c.KalmConfig != nil {
result["kalm_config"] = []map[string]interface{}{
{
"enabled": c.KalmConfig.Enabled,
},
}
}
<% end -%>
return []map[string]interface{}{result}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1992,6 +1992,9 @@ resource "google_container_cluster" "primary" {
gce_persistent_disk_csi_driver_config {
enabled = false
}
kalm_config {
enabled = false
}
<% end -%>
}
}
Expand Down Expand Up @@ -2030,7 +2033,10 @@ resource "google_container_cluster" "primary" {
}
gce_persistent_disk_csi_driver_config {
enabled = true
}
}
kalm_config {
enabled = true
}
<% end -%>
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ The `addons_config` block supports:
* `gce_persistent_disk_csi_driver_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
Whether this cluster should enable the Google Compute Engine Persistent Disk Container Storage Interface (CSI) Driver. Defaults to disabled; set `enabled = true` to enable.

* `kalm_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
Configuration for the KALM addon, which manages the lifecycle of k8s. It is disabled by default; Set `enabled = true` to enable.

This example `addons_config` disables two addons:

```hcl
Expand Down

0 comments on commit 3b86411

Please sign in to comment.