diff --git a/docs/resources/cluster_edge_native.md b/docs/resources/cluster_edge_native.md index 0ca9592b..4fdfd68b 100644 --- a/docs/resources/cluster_edge_native.md +++ b/docs/resources/cluster_edge_native.md @@ -77,6 +77,7 @@ Optional: - `control_plane_as_worker` (Boolean) Whether this machine pool is a control plane and a worker. Defaults to `false`. - `host_uids` (List of String, Deprecated) - `node` (Block List) (see [below for nested schema](#nestedblock--machine_pool--node)) +- `node_repave_interval` (Number) Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools. - `taints` (Block List) (see [below for nested schema](#nestedblock--machine_pool--taints)) - `update_strategy` (String) Update strategy for the machine pool. Valid values are `RollingUpdateScaleOut` and `RollingUpdateScaleIn`. diff --git a/docs/resources/cluster_edge_vsphere.md b/docs/resources/cluster_edge_vsphere.md index a65674fb..dc526eec 100644 --- a/docs/resources/cluster_edge_vsphere.md +++ b/docs/resources/cluster_edge_vsphere.md @@ -85,6 +85,7 @@ Optional: - `control_plane` (Boolean) Whether this machine pool is a control plane. Defaults to `false`. - `control_plane_as_worker` (Boolean) Whether this machine pool is a control plane and a worker. Defaults to `false`. - `node` (Block List) (see [below for nested schema](#nestedblock--machine_pool--node)) +- `node_repave_interval` (Number) Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools. - `taints` (Block List) (see [below for nested schema](#nestedblock--machine_pool--taints)) - `update_strategy` (String) Update strategy for the machine pool. Valid values are `RollingUpdateScaleOut` and `RollingUpdateScaleIn`. diff --git a/docs/resources/cluster_libvirt.md b/docs/resources/cluster_libvirt.md index cd896fd7..44fe0a2a 100644 --- a/docs/resources/cluster_libvirt.md +++ b/docs/resources/cluster_libvirt.md @@ -83,6 +83,7 @@ Optional: - `control_plane` (Boolean) Whether this machine pool is a control plane. Defaults to `false`. - `control_plane_as_worker` (Boolean) Whether this machine pool is a control plane and a worker. Defaults to `false`. - `node` (Block List) (see [below for nested schema](#nestedblock--machine_pool--node)) +- `node_repave_interval` (Number) Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools. - `taints` (Block List) (see [below for nested schema](#nestedblock--machine_pool--taints)) - `update_strategy` (String) Update strategy for the machine pool. Valid values are `RollingUpdateScaleOut` and `RollingUpdateScaleIn`. - `xsl_template` (String) XSL template to use. diff --git a/spectrocloud/resource_cluster_edge_native.go b/spectrocloud/resource_cluster_edge_native.go index b5e1e804..adf60478 100644 --- a/spectrocloud/resource_cluster_edge_native.go +++ b/spectrocloud/resource_cluster_edge_native.go @@ -175,6 +175,12 @@ func resourceClusterEdgeNative() *schema.Resource { //ForceNew: true, Description: "Whether this machine pool is a control plane and a worker. Defaults to `false`.", }, + "node_repave_interval": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + Description: "Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools.", + }, "update_strategy": { Type: schema.TypeString, Optional: true, @@ -325,7 +331,8 @@ func flattenMachinePoolConfigsEdgeNative(machinePools []*models.V1EdgeNativeMach oi := make(map[string]interface{}) FlattenAdditionalLabelsAndTaints(machinePool.AdditionalLabels, machinePool.Taints, oi) - oi["control_plane"] = machinePool.IsControlPlane + FlattenControlPlaneAndRepaveInterval(&machinePool.IsControlPlane, oi, machinePool.NodeRepaveInterval) + oi["control_plane"] = machinePool.IsControlPlane oi["control_plane_as_worker"] = machinePool.UseControlPlaneAsWorker oi["name"] = machinePool.Name var hosts []map[string]string @@ -504,6 +511,19 @@ func toMachinePoolEdgeNative(machinePool interface{}) (*models.V1EdgeNativeMachi }, } + if !controlPlane { + nodeRepaveInterval := 0 + if m["node_repave_interval"] != nil { + nodeRepaveInterval = m["node_repave_interval"].(int) + } + mp.PoolConfig.NodeRepaveInterval = int32(nodeRepaveInterval) + } else { + err := ValidationNodeRepaveIntervalForControlPlane(m["node_repave_interval"].(int)) + if err != nil { + return mp, err + } + } + return mp, nil } diff --git a/spectrocloud/resource_cluster_edge_vsphere.go b/spectrocloud/resource_cluster_edge_vsphere.go index 9494918b..9dd15b0b 100644 --- a/spectrocloud/resource_cluster_edge_vsphere.go +++ b/spectrocloud/resource_cluster_edge_vsphere.go @@ -187,6 +187,12 @@ func resourceClusterEdgeVsphere() *schema.Resource { Required: true, Description: "Number of nodes in the machine pool.", }, + "node_repave_interval": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + Description: "Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools.", + }, "update_strategy": { Type: schema.TypeString, Optional: true, @@ -360,6 +366,7 @@ func flattenMachinePoolConfigsEdgeVsphere(machinePools []*models.V1VsphereMachin oi := make(map[string]interface{}) FlattenAdditionalLabelsAndTaints(machinePool.AdditionalLabels, machinePool.Taints, oi) + FlattenControlPlaneAndRepaveInterval(machinePool.IsControlPlane, oi, machinePool.NodeRepaveInterval) oi["control_plane_as_worker"] = machinePool.UseControlPlaneAsWorker oi["name"] = machinePool.Name @@ -636,5 +643,19 @@ func toMachinePoolEdgeVsphere(machinePool interface{}) (*models.V1VsphereMachine }, } + if !controlPlane { + nodeRepaveInterval := 0 + if m["node_repave_interval"] != nil { + nodeRepaveInterval = m["node_repave_interval"].(int) + } + mp.PoolConfig.NodeRepaveInterval = int32(nodeRepaveInterval) + } else { + err := ValidationNodeRepaveIntervalForControlPlane(m["node_repave_interval"].(int)) + if err != nil { + return mp, err + } + + } + return mp, nil } diff --git a/spectrocloud/resource_cluster_libvirt.go b/spectrocloud/resource_cluster_libvirt.go index 5ba018ad..5adba159 100644 --- a/spectrocloud/resource_cluster_libvirt.go +++ b/spectrocloud/resource_cluster_libvirt.go @@ -196,6 +196,12 @@ func resourceClusterLibvirt() *schema.Resource { Required: true, Description: "Number of nodes in the machine pool.", }, + "node_repave_interval": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + Description: "Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools.", + }, "update_strategy": { Type: schema.TypeString, Optional: true, @@ -435,6 +441,7 @@ func flattenMachinePoolConfigsLibvirt(machinePools []*models.V1LibvirtMachinePoo oi := make(map[string]interface{}) FlattenAdditionalLabelsAndTaints(machinePool.AdditionalLabels, machinePool.Taints, oi) + FlattenControlPlaneAndRepaveInterval(&machinePool.IsControlPlane, oi, machinePool.NodeRepaveInterval) oi["control_plane_as_worker"] = machinePool.UseControlPlaneAsWorker oi["name"] = machinePool.Name @@ -742,6 +749,20 @@ func toMachinePoolLibvirt(machinePool interface{}) (*models.V1LibvirtMachinePool }, } + if !controlPlane { + nodeRepaveInterval := 0 + if m["node_repave_interval"] != nil { + nodeRepaveInterval = m["node_repave_interval"].(int) + } + mp.PoolConfig.NodeRepaveInterval = int32(nodeRepaveInterval) + } else { + err := ValidationNodeRepaveIntervalForControlPlane(m["node_repave_interval"].(int)) + if err != nil { + return mp, err + } + + } + return mp, nil }