Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude CiliumIdentity kind during listing resources #751

Merged
merged 1 commit into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 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,10 @@ func (r IdentifiedResources) List(labelSelector labels.Selector, resRefs []Resou
schema.GroupVersionResource{Version: "v1", Resource: "componentstatuses"},
})

// https://github.com/carvel-dev/kapp/issues/748
// TODO provide a way to exclude resource via configuration
praveenrewar marked this conversation as resolved.
Show resolved Hide resolved
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