@@ -25,9 +25,6 @@ const tolerationsExpression = "{{- if .Values.tolerations }}\n" +
2525// already has one defined.
2626func ProcessSpecMap (name string , specMap map [string ]interface {}, values * helmify.Values , defaultEmpty bool ) string {
2727
28- mapConstraint (name , specMap , topology , values )
29- mapConstraint (name , specMap , tolerations , values )
30- mapConstraint (name , specMap , nodeSelector , values )
3128 spec , err := yamlformat .Marshal (specMap , 6 )
3229 if err != nil {
3330 return ""
@@ -40,18 +37,31 @@ func ProcessSpecMap(name string, specMap map[string]interface{}, values *helmify
4037 return spec + topologyExpression + nodeSelectorExpression + tolerationsExpression
4138 }
4239
43- return spec
44- }
40+ if specMap [topology ] != nil {
41+ (* values )[name ].(map [string ]interface {})[topology ] = specMap [topology ].(interface {})
42+ delete (specMap , topology )
43+ spec += topologyExpression
44+ }
4545
46- func mapConstraintWithEmpty (name string , specMap map [string ]interface {}, constraint string , override interface {}, values * helmify.Values ) {
47- if specMap [constraint ] == nil {
48- (* values )[name ].(map [string ]interface {})[constraint ] = override
46+ if specMap [tolerations ] != nil {
47+ (* values )[name ].(map [string ]interface {})[tolerations ] = specMap [tolerations ].(interface {})
48+ delete (specMap , tolerations )
49+ spec += tolerationsExpression
4950 }
50- delete (specMap , topology )
51+ if specMap [nodeSelector ] != nil {
52+ (* values )[name ].(map [string ]interface {})[nodeSelector ] = specMap [nodeSelector ].(interface {})
53+ delete (specMap , nodeSelector )
54+ spec += nodeSelectorExpression
55+ }
56+
57+ return spec
5158}
5259
53- func mapConstraint (name string , specMap map [string ]interface {}, constraint string , values * helmify.Values ) {
60+ func mapConstraintWithEmpty (name string , specMap map [string ]interface {}, constraint string , override interface {} , values * helmify.Values ) {
5461 if specMap [constraint ] != nil {
5562 (* values )[name ].(map [string ]interface {})[constraint ] = specMap [constraint ].(interface {})
63+ } else {
64+ (* values )[name ].(map [string ]interface {})[constraint ] = override
5665 }
66+ delete (specMap , constraint )
5767}
0 commit comments