Skip to content

Commit

Permalink
206 update ske default setting for max unavailable to 0 (#207)
Browse files Browse the repository at this point in the history
* set DefaultNodepoolMaxUnavailable to 0

* modify tests

* Automated docs update

---------

Co-authored-by: Dean Oren <[email protected]>
Co-authored-by: do87 <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2023
1 parent ae3c256 commit 32b3f6f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/resources/kubernetes_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Optional:
- `container_runtime` (String) Specifies the container runtime. Defaults to `containerd`. Allowed options are `docker`, `containerd`
- `labels` (Map of String) Labels to add to each node
- `max_surge` (Number) The maximum number of nodes upgraded simultaneously. Defaults to 1. (Value must be between 1-10)
- `max_unavailable` (Number) The maximum number of nodes unavailable during upgraded. Defaults to 1
- `max_unavailable` (Number) The maximum number of nodes unavailable during upgraded. Defaults to 0
- `maximum` (Number) Maximum nodes in the pool. Defaults to 2. (Value must be between 1-100)
- `minimum` (Number) Minimum nodes in the pool. Defaults to 1. (Value must be between 1-100)
- `os_name` (String) The name of the OS image. Only `flatcar` is supported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestAcc_kubernetes(t *testing.T) {
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "node_pools.0.minimum", "1"),
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "node_pools.0.maximum", "1"),
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "node_pools.0.max_surge", "1"),
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "node_pools.0.max_unavailable", "1"),
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "node_pools.0.max_unavailable", "0"),
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "node_pools.0.volume_type", "storage_premium_perf1"),
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "node_pools.0.volume_size_gb", "20"),
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "node_pools.0.container_runtime", "containerd"),
Expand Down
2 changes: 1 addition & 1 deletion stackit/internal/resources/kubernetes/cluster/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (
DefaultNodepoolMin int64 = 1
DefaultNodepoolMax int64 = 2
DefaultNodepoolMaxSurge int64 = 1
DefaultNodepoolMaxUnavailable int64 = 1
DefaultNodepoolMaxUnavailable int64 = 0
DefaultVolumeType = "storage_premium_perf1"
DefaultVolumeSizeGB int64 = 20
DefaultCRI = "containerd"
Expand Down
11 changes: 6 additions & 5 deletions stackit/internal/resources/kubernetes/cluster/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestAcc_kubernetes(t *testing.T) {
resource.TestCheckResourceAttr("stackit_kubernetes_cluster.example", "node_pools.0.minimum", "1"),
resource.TestCheckResourceAttr("stackit_kubernetes_cluster.example", "node_pools.0.maximum", "2"),
resource.TestCheckResourceAttr("stackit_kubernetes_cluster.example", "node_pools.0.max_surge", "1"),
resource.TestCheckResourceAttr("stackit_kubernetes_cluster.example", "node_pools.0.max_unavailable", "1"),
resource.TestCheckResourceAttr("stackit_kubernetes_cluster.example", "node_pools.0.max_unavailable", "0"),
resource.TestCheckResourceAttr("stackit_kubernetes_cluster.example", "node_pools.0.volume_type", "storage_premium_perf1"),
resource.TestCheckResourceAttr("stackit_kubernetes_cluster.example", "node_pools.0.volume_size_gb", "20"),
resource.TestCheckResourceAttr("stackit_kubernetes_cluster.example", "node_pools.0.container_runtime", "containerd"),
Expand Down Expand Up @@ -129,10 +129,11 @@ resource "stackit_kubernetes_cluster" "example" {
name = "%s"
node_pools = [{
name = "%s"
machine_type = "%s"
zones = ["eu01-1"]
maximum = 1
name = "%s"
machine_type = "%s"
zones = ["eu01-1"]
maximum = 1
max_unavailable = 1
labels = {
"az" = "1"
Expand Down
2 changes: 1 addition & 1 deletion stackit/internal/resources/kubernetes/cluster/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (r *Resource) Schema(ctx context.Context, req resource.SchemaRequest, resp
Default: int64default.StaticInt64(DefaultNodepoolMaxSurge),
},
"max_unavailable": schema.Int64Attribute{
Description: "The maximum number of nodes unavailable during upgraded. Defaults to 1",
Description: "The maximum number of nodes unavailable during upgraded. Defaults to 0",
Optional: true,
Computed: true,
Default: int64default.StaticInt64(DefaultNodepoolMaxUnavailable),
Expand Down

0 comments on commit 32b3f6f

Please sign in to comment.