open-policy-agent/frameworks

[local.Driver] Copy Constraint matching library from gatekeeper to frameworks

willbeason opened this issue · 2 comments

In short: We want to Driver to have access to the logic we currently use in gatekeeper for matching objects to mutators. Much of this logic already exists in gatekeeper, so really it just needs to be migrated to frameworks.

This code should probably live in its own package, pkg/client/match.

Files to copy:

  • gatekeeperpkg/mutation/match/match.go -> frameworks pkg/client/match/match.go
  • gatekeeper pkg/util/prefix_wildcard.go -> frameworks pkg/client/match/prefix_wildcard.go (don't put this in a "util" library)

(and their respective tests)

It's probably best to do this as its own PR before any additional work, so it's obvious if we end up changing any of the matching logic.

We probably only want to copy (or codify) the interface, since frameworks should be target-neutral and Gatekeeper's match logic is specific to Kubernetes.

Done since we've done the interface. The corresponding work in Gatekeeper has an issue there.