Skip to content

Commit

Permalink
Merge pull request #1018 from Abirdcfly/fixworker
Browse files Browse the repository at this point in the history
fix: worker check should add ns
  • Loading branch information
bjwswang authored Apr 22, 2024
2 parents 2aea1a6 + 96e75f7 commit eea4d8d
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 eea4d8d

Please sign in to comment.