-
Notifications
You must be signed in to change notification settings - Fork 2
Description
In the current prototype, the resources are pulled down into lists that are organized by namespace. This mapping of namespaces to lists of resources is what is used as input to the policy engine. To simplify rules writing and cut down on boilerplate, we should establish a Rego base module that provides convenient ways to access the data pulled down from the cluster, that other policies can import and use. For example, the following Rego module would create collections named deployments and pods that consist of all of the objects of the appropriate kinds from all namespaces.
package lib.konveyor
import future.keywords
deployments[deployment] {
some list in input.namespaces[_]
some item in list.items
item.kind == "Deployment"
deployment := item
}
pods[pod] {
some list in input.namespaces[_]
some item in list.items
item.kind == "Pod"
pod := item
}(We also may want to reconsider the way resources are pulled from the cluster and organized prior to feeding them into the policy engine, if we can come up with a way that will further simplify rule writing.)