@@ -722,7 +722,6 @@ func ApplyReplacements(spec *v1.TaskSpec, stringReplacements map[string]string,
722722 if e .ValueFrom != nil {
723723 if e .ValueFrom .ConfigMapKeyRef != nil {
724724 spec .PodTemplate .Env [i ].ValueFrom .ConfigMapKeyRef .Key = substitution .ApplyReplacements (e .ValueFrom .ConfigMapKeyRef .Key , stringReplacements )
725- spec .PodTemplate .Env [i ].ValueFrom .ConfigMapKeyRef .Name = substitution .ApplyReplacements (e .ValueFrom .ConfigMapKeyRef .Name , stringReplacements )
726725 spec .PodTemplate .Env [i ].ValueFrom .ConfigMapKeyRef .LocalObjectReference .Name = substitution .ApplyReplacements (e .ValueFrom .ConfigMapKeyRef .LocalObjectReference .Name , stringReplacements )
727726 }
728727 if e .ValueFrom .FieldRef != nil {
@@ -746,17 +745,17 @@ func ApplyReplacements(spec *v1.TaskSpec, stringReplacements map[string]string,
746745 if len (spec .PodTemplate .Affinity .NodeAffinity .PreferredDuringSchedulingIgnoredDuringExecution ) > 0 {
747746 for i , pst := range spec .PodTemplate .Affinity .NodeAffinity .PreferredDuringSchedulingIgnoredDuringExecution {
748747 for j , nsr := range pst .Preference .MatchExpressions {
749- spec .PodTemplate .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution . NodeSelectorTerms [i ].MatchExpressions [j ].Key = substitution .ApplyReplacements (nsr .Key , stringReplacements )
750- spec .PodTemplate .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution . NodeSelectorTerms [i ].MatchExpressions [j ].Operator = corev1 .NodeSelectorOperator (substitution .ApplyReplacements (string (nsr .Operator ), stringReplacements ))
748+ spec .PodTemplate .Affinity .NodeAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. Preference .MatchExpressions [j ].Key = substitution .ApplyReplacements (nsr .Key , stringReplacements )
749+ spec .PodTemplate .Affinity .NodeAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. Preference .MatchExpressions [j ].Operator = corev1 .NodeSelectorOperator (substitution .ApplyReplacements (string (nsr .Operator ), stringReplacements ))
751750 for k , v := range nsr .Values {
752- spec .PodTemplate .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution . NodeSelectorTerms [i ].MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
751+ spec .PodTemplate .Affinity .NodeAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. Preference .MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
753752 }
754753 }
755754 for j , nsr := range pst .Preference .MatchFields {
756- spec .PodTemplate .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution . NodeSelectorTerms [i ].MatchFields [j ].Key = substitution .ApplyReplacements (nsr .Key , stringReplacements )
757- spec .PodTemplate .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution . NodeSelectorTerms [i ].MatchFields [j ].Operator = corev1 .NodeSelectorOperator (substitution .ApplyReplacements (string (nsr .Operator ), stringReplacements ))
755+ spec .PodTemplate .Affinity .NodeAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. Preference .MatchFields [j ].Key = substitution .ApplyReplacements (nsr .Key , stringReplacements )
756+ spec .PodTemplate .Affinity .NodeAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. Preference .MatchFields [j ].Operator = corev1 .NodeSelectorOperator (substitution .ApplyReplacements (string (nsr .Operator ), stringReplacements ))
758757 for k , v := range nsr .Values {
759- spec .PodTemplate .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution . NodeSelectorTerms [i ].MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
758+ spec .PodTemplate .Affinity .NodeAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ].Preference . MatchFields [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
760759 }
761760 }
762761 }
@@ -774,7 +773,7 @@ func ApplyReplacements(spec *v1.TaskSpec, stringReplacements map[string]string,
774773 spec .PodTemplate .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution .NodeSelectorTerms [i ].MatchFields [j ].Key = substitution .ApplyReplacements (nsr .Key , stringReplacements )
775774 spec .PodTemplate .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution .NodeSelectorTerms [i ].MatchFields [j ].Operator = corev1 .NodeSelectorOperator (substitution .ApplyReplacements (string (nsr .Operator ), stringReplacements ))
776775 for k , v := range nsr .Values {
777- spec .PodTemplate .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution .NodeSelectorTerms [i ].MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
776+ spec .PodTemplate .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution .NodeSelectorTerms [i ].MatchFields [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
778777 }
779778 }
780779 }
@@ -790,7 +789,6 @@ func ApplyReplacements(spec *v1.TaskSpec, stringReplacements map[string]string,
790789 for k , v := range lsr .Values {
791790 spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ].PodAffinityTerm .LabelSelector .MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
792791 }
793-
794792 }
795793 spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ].PodAffinityTerm .LabelSelector .MatchLabels = ApplyMap (wpat .PodAffinityTerm .LabelSelector .MatchLabels , stringReplacements )
796794 }
@@ -818,35 +816,35 @@ func ApplyReplacements(spec *v1.TaskSpec, stringReplacements map[string]string,
818816 for i , pat := range spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution {
819817 if pat .LabelSelector != nil {
820818 for j , lsr := range pat .LabelSelector .MatchExpressions {
821- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .LabelSelector .MatchExpressions [j ].Key = substitution .ApplyReplacements (lsr .Key , stringReplacements )
822- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .LabelSelector .MatchExpressions [j ].Operator = metav1 .LabelSelectorOperator (substitution .ApplyReplacements (string (lsr .Operator ), stringReplacements ))
819+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].LabelSelector .MatchExpressions [j ].Key = substitution .ApplyReplacements (lsr .Key , stringReplacements )
820+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].LabelSelector .MatchExpressions [j ].Operator = metav1 .LabelSelectorOperator (substitution .ApplyReplacements (string (lsr .Operator ), stringReplacements ))
823821 for k , v := range lsr .Values {
824- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .LabelSelector .MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
822+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].LabelSelector .MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
825823 }
826824
827825 }
828- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .LabelSelector .MatchLabels = ApplyMap (pat .LabelSelector .MatchLabels , stringReplacements )
826+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].LabelSelector .MatchLabels = ApplyMap (pat .LabelSelector .MatchLabels , stringReplacements )
829827 }
830828 for j , key := range pat .MatchLabelKeys {
831- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .MatchLabelKeys [j ] = substitution .ApplyReplacements (key , stringReplacements )
829+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].MatchLabelKeys [j ] = substitution .ApplyReplacements (key , stringReplacements )
832830 }
833831 for j , key := range pat .MismatchLabelKeys {
834- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .MismatchLabelKeys [j ] = substitution .ApplyReplacements (key , stringReplacements )
832+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].MismatchLabelKeys [j ] = substitution .ApplyReplacements (key , stringReplacements )
835833 }
836834 if pat .NamespaceSelector != nil {
837835 for j , lsr := range pat .NamespaceSelector .MatchExpressions {
838- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .NamespaceSelector .MatchExpressions [j ].Key = substitution .ApplyReplacements (lsr .Key , stringReplacements )
839- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .NamespaceSelector .MatchExpressions [j ].Operator = metav1 .LabelSelectorOperator (substitution .ApplyReplacements (string (lsr .Operator ), stringReplacements ))
836+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].NamespaceSelector .MatchExpressions [j ].Key = substitution .ApplyReplacements (lsr .Key , stringReplacements )
837+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].NamespaceSelector .MatchExpressions [j ].Operator = metav1 .LabelSelectorOperator (substitution .ApplyReplacements (string (lsr .Operator ), stringReplacements ))
840838 for k , v := range lsr .Values {
841- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .NamespaceSelector .MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
839+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].NamespaceSelector .MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
842840 }
843841 }
844- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .NamespaceSelector .MatchLabels = ApplyMap (pat .NamespaceSelector .MatchLabels , stringReplacements )
842+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].NamespaceSelector .MatchLabels = ApplyMap (pat .NamespaceSelector .MatchLabels , stringReplacements )
845843 }
846844 for j , ns := range pat .Namespaces {
847- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .Namespaces [j ] = substitution .ApplyReplacements (ns , stringReplacements )
845+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].Namespaces [j ] = substitution .ApplyReplacements (ns , stringReplacements )
848846 }
849- spec .PodTemplate .Affinity .PodAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .TopologyKey = substitution .ApplyReplacements (pat .TopologyKey , stringReplacements )
847+ spec .PodTemplate .Affinity .PodAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].TopologyKey = substitution .ApplyReplacements (pat .TopologyKey , stringReplacements )
850848 }
851849 }
852850
@@ -887,35 +885,35 @@ func ApplyReplacements(spec *v1.TaskSpec, stringReplacements map[string]string,
887885 for i , pat := range spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution {
888886 if pat .LabelSelector != nil {
889887 for j , lsr := range pat .LabelSelector .MatchExpressions {
890- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .LabelSelector .MatchExpressions [j ].Key = substitution .ApplyReplacements (lsr .Key , stringReplacements )
891- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .LabelSelector .MatchExpressions [j ].Operator = metav1 .LabelSelectorOperator (substitution .ApplyReplacements (string (lsr .Operator ), stringReplacements ))
888+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].LabelSelector .MatchExpressions [j ].Key = substitution .ApplyReplacements (lsr .Key , stringReplacements )
889+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].LabelSelector .MatchExpressions [j ].Operator = metav1 .LabelSelectorOperator (substitution .ApplyReplacements (string (lsr .Operator ), stringReplacements ))
892890 for k , v := range lsr .Values {
893- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .LabelSelector .MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
891+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].LabelSelector .MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
894892 }
895893
896894 }
897- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .LabelSelector .MatchLabels = ApplyMap (pat .LabelSelector .MatchLabels , stringReplacements )
895+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].LabelSelector .MatchLabels = ApplyMap (pat .LabelSelector .MatchLabels , stringReplacements )
898896 }
899897 for j , key := range pat .MatchLabelKeys {
900- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .MatchLabelKeys [j ] = substitution .ApplyReplacements (key , stringReplacements )
898+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].MatchLabelKeys [j ] = substitution .ApplyReplacements (key , stringReplacements )
901899 }
902900 for j , key := range pat .MismatchLabelKeys {
903- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .MismatchLabelKeys [j ] = substitution .ApplyReplacements (key , stringReplacements )
901+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].MismatchLabelKeys [j ] = substitution .ApplyReplacements (key , stringReplacements )
904902 }
905903 if pat .NamespaceSelector != nil {
906904 for j , lsr := range pat .NamespaceSelector .MatchExpressions {
907- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .NamespaceSelector .MatchExpressions [j ].Key = substitution .ApplyReplacements (lsr .Key , stringReplacements )
908- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .NamespaceSelector .MatchExpressions [j ].Operator = metav1 .LabelSelectorOperator (substitution .ApplyReplacements (string (lsr .Operator ), stringReplacements ))
905+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].NamespaceSelector .MatchExpressions [j ].Key = substitution .ApplyReplacements (lsr .Key , stringReplacements )
906+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].NamespaceSelector .MatchExpressions [j ].Operator = metav1 .LabelSelectorOperator (substitution .ApplyReplacements (string (lsr .Operator ), stringReplacements ))
909907 for k , v := range lsr .Values {
910- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .NamespaceSelector .MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
908+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].NamespaceSelector .MatchExpressions [j ].Values [k ] = substitution .ApplyReplacements (v , stringReplacements )
911909 }
912910 }
913- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .NamespaceSelector .MatchLabels = ApplyMap (pat .NamespaceSelector .MatchLabels , stringReplacements )
911+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].NamespaceSelector .MatchLabels = ApplyMap (pat .NamespaceSelector .MatchLabels , stringReplacements )
914912 }
915913 for j , ns := range pat .Namespaces {
916- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .Namespaces [j ] = substitution .ApplyReplacements (ns , stringReplacements )
914+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].Namespaces [j ] = substitution .ApplyReplacements (ns , stringReplacements )
917915 }
918- spec .PodTemplate .Affinity .PodAntiAffinity .PreferredDuringSchedulingIgnoredDuringExecution [i ]. PodAffinityTerm .TopologyKey = substitution .ApplyReplacements (pat .TopologyKey , stringReplacements )
916+ spec .PodTemplate .Affinity .PodAntiAffinity .RequiredDuringSchedulingIgnoredDuringExecution [i ].TopologyKey = substitution .ApplyReplacements (pat .TopologyKey , stringReplacements )
919917 }
920918 }
921919 }
0 commit comments