Skip to content

Commit 7a6d1d0

Browse files
author
Pawel Peksa
committed
reviewfix4
1 parent 40433f3 commit 7a6d1d0

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

castai/resource_pod_mutation.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ const (
4040
FieldPodMutationPreferred = "preferred_during_scheduling_ignored_during_execution"
4141
FieldPodMutationWeight = "weight"
4242
FieldPodMutationPreference = "preference"
43-
FieldPodMutationMatchExpressions = "match_expressions"
43+
FieldPodMutationMatchExpressions = "match_expressions"
44+
FieldPodMutationMatchExpressionsKey = "key"
45+
FieldPodMutationMatchExpressionsOperator = "operator"
4446
FieldPodMutationSpotType = "spot_type"
4547
FieldPodMutationSpotDistributionPct = "spot_distribution_percentage"
4648
FieldPodMutationNodeTemplates = "node_templates_to_consolidate"
@@ -205,11 +207,11 @@ var affinitySchema = &schema.Resource{
205207
Optional: true,
206208
Elem: &schema.Resource{
207209
Schema: map[string]*schema.Schema{
208-
FieldPodMutationTolerationKey: {
210+
FieldPodMutationMatchExpressionsKey: {
209211
Type: schema.TypeString,
210212
Required: true,
211213
},
212-
FieldPodMutationTolerationOperator: {
214+
FieldPodMutationMatchExpressionsOperator: {
213215
Type: schema.TypeString,
214216
Required: true,
215217
},
@@ -924,8 +926,8 @@ func stateToAffinity(m map[string]interface{}) *patching_engine.Affinity {
924926
continue
925927
}
926928
em := e.(map[string]interface{})
927-
key := em[FieldPodMutationTolerationKey].(string)
928-
operator := em[FieldPodMutationTolerationOperator].(string)
929+
key := em[FieldPodMutationMatchExpressionsKey].(string)
930+
operator := em[FieldPodMutationMatchExpressionsOperator].(string)
929931
req := patching_engine.NodeSelectorRequirement{
930932
Key: &key,
931933
Operator: &operator,
@@ -1108,7 +1110,7 @@ func podMutationToState(mutation *patching_engine.PodMutation, d *schema.Resourc
11081110
return diag.FromErr(err)
11091111
}
11101112
}
1111-
1113+
11121114
return nil
11131115
}
11141116

@@ -1229,8 +1231,8 @@ func flattenAffinity(affinity *patching_engine.Affinity) []map[string]interface{
12291231
exprs := make([]map[string]interface{}, 0)
12301232
for _, req := range *term.Preference.MatchExpressions {
12311233
exprMap := map[string]interface{}{
1232-
FieldPodMutationTolerationKey: lo.FromPtr(req.Key),
1233-
FieldPodMutationTolerationOperator: lo.FromPtr(req.Operator),
1234+
FieldPodMutationMatchExpressionsKey: lo.FromPtr(req.Key),
1235+
FieldPodMutationMatchExpressionsOperator: lo.FromPtr(req.Operator),
12341236
}
12351237
if req.Values != nil {
12361238
exprMap[FieldPodMutationValues] = *req.Values

0 commit comments

Comments
 (0)