From cf656e8441983f95dbbcd6621944b4eb98052759 Mon Sep 17 00:00:00 2001 From: Praveen Rewar <8457124+praveenrewar@users.noreply.github.com> Date: Thu, 11 May 2023 17:53:45 +0530 Subject: [PATCH] Exclude CiliumIdentity kind during listing resources Signed-off-by: Praveen Rewar <8457124+praveenrewar@users.noreply.github.com> --- pkg/kapp/resources/identified_resources_list.go | 2 ++ pkg/kapp/resources/resource_types.go | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/pkg/kapp/resources/identified_resources_list.go b/pkg/kapp/resources/identified_resources_list.go index 21bb98056..b9c8aefe9 100644 --- a/pkg/kapp/resources/identified_resources_list.go +++ b/pkg/kapp/resources/identified_resources_list.go @@ -38,6 +38,8 @@ func (r IdentifiedResources) List(labelSelector labels.Selector, resRefs []Resou schema.GroupVersionResource{Version: "v1", Resource: "componentstatuses"}, }) + resTypes = NonMatchingGK(resTypes, schema.GroupKind{Group: "cilium.io", Kind: "CiliumIdentity"}) + if len(opts.GKsScope) > 0 { resTypes = MatchingAnyGK(resTypes, opts.GKsScope) } diff --git a/pkg/kapp/resources/resource_types.go b/pkg/kapp/resources/resource_types.go index 654fd1523..8ba7ba0c1 100644 --- a/pkg/kapp/resources/resource_types.go +++ b/pkg/kapp/resources/resource_types.go @@ -270,6 +270,16 @@ func NonMatching(in []ResourceType, ref ResourceRef) []ResourceType { return out } +func NonMatchingGK(in []ResourceType, gk schema.GroupKind) []ResourceType { + var out []ResourceType + for _, item := range in { + if !(GKResourceRef{gk}).Matches(item) { + out = append(out, item) + } + } + return out +} + // TODO: Extend ResourceRef and PartialResourceRefd to allow GVK matching func MatchingAnyGK(in []ResourceType, gks []schema.GroupKind) []ResourceType { var out []ResourceType