@@ -70,6 +70,11 @@ func updateFromPod(pod *v1.Pod, what watch.EventType, cc chan events.ComponentUp
70
70
return fmt .Errorf ("Worker without component label %s\n " , pod .Name )
71
71
}
72
72
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
+
73
78
name := pod .Name
74
79
75
80
if component == string (comp .WorkersComponent ) {
@@ -78,7 +83,9 @@ func updateFromPod(pod *v1.Pod, what watch.EventType, cc chan events.ComponentUp
78
83
return fmt .Errorf ("Worker without pool name label %s\n " , pod .Name )
79
84
}
80
85
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
82
89
lastDashIdx := strings .LastIndex (pod .Name , "-" )
83
90
suffix := pod .Name [lastDashIdx + 1 :]
84
91
name = fmt .Sprintf ("%s.%s" , poolname , suffix )
@@ -118,6 +125,7 @@ func updateFromPod(pod *v1.Pod, what watch.EventType, cc chan events.ComponentUp
118
125
119
126
poolName , exists := pod .Labels ["app.kubernetes.io/name" ]
120
127
if exists {
128
+ poolName = strings .Replace (poolName , runname + "-" , "" , 1 )
121
129
cc <- events .WorkerUpdate (name , pod .Namespace , poolName , platform .Kubernetes , workerStatus , what )
122
130
}
123
131
}
0 commit comments