Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kalm (K8s Application lifecycle manager) addon config added #3459

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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