Skip to content

Commit

Permalink
fix: worker check should add ns
Browse files Browse the repository at this point in the history
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
  • Loading branch information
Abirdcfly committed Apr 22, 2024
1 parent 2aea1a6 commit 96e75f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,13 @@ func (podWorker *PodWorker) BeforeStart(ctx context.Context) error {
if err != nil {
return err
}
err = podWorker.c.Get(ctx, types.NamespacedName{Namespace: svc.Namespace, Name: svc.Name}, &corev1.Service{})
tmpSvc := &corev1.Service{}
err = podWorker.c.Get(ctx, types.NamespacedName{Namespace: svc.Namespace, Name: svc.Name}, tmpSvc)
switch ActionOnError(err) {
case Panic:
return err
case Update:
svc = tmpSvc
if err := podWorker.c.Update(ctx, svc); err != nil {
return err
}
Expand Down Expand Up @@ -607,6 +609,7 @@ func (podWorker *PodWorker) Stop(ctx context.Context) error {
func (podWorker *PodWorker) State(ctx context.Context) (any, error) {
podList := &corev1.PodList{}
err := podWorker.c.List(ctx, podList, &client.ListOptions{
Namespace: podWorker.w.Namespace,
LabelSelector: labels.Set{
arcadiav1alpha1.WorkerPodSelectorLabel: podWorker.SuffixedName(),
}.AsSelector(),
Expand Down

0 comments on commit 96e75f7

Please sign in to comment.