Skip to content

Commit 6047a56

Browse files
committed
fix: status UI fails to show task cells for workers
Signed-off-by: Nick Mitchell <[email protected]>
1 parent c6a5220 commit 6047a56

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pkg/be/kubernetes/updates.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ func updateFromPod(pod *v1.Pod, what watch.EventType, cc chan events.ComponentUp
7070
return fmt.Errorf("Worker without component label %s\n", pod.Name)
7171
}
7272

73+
runname, exists := pod.Labels["app.kubernetes.io/instance"]
74+
if !exists {
75+
return fmt.Errorf("Worker without instance/runname label %s\n", pod.Name)
76+
}
77+
7378
name := pod.Name
7479

7580
if component == string(comp.WorkersComponent) {
@@ -78,7 +83,9 @@ func updateFromPod(pod *v1.Pod, what watch.EventType, cc chan events.ComponentUp
7883
return fmt.Errorf("Worker without pool name label %s\n", pod.Name)
7984
}
8085

81-
// see watcher.sh remote=... TODO avoid these disparate hacks
86+
poolname = strings.Replace(poolname, runname+"-", "", 1)
87+
88+
// see worker-watcher main.go getPodNameSuffix() TODO avoid these disparate hacks
8289
lastDashIdx := strings.LastIndex(pod.Name, "-")
8390
suffix := pod.Name[lastDashIdx+1:]
8491
name = fmt.Sprintf("%s.%s", poolname, suffix)
@@ -118,6 +125,7 @@ func updateFromPod(pod *v1.Pod, what watch.EventType, cc chan events.ComponentUp
118125

119126
poolName, exists := pod.Labels["app.kubernetes.io/name"]
120127
if exists {
128+
poolName = strings.Replace(poolName, runname+"-", "", 1)
121129
cc <- events.WorkerUpdate(name, pod.Namespace, poolName, platform.Kubernetes, workerStatus, what)
122130
}
123131
}

pkg/observe/qstat/stream.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func streamModel(runname, namespace string, follow bool, tail int64, quiet bool,
142142
}
143143

144144
func poolName(worker Worker) string {
145-
// test7f-pool1.w0.w96bh -> test7f-pool1
145+
// test7f-pool1.w96bh -> test7f-pool1
146146
if idx := strings.Index(worker.Name, "."); idx < 0 {
147147
// TODO error handling here. what do we want to do?
148148
return "INVALID: " + worker.Name

0 commit comments

Comments
 (0)