From 59abfcf8a7024463281a3e92dd1905f4b42d2364 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 14 Jun 2024 15:15:20 -0600 Subject: [PATCH] fix #432 don't compare when object kind doesn't match kind in last-applied-configuration (#542) Co-authored-by: Ryan --- pkg/discovery-api/discovery_api.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/discovery-api/discovery_api.go b/pkg/discovery-api/discovery_api.go index 15cbde4f..d574835a 100644 --- a/pkg/discovery-api/discovery_api.go +++ b/pkg/discovery-api/discovery_api.go @@ -145,6 +145,10 @@ func (cl *DiscoveryClient) GetApiResources() error { klog.Errorf("failed to parse 'last-applied-configuration' annotation of resource %s/%s: %s", r.GetNamespace(), r.GetName(), err.Error()) continue } + if r.Object["kind"] != manifest["kind"] { + klog.V(2).Infof("Object Kind %s does not match last-applied-configuration-kind %s. Skipping", r.Object["kind"], manifest["kind"]) + continue + } data, err := json.Marshal(manifest) if err != nil { klog.Error("Failed to marshal data ", err.Error())