|
8 | 8 |
|
9 | 9 | "github.com/arttor/helmify/pkg/cluster" |
10 | 10 | "github.com/arttor/helmify/pkg/processor" |
11 | | - "github.com/arttor/helmify/pkg/processor/constraints" |
12 | 11 | "github.com/arttor/helmify/pkg/processor/imagePullSecrets" |
13 | 12 |
|
14 | 13 | "github.com/arttor/helmify/pkg/helmify" |
@@ -51,7 +50,6 @@ const selectorTempl = `%[1]s |
51 | 50 | const imagePullPolicyTemplate = "{{ .Values.%[1]s.%[2]s.imagePullPolicy }}" |
52 | 51 | const envValue = "{{ .Values.%[1]s.%[2]s.%[3]s.%[4]s }}" |
53 | 52 |
|
54 | | - |
55 | 53 | // New creates processor for k8s Deployment resource. |
56 | 54 | func New() helmify.Processor { |
57 | 55 | return &deployment{} |
@@ -165,7 +163,22 @@ func (d deployment) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstr |
165 | 163 | imagePullSecrets.ProcessSpecMap(specMap, &values) |
166 | 164 | } |
167 | 165 |
|
168 | | - spec := constraints.ProcessSpecMap(nameCamel, specMap, &values, appMeta.Config().GenerateDefaults) |
| 166 | + // process nodeSelector if presented: |
| 167 | + if len(depl.Spec.Template.Spec.NodeSelector) != 0 { |
| 168 | + err = unstructured.SetNestedField(specMap, fmt.Sprintf(`{{- toYaml .Values.%s.nodeSelector | nindent 8 }}`, nameCamel), "nodeSelector") |
| 169 | + if err != nil { |
| 170 | + return true, nil, err |
| 171 | + } |
| 172 | + err = unstructured.SetNestedStringMap(values, depl.Spec.Template.Spec.NodeSelector, nameCamel, "nodeSelector") |
| 173 | + if err != nil { |
| 174 | + return true, nil, err |
| 175 | + } |
| 176 | + } |
| 177 | + |
| 178 | + spec, err := yamlformat.Marshal(specMap, 6) |
| 179 | + if err != nil { |
| 180 | + return true, nil, err |
| 181 | + } |
169 | 182 | spec = strings.ReplaceAll(spec, "'", "") |
170 | 183 |
|
171 | 184 | return true, &result{ |
|
0 commit comments