Skip to content

Commit

Permalink
fix: remove pod labels with potentially incompatible names (#9349)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkunapuli authored and NicholasBlaskey committed May 10, 2024
1 parent 6995ca6 commit 1e8f8de
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
6 changes: 6 additions & 0 deletions docs/release-notes/pod-label-bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:orphan:

**Bug Fixes**

- Kubernetes: Fix an issue introduced in 0.32.0 where workspaces with names incompatible with
Kubernetes naming requirements would cause jobs in that workspace to fail.
6 changes: 0 additions & 6 deletions master/internal/rm/kubernetesrm/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,6 @@ func (p *pod) configurePodSpec(
if podSpec.ObjectMeta.Labels == nil {
podSpec.ObjectMeta.Labels = make(map[string]string)
}
if p.submissionInfo.taskSpec.Owner != nil {
// Owner label will disappear if Owner is somehow nil.
podSpec.ObjectMeta.Labels[userLabel] = p.submissionInfo.taskSpec.Owner.Username
}
podSpec.ObjectMeta.Labels[workspaceLabel] = p.submissionInfo.taskSpec.Workspace
podSpec.ObjectMeta.Labels[resourcePoolLabel] = p.req.ResourcePool
podSpec.ObjectMeta.Labels[taskTypeLabel] = string(p.submissionInfo.taskSpec.TaskType)
podSpec.ObjectMeta.Labels[taskIDLabel] = p.submissionInfo.taskSpec.TaskID
podSpec.ObjectMeta.Labels[containerIDLabel] = p.submissionInfo.taskSpec.ContainerID
Expand Down
11 changes: 4 additions & 7 deletions master/internal/rm/kubernetesrm/spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,10 @@ func TestDeterminedLabels(t *testing.T) {

// define expectations
expectedLabels := map[string]string{
determinedLabel: taskSpec.AllocationID,
userLabel: taskSpec.Owner.Username,
workspaceLabel: taskSpec.Workspace,
resourcePoolLabel: p.req.ResourcePool,
taskTypeLabel: string(taskSpec.TaskType),
taskIDLabel: taskSpec.TaskID,
containerIDLabel: taskSpec.ContainerID,
determinedLabel: taskSpec.AllocationID,
taskTypeLabel: string(taskSpec.TaskType),
taskIDLabel: taskSpec.TaskID,
containerIDLabel: taskSpec.ContainerID,
}
for k, v := range taskSpec.ExtraPodLabels {
expectedLabels[labelPrefix+k] = v
Expand Down

0 comments on commit 1e8f8de

Please sign in to comment.