From 6f87f3288b762fb7566d36df81bef763c1903c25 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Tue, 29 Dec 2020 21:53:55 -0300 Subject: [PATCH] Do not assume ingress-nginx is using recommended labels --- internal/k8s/main.go | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/internal/k8s/main.go b/internal/k8s/main.go index 6012c39e8..364d7c8ec 100644 --- a/internal/k8s/main.go +++ b/internal/k8s/main.go @@ -78,12 +78,6 @@ func GetNodeIPOrName(kubeClient clientset.Interface, name string, useInternalIP var ( // IngressPodDetails hold information about the ingress-nginx pod IngressPodDetails *PodInfo - - selectorLabelKeys = []string{ - "app.kubernetes.io/component", - "app.kubernetes.io/instance", - "app.kubernetes.io/name", - } ) // PodInfo contains runtime information about the pod running the Ingres controller @@ -107,22 +101,12 @@ func GetIngressPod(kubeClient clientset.Interface) error { return fmt.Errorf("unable to get POD information: %v", err) } - labels := map[string]string{} - for _, key := range selectorLabelKeys { - value, ok := pod.GetLabels()[key] - if !ok { - return fmt.Errorf("label %v is missing. Please do not remove", key) - } - - labels[key] = value - } - IngressPodDetails = &PodInfo{ TypeMeta: metav1.TypeMeta{APIVersion: "v1", Kind: "Pod"}, } pod.ObjectMeta.DeepCopyInto(&IngressPodDetails.ObjectMeta) - IngressPodDetails.SetLabels(labels) + IngressPodDetails.SetLabels(pod.GetLabels()) return nil }