Skip to content

Commit

Permalink
Added GKResourceRef and moved GK filtering conditions to ref.go
Browse files Browse the repository at this point in the history
  • Loading branch information
100mik committed Feb 7, 2022
1 parent be311e4 commit 88a775b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions pkg/kapp/resources/refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ func (r PartialResourceRef) Matches(other schema.GroupVersionResource) bool {
return false
}
}

type GKResourceRef struct {
schema.GroupKind
}

func (r GKResourceRef) Matches(other ResourceType) bool {
return r.Group == other.APIResource.Group && r.Kind == other.Kind
}
2 changes: 1 addition & 1 deletion pkg/kapp/resources/resource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func MatchingAnyGK(in []ResourceType, gks []schema.GroupKind) []ResourceType {
var out []ResourceType
for _, item := range in {
for _, gk := range gks {
if item.APIResource.Group == gk.Group && item.Kind == gk.Kind {
if (GKResourceRef{gk}).Matches(item) {
out = append(out, item)
}
}
Expand Down

0 comments on commit 88a775b

Please sign in to comment.