Skip to content

Commit

Permalink
Exclude CiliumIdentity kind during listing resources
Browse files Browse the repository at this point in the history
Signed-off-by: Praveen Rewar <[email protected]>
  • Loading branch information
praveenrewar committed May 15, 2023
1 parent 6a2d06e commit cf656e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/kapp/resources/identified_resources_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/kapp/resources/resource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cf656e8

Please sign in to comment.