@@ -284,6 +284,63 @@ func (f *HelmValuesBasic) addDeploymentConfig(buf *bytes.Buffer) {
284284 } else {
285285 f .addDefaultResources (buf )
286286 }
287+
288+ buf .WriteString (" # Pod's affinity\n " )
289+ if affinity , exists := f .DeploymentConfig ["podAffinity" ]; exists && affinity != nil {
290+ buf .WriteString (" affinity:\n " )
291+ if affYaml , err := yaml .Marshal (affinity ); err == nil {
292+ lines := bytes .Split (affYaml , []byte ("\n " ))
293+ for _ , line := range lines {
294+ if len (line ) > 0 {
295+ buf .WriteString (" " )
296+ buf .Write (line )
297+ buf .WriteString ("\n " )
298+ }
299+ }
300+ }
301+ buf .WriteString ("\n " )
302+ } else {
303+ buf .WriteString (" affinity: {}\n " )
304+ buf .WriteString ("\n " )
305+ }
306+
307+ buf .WriteString (" # Pod's node selector\n " )
308+ if nodeSelector , exists := f .DeploymentConfig ["podNodeSelector" ]; exists && nodeSelector != nil {
309+ buf .WriteString (" nodeSelector:\n " )
310+ if nodYaml , err := yaml .Marshal (nodeSelector ); err == nil {
311+ lines := bytes .Split (nodYaml , []byte ("\n " ))
312+ for _ , line := range lines {
313+ if len (line ) > 0 {
314+ buf .WriteString (" " )
315+ buf .Write (line )
316+ buf .WriteString ("\n " )
317+ }
318+ }
319+ }
320+ buf .WriteString ("\n " )
321+ } else {
322+ buf .WriteString (" nodeSelector: {}\n " )
323+ buf .WriteString ("\n " )
324+ }
325+
326+ buf .WriteString (" # Pod's tolerations\n " )
327+ if tolerations , exists := f .DeploymentConfig ["podTolerations" ]; exists && tolerations != nil {
328+ buf .WriteString (" tolerations:\n " )
329+ if tolYaml , err := yaml .Marshal (tolerations ); err == nil {
330+ lines := bytes .Split (tolYaml , []byte ("\n " ))
331+ for _ , line := range lines {
332+ if len (line ) > 0 {
333+ buf .WriteString (" " )
334+ buf .Write (line )
335+ buf .WriteString ("\n " )
336+ }
337+ }
338+ }
339+ buf .WriteString ("\n " )
340+ } else {
341+ buf .WriteString (" tolerations: []\n " )
342+ buf .WriteString ("\n " )
343+ }
287344}
288345
289346// addDefaultDeploymentSections adds default sections when no deployment config is available
0 commit comments