Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Added -unknown suffix to container name #288

Open
wants to merge 2 commits into
base: lyft
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/tasks/pluginmachinery/flytek8s/container_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions go/tasks/pluginmachinery/flytek8s/pod_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
})
}

Expand Down
2 changes: 1 addition & 1 deletion go/tasks/plugins/k8s/kfoperators/common/common_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down