Skip to content

Commit

Permalink
fix(neighbours): only check other kubenurse pods
Browse files Browse the repository at this point in the history
closes #110

Signed-off-by: Clément Nussbaumer <[email protected]>
  • Loading branch information
clementnuss committed Feb 19, 2024
1 parent 8d891b6 commit 62e737c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/servicecheck/neighbours.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package servicecheck
import (
"context"
"fmt"
"os"

v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
Expand Down Expand Up @@ -34,6 +35,8 @@ func (c *Checker) GetNeighbours(ctx context.Context, namespace, labelSelector st

var neighbours = make([]Neighbour, 0, len(pods.Items))

var hostname, _ = os.Hostname()

// process pods
for idx := range pods.Items {
pod := pods.Items[idx]
Expand All @@ -52,6 +55,10 @@ func (c *Checker) GetNeighbours(ctx context.Context, namespace, labelSelector st
continue
}

if pod.Name == hostname { // only quey other pods, not the currently running pod
continue
}

n := Neighbour{
PodName: pod.Name,
PodIP: pod.Status.PodIP,
Expand Down

0 comments on commit 62e737c

Please sign in to comment.