Skip to content

Commit

Permalink
Add containerinfra cluster zero node count support
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@cern.ch>
  • Loading branch information
MrFreezeex committed Apr 9, 2022
1 parent 800e358 commit d2639a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion openstack/containerinfra_shared_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const (
rsaPrivateKeyBlockType = "RSA PRIVATE KEY"
certificateRequestBlockType = "CERTIFICATE REQUEST"

containerInfraV1NodeGroupMinMicroversion = "1.9"
containerInfraV1NodeGroupMinMicroversion = "1.9"
containerInfraV1ZeroNodeCountMicroversion = "1.10"
)

func expandContainerInfraV1LabelsMap(v map[string]interface{}) (map[string]string, error) {
Expand Down
7 changes: 5 additions & 2 deletions openstack/resource_openstack_containerinfra_cluster_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func resourceContainerInfraClusterV1() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
ForceNew: false,
Computed: true,
Default: 1,
},

"master_addresses": {
Expand Down Expand Up @@ -274,8 +274,11 @@ func resourceContainerInfraClusterV1Create(ctx context.Context, d *schema.Resour
}

nodeCount := d.Get("node_count").(int)
if nodeCount > 0 {
if nodeCount >= 0 {
createOpts.NodeCount = &nodeCount
if nodeCount == 0 {
containerInfraClient.Microversion = containerInfraV1ZeroNodeCountMicroversion
}
}

mergeLabels := d.Get("merge_labels").(bool)
Expand Down

0 comments on commit d2639a4

Please sign in to comment.