Skip to content

Commit a789153

Browse files
Merge pull request #726 from ionos-cloud/feat/dataplatform_add_auto_scaling
2 parents b4b740a + 1a967d0 commit a789153

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+730
-531
lines changed

.gitbook.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
## 6.6.8 -- upcoming release
1+
## 6.6.8
2+
### Features
3+
- Add `auto_scaling` attribute to `ionoscloud_dataplatform_node_pool` resource.
24
### Fixes
35
- Omitting the `location` attribute for some resources no longer generates an error
46

LICENSE

Lines changed: 0 additions & 373 deletions
This file was deleted.

docs/data-sources/dataplatform_node_pool.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ The following attributes are returned by the datasource:
7272
* `day_of_the_week`
7373
* `labels` - Key-value pairs attached to the node pool resource as [Kubernetes labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/).
7474
* `annotations` - Key-value pairs attached to node pool resource as [Kubernetes annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/).
75+
* `auto_scaling` - Whether the Node Pool should autoscale. For more details, please check the API documentation
76+
- `min_node_count` - The minimum number of worker nodes the node pool can scale down to. Should be less than max_node_count
77+
- `max_node_count` - The maximum number of worker nodes that the node pool can scale to. Should be greater than min_node_count

docs/resources/dataplatform_node_pool.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ resource "ionoscloud_dataplatform_node_pool" "example" {
6565
* `storage_type` - (Optional)[int] The type of hardware for the volume. Must be set with one of the values `HDD` or `SSD`. The default value is `SSD`.
6666
* `storage_size` - (Optional)[int] The size of the volume in GB. The size must be greater than `10`GB. The default value is `20`.
6767
* `maintenance_window` - (Optional) Starting time of a weekly 4 hour-long window, during which maintenance might occur in hh:mm:ss format
68-
* `time` - (Required)[string] Time at which the maintenance should start. Must conform to the 'HH:MM:SS' 24-hour format. This pattern matches the "HH:MM:SS 24-hour format with leading 0" format. For more information take a look at [this link](https://stackoverflow.com/questions/7536755/regular-expression-for-matching-hhmm-time-format).
69-
* `day_of_the_week` - (Required)[string] Must be set with one the values `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday`, `Saturday` or `Sunday`.
68+
- `time` - (Required)[string] Time at which the maintenance should start. Must conform to the 'HH:MM:SS' 24-hour format. This pattern matches the "HH:MM:SS 24-hour format with leading 0" format. For more information take a look at [this link](https://stackoverflow.com/questions/7536755/regular-expression-for-matching-hhmm-time-format).
69+
- `day_of_the_week` - (Required)[string] Must be set with one the values `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday`, `Saturday` or `Sunday`.
7070
* `labels` - (Optional)[map] Key-value pairs attached to the node pool resource as [Kubernetes labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/).
7171
* `annotations` - (Optional)[map] Key-value pairs attached to node pool resource as [Kubernetes annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/).
72+
* `auto_scaling` - (Optional)[string] Whether the Node Pool should autoscale. For more details, please check the API documentation
73+
- `min_node_count` - (Optional)[int] The minimum number of worker nodes the node pool can scale down to. Should be less than max_node_count
74+
- `max_node_count` - (Optional)[int] The maximum number of worker nodes that the node pool can scale to. Should be greater than min_node_count
7275

7376
## Import
7477

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
github.com/ionos-cloud/sdk-go-bundle/shared v0.1.1
2323
github.com/ionos-cloud/sdk-go-cert-manager v1.1.0
2424
github.com/ionos-cloud/sdk-go-container-registry v1.2.0
25-
github.com/ionos-cloud/sdk-go-dataplatform v1.0.3
25+
github.com/ionos-cloud/sdk-go-dataplatform v1.1.1
2626
github.com/ionos-cloud/sdk-go-dbaas-in-memory-db v1.0.1
2727
github.com/ionos-cloud/sdk-go-dbaas-mariadb v1.1.1
2828
github.com/ionos-cloud/sdk-go-dbaas-mongo v1.3.1

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ github.com/ionos-cloud/sdk-go-container-registry v1.2.0 h1:C5r2XleKLbSFw9kmb4N8I
128128
github.com/ionos-cloud/sdk-go-container-registry v1.2.0/go.mod h1:woBP1+A4N0KXiRj9jG4y/hEXgrVjJv0CUlAvc24mCeo=
129129
github.com/ionos-cloud/sdk-go-dataplatform v1.0.3 h1:eaZITgPaLHbK4d/nVaImvP19a5yAumI5hprjM/B1qSE=
130130
github.com/ionos-cloud/sdk-go-dataplatform v1.0.3/go.mod h1:LXJGnUwLLiJhKgApv7TIPGy7WOuGbYIzBPFxGpNfqN0=
131+
github.com/ionos-cloud/sdk-go-dataplatform v1.1.1 h1:Wu9TAiphRyMEweUcQlMblhVCl9qVxQlOYEOw+jJS+Ss=
132+
github.com/ionos-cloud/sdk-go-dataplatform v1.1.1/go.mod h1:3rQrOZFbXcjK3C5Dnjzahsd9x7PO+b4AARdBwdz//Mg=
131133
github.com/ionos-cloud/sdk-go-dbaas-in-memory-db v1.0.1 h1:vd3SCqZ1OI5l7Tzql7NDb5Zlpna8e2SsfEYZRGHOkOo=
132134
github.com/ionos-cloud/sdk-go-dbaas-in-memory-db v1.0.1/go.mod h1:JLbyt5wj7+f/njy7pnWD6K+cCfe32p8VrjmKks055+w=
133135
github.com/ionos-cloud/sdk-go-dbaas-mariadb v1.1.1 h1:dZLxaH2n0nxCOKMkt49TibOiY1hkaHThpXEgJL0oZng=

ionoscloud/data_source_dataplatform_node_pool.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,25 @@ func dataSourceDataplatformNodePool() *schema.Resource {
113113
Computed: true,
114114
Elem: &schema.Schema{Type: schema.TypeString},
115115
},
116+
"auto_scaling": {
117+
Type: schema.TypeList,
118+
Description: "The range defining the minimum and maximum number of worker nodes that the managed node group can scale in",
119+
Computed: true,
120+
Elem: &schema.Resource{
121+
Schema: map[string]*schema.Schema{
122+
"min_node_count": {
123+
Type: schema.TypeInt,
124+
Description: "The minimum number of worker nodes the node pool can scale down to. Should be less than max_node_count",
125+
Computed: true,
126+
},
127+
"max_node_count": {
128+
Type: schema.TypeInt,
129+
Description: "The maximum number of worker nodes that the node pool can scale to. Should be greater than min_node_count",
130+
Computed: true,
131+
},
132+
},
133+
},
134+
},
116135
"cluster_id": {
117136
Type: schema.TypeString,
118137
Required: true,

ionoscloud/resource_dataplatform_nodepool.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,28 @@ func resourceDataplatformNodePool() *schema.Resource {
136136
Description: "The UUID of an existing Dataplatform cluster.",
137137
ValidateDiagFunc: validation.ToDiagFunc(validation.IsUUID),
138138
},
139+
"auto_scaling": {
140+
Type: schema.TypeList,
141+
Description: "The range defining the minimum and maximum number of worker nodes that the managed node group can scale in",
142+
Optional: true,
143+
MaxItems: 1,
144+
Elem: &schema.Resource{
145+
Schema: map[string]*schema.Schema{
146+
"min_node_count": {
147+
Type: schema.TypeInt,
148+
Description: "The minimum number of worker nodes the node pool can scale down to. Should be less than max_node_count",
149+
Required: true,
150+
ValidateDiagFunc: validation.ToDiagFunc(validation.IntAtLeast(1)),
151+
},
152+
"max_node_count": {
153+
Type: schema.TypeInt,
154+
Description: "The maximum number of worker nodes that the node pool can scale to. Should be greater than min_node_count",
155+
Required: true,
156+
ValidateDiagFunc: validation.ToDiagFunc(validation.IntAtLeast(1)),
157+
},
158+
},
159+
},
160+
},
139161
},
140162
Timeouts: &resourceDefaultTimeouts,
141163
}

ionoscloud/resource_dataplatform_nodepool_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ func TestAccDataplatformNodePoolBasic(t *testing.T) {
4444
resource.TestCheckResourceAttr(constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "labels.color", "green"),
4545
resource.TestCheckResourceAttr(constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "annotations.ann1", "value1"),
4646
resource.TestCheckResourceAttr(constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "annotations.ann2", "value2"),
47+
resource.TestCheckResourceAttr(constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "auto_scaling.0.min_node_count", "1"),
48+
resource.TestCheckResourceAttr(constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "auto_scaling.0.max_node_count", "2"),
4749
),
4850
},
4951
{
@@ -63,6 +65,8 @@ func TestAccDataplatformNodePoolBasic(t *testing.T) {
6365
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestDataSourceById, "labels.color", constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "labels.color"),
6466
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestDataSourceById, "annotations.ann1", constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "annotations.ann1"),
6567
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestDataSourceById, "annotations.ann2", constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "annotations.ann2"),
68+
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestDataSourceById, "auto_scaling.0.min_node_count", constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "auto_scaling.0.min_node_count"),
69+
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestDataSourceById, "auto_scaling.0.max_node_count", constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "auto_scaling.0.max_node_count"),
6670
),
6771
},
6872
{
@@ -152,6 +156,8 @@ func TestAccDataplatformNodePoolBasic(t *testing.T) {
152156
resource.TestCheckResourceAttr(constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "maintenance_window.0.day_of_the_week", "Sunday"),
153157
resource.TestCheckResourceAttr(constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "labels.foo", "bar"),
154158
resource.TestCheckResourceAttr(constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "annotations.ann1", "value1"),
159+
resource.TestCheckResourceAttr(constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "auto_scaling.0.min_node_count", "1"),
160+
resource.TestCheckResourceAttr(constant.DataplatformNodePoolResource+"."+constant.DataplatformNodePoolTestResource, "auto_scaling.0.max_node_count", "3"),
155161
),
156162
},
157163
},
@@ -266,6 +272,10 @@ resource ` + constant.DataplatformNodePoolResource + ` ` + constant.Dataplatform
266272
ann1 = "value1"
267273
ann2 = "value2"
268274
}
275+
auto_scaling {
276+
min_node_count = 1
277+
max_node_count = 2
278+
}
269279
}
270280
`
271281

@@ -306,6 +316,10 @@ resource ` + constant.DataplatformNodePoolResource + ` ` + constant.Dataplatform
306316
annotations = {
307317
ann1 = "value1"
308318
}
319+
auto_scaling {
320+
min_node_count = 1
321+
max_node_count = 3
322+
}
309323
}
310324
`
311325

0 commit comments

Comments
 (0)