diff --git a/go/tasks/pluginmachinery/flytek8s/container_helper.go b/go/tasks/pluginmachinery/flytek8s/container_helper.go index a22b4bf8f..2cf2b0e19 100755 --- a/go/tasks/pluginmachinery/flytek8s/container_helper.go +++ b/go/tasks/pluginmachinery/flytek8s/container_helper.go @@ -117,7 +117,7 @@ func ToK8sContainer(ctx context.Context, taskContainer *core.Container, iFace *c } // Make the container name the same as the pod name, unless it violates K8s naming conventions // Container names are subject to the DNS-1123 standard - containerName := parameters.TaskExecMetadata.GetTaskExecutionID().GetGeneratedName() + containerName := parameters.TaskExecMetadata.GetTaskExecutionID().GetGeneratedName() + "-unknown" if errs := validation.IsDNS1123Label(containerName); len(errs) > 0 { containerName = rand.String(4) } diff --git a/go/tasks/pluginmachinery/flytek8s/pod_helper_test.go b/go/tasks/pluginmachinery/flytek8s/pod_helper_test.go index 004ab19ea..7cd574e9a 100755 --- a/go/tasks/pluginmachinery/flytek8s/pod_helper_test.go +++ b/go/tasks/pluginmachinery/flytek8s/pod_helper_test.go @@ -518,7 +518,7 @@ func TestToK8sPod(t *testing.T) { p, err := ToK8sPodSpec(ctx, x) assert.NoError(t, err) assert.Equal(t, len(p.Tolerations), 0) - assert.Equal(t, "some-acceptable-name", p.Containers[0].Name) + assert.Equal(t, "some-acceptable-name-unknown", p.Containers[0].Name) }) t.Run("Default toleration, selector, scheduler", func(t *testing.T) { @@ -553,7 +553,7 @@ func TestToK8sPod(t *testing.T) { assert.Equal(t, 1, len(p.Tolerations)) assert.Equal(t, 1, len(p.NodeSelector)) assert.Equal(t, "myScheduler", p.SchedulerName) - assert.Equal(t, "some-acceptable-name", p.Containers[0].Name) + assert.Equal(t, "some-acceptable-name-unknown", p.Containers[0].Name) }) } diff --git a/go/tasks/plugins/k8s/kfoperators/common/common_operator.go b/go/tasks/plugins/k8s/kfoperators/common/common_operator.go index 49b9064f8..ad11a35cf 100644 --- a/go/tasks/plugins/k8s/kfoperators/common/common_operator.go +++ b/go/tasks/plugins/k8s/kfoperators/common/common_operator.go @@ -128,7 +128,7 @@ func OverrideDefaultContainerName(taskCtx pluginsCore.TaskExecutionContext, podS // https://github.com/kubeflow/tf-operator/blob/984adc287e6fe82841e4ca282dc9a2cbb71e2d4a/pkg/apis/tensorflow/validation/validation.go#L55-L63 // hence we have to override the name set here // https://github.com/flyteorg/flyteplugins/blob/209c52d002b4e6a39be5d175bc1046b7e631c153/go/tasks/pluginmachinery/flytek8s/container_helper.go#L116 - flyteDefaultContainerName := taskCtx.TaskExecutionMetadata().GetTaskExecutionID().GetGeneratedName() + flyteDefaultContainerName := taskCtx.TaskExecutionMetadata().GetTaskExecutionID().GetGeneratedName() + "-unknown" for idx, c := range podSpec.Containers { if c.Name == flyteDefaultContainerName { podSpec.Containers[idx].Name = defaultContainerName