From 14ba8d555005f31fc2201cb8b61653093c19b8a7 Mon Sep 17 00:00:00 2001 From: Matthis Holleville Date: Thu, 30 Mar 2023 01:35:09 +0200 Subject: [PATCH] fix: add Ingress in GetParent switch case Signed-off-by: Matthis Holleville --- pkg/util/util.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/util/util.go b/pkg/util/util.go index 2ad74c8af1..598a8c73c3 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -50,6 +50,16 @@ func GetParent(client *kubernetes.Client, meta metav1.ObjectMeta) (string, bool) return GetParent(client, ds.ObjectMeta) } return "DaemonSet/" + ds.Name, false + + case "Ingress": + ds, err := client.GetClient().NetworkingV1().Ingresses(meta.Namespace).Get(context.Background(), owner.Name, metav1.GetOptions{}) + if err != nil { + return "", false + } + if ds.OwnerReferences != nil { + return GetParent(client, ds.ObjectMeta) + } + return "Ingress/" + ds.Name, false } } }