Skip to content

Commit

Permalink
fix pinger namespace error (#2034)
Browse files Browse the repository at this point in the history
  • Loading branch information
orionpretty authored and zhangzujian committed Nov 11, 2022
1 parent ea5b931 commit 9c8ffcf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/pinger/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ func ParseFlags() (*Configuration, error) {

podName := os.Getenv("POD_NAME")
for i := 0; i < 3; i++ {
pod, err := config.KubeClient.CoreV1().Pods("kube-system").Get(context.Background(), podName, metav1.GetOptions{})
pod, err := config.KubeClient.CoreV1().Pods(config.DaemonSetNamespace).Get(context.Background(), podName, metav1.GetOptions{})
if err != nil {
klog.Errorf("failed to get self pod kube-system/%s: %v", podName, err)
klog.Errorf("failed to get self pod %s/%s: %v", config.DaemonSetNamespace, podName, err)
return nil, err
}

Expand All @@ -152,15 +152,15 @@ func ParseFlags() (*Configuration, error) {
}

if pod.Status.ContainerStatuses[0].Ready {
klog.Fatalf("failed to get IPs of Pod kube-system/%s", podName)
klog.Fatalf("failed to get IPs of Pod %s/%s", config.DaemonSetNamespace, podName)
}

klog.Infof("cannot get Pod IPs now, waiting Pod to be ready")
time.Sleep(time.Second)
}

if len(config.PodProtocols) == 0 {
klog.Fatalf("failed to get IPs of Pod kube-system/%s after 3 attempts", podName)
klog.Fatalf("failed to get IPs of Pod %s/%s after 3 attempts", config.DaemonSetNamespace, podName)
}

klog.Infof("pinger config is %+v", config)
Expand Down

0 comments on commit 9c8ffcf

Please sign in to comment.