diff --git a/pkg/common/k8s/main.go b/pkg/common/k8s/main.go index c846405da..7a427ad00 100644 --- a/pkg/common/k8s/main.go +++ b/pkg/common/k8s/main.go @@ -91,10 +91,18 @@ func GetPodDetails(kubeClient clientset.Interface) (*PodInfo, error) { return nil, fmt.Errorf("unable to get POD information") } + podNodeIP := GetNodeIP(kubeClient, pod.Spec.NodeName, true) + podLabels := pod.GetLabels() + + // remove labels that uniquely identify a pod + delete(podLabels, "controller-revision-hash") + delete(podLabels, "pod-template-generation") + delete(podLabels, "pod-template-hash") + return &PodInfo{ Name: podName, Namespace: podNs, - NodeIP: GetNodeIP(kubeClient, pod.Spec.NodeName, true), - Labels: pod.GetLabels(), + NodeIP: podNodeIP, + Labels: podLabels, }, nil } diff --git a/pkg/controller/services/svcstatusing.go b/pkg/controller/services/svcstatusing.go index a69daaed4..e3417d4d1 100644 --- a/pkg/controller/services/svcstatusing.go +++ b/pkg/controller/services/svcstatusing.go @@ -253,10 +253,17 @@ func (s *svcStatusIng) getControllerPodList(ctx context.Context) ([]api.Pod, err if err := s.cli.Get(ctx, types.NamespacedName{Namespace: s.cfg.PodNamespace, Name: s.cfg.PodName}, &pod); err != nil { return nil, err } + + // remove labels that uniquely identify a pod + podLabels := pod.GetLabels() + delete(podLabels, "controller-revision-hash") + delete(podLabels, "pod-template-generation") + delete(podLabels, "pod-template-hash") + // read all controller's pod podList := api.PodList{} if err := s.cli.List(ctx, &podList, &client.ListOptions{ - LabelSelector: labels.SelectorFromSet(pod.GetLabels()), + LabelSelector: labels.SelectorFromSet(podLabels), Namespace: s.cfg.PodNamespace, }); err != nil { return nil, err