Skip to content

Flesh out base Rego module #2

@mansam

Description

@mansam

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions