Skip to content

Commit

Permalink
Merge branch 'main' into PLT-698
Browse files Browse the repository at this point in the history
  • Loading branch information
SivaanandM authored Sep 26, 2023
2 parents baec177 + 1b03b3d commit fe9f37c
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/resources/cluster_edge_native.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
1 change: 1 addition & 0 deletions docs/resources/cluster_edge_vsphere.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
1 change: 1 addition & 0 deletions docs/resources/cluster_libvirt.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 21 additions & 1 deletion spectrocloud/resource_cluster_edge_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
21 changes: 21 additions & 0 deletions spectrocloud/resource_cluster_edge_vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
21 changes: 21 additions & 0 deletions spectrocloud/resource_cluster_libvirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit fe9f37c

Please sign in to comment.