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

Add resource manager tags to GKE autopilot #10123

Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3421c4a
resourceManagerTags added to Cluster Node Config schema
maxi-cit Nov 28, 2023
dc59126
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Nov 28, 2023
70c6d69
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Dec 4, 2023
44ee4ec
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Dec 6, 2023
a38b7bf
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Dec 11, 2023
77b5c02
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Dec 12, 2023
3e75da5
update beta tag
maxi-cit Dec 18, 2023
38f43fb
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Dec 18, 2023
8084d1a
add cluster and node proto tests
maxi-cit Dec 18, 2023
53f5150
add expand and flatten proto
maxi-cit Dec 18, 2023
f8046d7
removed beta tag
maxi-cit Dec 19, 2023
9ef5388
added to documentation
maxi-cit Dec 19, 2023
18e5a9c
added resource manager tags to auto pilot
maxi-cit Dec 19, 2023
e5ab6db
Merge branch 'main' into add-resource-manager-to-cluster
maxi-cit Jan 2, 2024
481eda7
migrating resourceManagerTags tests
maxi-cit Jan 3, 2024
9ef00f6
migrating node_pools test
maxi-cit Jan 4, 2024
6b1839a
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Jan 9, 2024
14f4fcb
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Jan 10, 2024
1f473b4
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Jan 12, 2024
581557f
migrating additional tests
maxi-cit Jan 17, 2024
428051e
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Jan 27, 2024
4284843
minor fixes
maxi-cit Jan 29, 2024
4791576
fixing tests
maxi-cit Jan 29, 2024
6d8088a
add in-place update support
maxi-cit Jan 31, 2024
da29216
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Feb 2, 2024
2710873
fixed tests
maxi-cit Feb 8, 2024
8b3bf5c
fixed annotations
maxi-cit Feb 8, 2024
46920e4
validated clusters and node pools tests. Isolated node pool auto config
maxi-cit Feb 12, 2024
2d7a45d
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Feb 12, 2024
0ffc6b9
isolated resource manager tags from docs
maxi-cit Feb 12, 2024
3f31e7a
fixed permission issue
maxi-cit Feb 14, 2024
0a5cc41
fixed spaces
maxi-cit Feb 14, 2024
8670bb5
uncomment autopilot config
maxi-cit Feb 14, 2024
edba711
uncomment autopilot config
maxi-cit Feb 14, 2024
b34070f
fixed sync conflicts
maxi-cit Mar 5, 2024
a0e15bc
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Mar 6, 2024
eed4d67
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Mar 19, 2024
dea36d3
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Mar 20, 2024
9e0ef58
fixed tests
maxi-cit Mar 23, 2024
6f80a94
fixed space typo
maxi-cit Mar 23, 2024
c3707cb
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Mar 23, 2024
39115a5
Merge remote-tracking branch 'upstream/main' into add-resource-manage…
maxi-cit Mar 26, 2024
55ebc03
use non-authoritative permission instead of authoritative
maxi-cit Mar 26, 2024
935321d
Revert "use non-authoritative permission instead of authoritative"
maxi-cit Mar 27, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ func expandNodeConfig(v interface{}) *container.NodeConfig {
if v,ok := nodeConfig["enable_confidential_storage"]; ok {
nc.EnableConfidentialStorage = v.(bool)
}

<% unless version == "ga" -%>
if v, ok := nodeConfig["host_maintenance_policy"]; ok {
nc.HostMaintenancePolicy = expandHostMaintenancePolicy(v)
Expand Down Expand Up @@ -1249,7 +1249,6 @@ func flattenResourceManagerTags(c *container.ResourceManagerTags) map[string]int
for k, v := range c.Tags {
rmt[k] = v
}

}

return rmt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,11 @@ func ResourceContainerCluster() *schema.Resource {
},
},
},
"resource_manager_tags": {
Type: schema.TypeMap,
Optional: true,
Description: `A map of resource manager tags. Resource manager tag keys and values have the same definition as resource manager tags. Keys must be in the format tagKeys/{tag_key_id}, and values are in the format tagValues/456. The field is ignored (both PUT & PATCH) when empty.`,
},
},
},
},
Expand Down Expand Up @@ -4162,6 +4167,24 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
log.Printf("[INFO] GKE cluster %s node pool auto config network tags have been updated", d.Id())
}

if d.HasChange("node_pool_auto_config.0.resource_manager_tags") {
rmtags := d.Get("node_pool_auto_config.0.resource_manager_tags")

req := &container.UpdateClusterRequest{
Update: &container.ClusterUpdate{
DesiredNodePoolAutoConfigResourceManagerTags: expandResourceManagerTags(rmtags),
},
}

updateF := updateFunc(req, "updating GKE cluster node pool auto config resource manager tags")
// Call update serially.
if err := transport_tpg.LockedCall(lockKey, updateF); err != nil {
return err
}

log.Printf("[INFO] GKE cluster %s node pool auto config resource manager tags have been updated", d.Id())
}

d.Partial(false)

<% unless version == 'ga' -%>
Expand Down Expand Up @@ -5426,6 +5449,10 @@ func expandNodePoolAutoConfig(configured interface{}) *container.NodePoolAutoCon
npac.NetworkTags = expandNodePoolAutoConfigNetworkTags(v)
}

if v, ok := config["resource_manager_tags"]; ok && len(v.(map[string]interface{})) > 0 {
npac.ResourceManagerTags = expandResourceManagerTags(v)
}

return npac
}

Expand Down Expand Up @@ -6234,6 +6261,9 @@ func flattenNodePoolAutoConfig(c *container.NodePoolAutoConfig) []map[string]int
if c.NetworkTags != nil {
result["network_tags"] = flattenNodePoolAutoConfigNetworkTags(c.NetworkTags)
}
if c.ResourceManagerTags != nil {
result["resource_manager_tags"] = flattenResourceManagerTags(c.ResourceManagerTags)
}

return []map[string]interface{}{result}
}
Expand Down
Loading