From 644b026353f9d90de8b88196fac1e8c1b680d05a Mon Sep 17 00:00:00 2001 From: Laimonas Rastenis Date: Tue, 19 Sep 2023 12:58:28 +0300 Subject: [PATCH] fix: remove unsupported PreferNoSchedule taint effect option (#226) Co-authored-by: Laimonas Rastenis --- castai/resource_node_template.go | 11 +++++------ castai/sdk/api.gen.go | 12 ++++++------ docs/resources/node_template.md | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/castai/resource_node_template.go b/castai/resource_node_template.go index ac041cc7..9405d526 100644 --- a/castai/resource_node_template.go +++ b/castai/resource_node_template.go @@ -55,9 +55,8 @@ const ( ) const ( - TaintEffectNoSchedule = "NoSchedule" - TaintEffectNoExecute = "NoExecute" - TaintEffectPreferNoSchedule = "PreferNoSchedule" + TaintEffectNoSchedule = "NoSchedule" + TaintEffectNoExecute = "NoExecute" ) const ( @@ -353,9 +352,9 @@ func resourceNodeTemplate() *schema.Resource { Type: schema.TypeString, Default: TaintEffectNoSchedule, ValidateDiagFunc: validation.ToDiagFunc( - validation.StringInSlice([]string{TaintEffectNoSchedule, TaintEffectNoExecute, TaintEffectPreferNoSchedule}, false), + validation.StringInSlice([]string{TaintEffectNoSchedule, TaintEffectNoExecute}, false), ), - Description: "Effect of a taint to be added to nodes created from this template.", + Description: fmt.Sprintf("Effect of a taint to be added to nodes created from this template, the default is %s. Allowed values: %s.", TaintEffectNoSchedule, strings.Join([]string{TaintEffectNoSchedule, TaintEffectNoExecute}, ", ")), }, }, }, @@ -909,7 +908,7 @@ func flattenCustomTaints(taints *[]sdk.NodetemplatesV1Taint) []map[string]string t[FieldValue] = toString(v) } if e := taint.Effect; e != nil { - t[FieldEffect] = toString(e) + t[FieldEffect] = string(*e) } ts = append(ts, t) diff --git a/castai/sdk/api.gen.go b/castai/sdk/api.gen.go index 0496b776..23bc6e21 100644 --- a/castai/sdk/api.gen.go +++ b/castai/sdk/api.gen.go @@ -91,9 +91,8 @@ const ( // Defines values for NodetemplatesV1TaintEffect. const ( - NoExecute NodetemplatesV1TaintEffect = "NoExecute" - NoSchedule NodetemplatesV1TaintEffect = "NoSchedule" - PreferNoSchedule NodetemplatesV1TaintEffect = "PreferNoSchedule" + NoExecute NodetemplatesV1TaintEffect = "NoExecute" + NoSchedule NodetemplatesV1TaintEffect = "NoSchedule" ) // Defines values for PoliciesV1EvictorStatus. @@ -1520,9 +1519,10 @@ type NodetemplatesV1RebalancingConfiguration struct { // Taint is used in responses. type NodetemplatesV1Taint struct { - Effect *string `json:"effect,omitempty"` - Key *string `json:"key,omitempty"` - Value *string `json:"value,omitempty"` + // TaintEffect is a node taint effect. + Effect *NodetemplatesV1TaintEffect `json:"effect,omitempty"` + Key *string `json:"key,omitempty"` + Value *string `json:"value,omitempty"` } // TaintEffect is a node taint effect. diff --git a/docs/resources/node_template.md b/docs/resources/node_template.md index 26e4d82a..eab90d46 100644 --- a/docs/resources/node_template.md +++ b/docs/resources/node_template.md @@ -103,7 +103,7 @@ Required: Optional: -- `effect` (String) Effect of a taint to be added to nodes created from this template. +- `effect` (String) Effect of a taint to be added to nodes created from this template, the default is NoSchedule. Allowed values: NoSchedule, NoExecute.