2019-05-13 18:17:28 -07:00
|
|
|
package engine
|
2019-05-09 22:26:22 -07:00
|
|
|
|
|
|
|
import (
|
2019-05-21 11:00:09 -07:00
|
|
|
types "github.com/nirmata/kyverno/pkg/apis/policy/v1alpha1"
|
|
|
|
"github.com/nirmata/kyverno/pkg/event"
|
|
|
|
"github.com/nirmata/kyverno/pkg/violation"
|
2019-05-09 22:26:22 -07:00
|
|
|
)
|
|
|
|
|
2019-05-14 11:24:40 -07:00
|
|
|
// As the logic to process the policies in stateless, we do not need to define struct and implement behaviors for it
|
2019-05-30 12:28:56 -07:00
|
|
|
// Instead we expose them as standalone functions passing the required atrributes
|
2019-05-14 11:24:40 -07:00
|
|
|
// The each function returns the changes that need to be applied on the resource
|
|
|
|
// the caller is responsible to apply the changes to the resource
|
2019-05-09 22:26:22 -07:00
|
|
|
|
2019-05-14 11:24:40 -07:00
|
|
|
func ProcessExisting(policy types.Policy, rawResource []byte) ([]violation.Info, []event.Info, error) {
|
2019-05-14 18:20:41 -07:00
|
|
|
var violations []violation.Info
|
|
|
|
var events []event.Info
|
2019-05-14 11:24:40 -07:00
|
|
|
|
2019-05-14 18:20:41 -07:00
|
|
|
// TODO:
|
|
|
|
// Mutate()
|
|
|
|
// Validate()
|
|
|
|
return violations, events, nil
|
|
|
|
}
|