diff --git a/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go b/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go index 54f9a1f017..e9736ff6a7 100755 --- a/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go +++ b/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go @@ -85,7 +85,7 @@ func UpdatePod(taskExecutionMetadata pluginsCore.TaskExecutionMetadata, if len(podSpec.SchedulerName) == 0 { podSpec.SchedulerName = config.GetK8sPluginConfig().SchedulerName } - podSpec.NodeSelector = utils.UnionMaps(podSpec.NodeSelector, config.GetK8sPluginConfig().DefaultNodeSelector) + podSpec.NodeSelector = utils.UnionMaps(config.GetK8sPluginConfig().DefaultNodeSelector, podSpec.NodeSelector) if taskExecutionMetadata.IsInterruptible() { podSpec.NodeSelector = utils.UnionMaps(podSpec.NodeSelector, config.GetK8sPluginConfig().InterruptibleNodeSelector) } diff --git a/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper_test.go b/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper_test.go index 01c16051e9..7168074521 100755 --- a/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper_test.go +++ b/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper_test.go @@ -330,7 +330,7 @@ func toK8sPodInterruptible(t *testing.T) { assert.Len(t, p.Tolerations, 2) assert.Equal(t, "x/flyte", p.Tolerations[1].Key) assert.Equal(t, "interruptible", p.Tolerations[1].Value) - assert.Equal(t, 1, len(p.NodeSelector)) + assert.Equal(t, 2, len(p.NodeSelector)) assert.Equal(t, "true", p.NodeSelector["x/interruptible"]) assert.EqualValues( t, diff --git a/flyteplugins/go/tasks/pluginmachinery/flytek8s/testdata/config.yaml b/flyteplugins/go/tasks/pluginmachinery/flytek8s/testdata/config.yaml index 1441a64595..a34968682b 100644 --- a/flyteplugins/go/tasks/pluginmachinery/flytek8s/testdata/config.yaml +++ b/flyteplugins/go/tasks/pluginmachinery/flytek8s/testdata/config.yaml @@ -43,6 +43,8 @@ plugins: - FLYTE_AWS_ENDPOINT: "http://minio.flyte:9000" - FLYTE_AWS_ACCESS_KEY_ID: minio - FLYTE_AWS_SECRET_ACCESS_KEY: miniostorage + default-node-selector: + user: 'default' default-pod-security-context: runAsUser: 1000 runAsGroup: 3000 diff --git a/flyteplugins/go/tasks/plugins/array/k8s/subtask.go b/flyteplugins/go/tasks/plugins/array/k8s/subtask.go index 67e9d2fe5c..5cdc80596a 100644 --- a/flyteplugins/go/tasks/plugins/array/k8s/subtask.go +++ b/flyteplugins/go/tasks/plugins/array/k8s/subtask.go @@ -62,7 +62,7 @@ func addMetadata(stCtx SubTaskExecutionContext, cfg *Config, k8sPluginCfg *confi pod.SetNamespace(namespace) pod.SetAnnotations(utils.UnionMaps(k8sPluginCfg.DefaultAnnotations, pod.GetAnnotations(), utils.CopyMap(taskExecutionMetadata.GetAnnotations()))) - pod.SetLabels(utils.UnionMaps(pod.GetLabels(), utils.CopyMap(taskExecutionMetadata.GetLabels()), k8sPluginCfg.DefaultLabels)) + pod.SetLabels(utils.UnionMaps(k8sPluginCfg.DefaultLabels, pod.GetLabels(), utils.CopyMap(taskExecutionMetadata.GetLabels()))) pod.SetName(taskExecutionMetadata.GetTaskExecutionID().GetGeneratedName()) if !cfg.RemoteClusterConfig.Enabled {