1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

add missing files

This commit is contained in:
shivkumar dudhani 2019-12-12 16:35:37 -08:00
parent 4421d793be
commit 745727fd70
3 changed files with 9 additions and 9 deletions

View file

@ -10,8 +10,8 @@ import (
// Builder builds Policy Violation struct
// this is base type of namespaced and cluster policy violation
type Builder interface {
generate(info Info) []kyverno.PolicyViolation
build(policy, kind, namespace, name string, rules []kyverno.ViolatedRule) *kyverno.PolicyViolation
generate(info Info) []kyverno.PolicyViolationTemplate
build(policy, kind, namespace, name string, rules []kyverno.ViolatedRule) *kyverno.PolicyViolationTemplate
}
type pvBuilder struct {
@ -25,7 +25,7 @@ func newPvBuilder(dclient *client.Client) *pvBuilder {
}
return &pvb
}
func (pvb *pvBuilder) generate(info Info) []kyverno.PolicyViolation {
func (pvb *pvBuilder) generate(info Info) []kyverno.PolicyViolationTemplate {
var owners []kyverno.ResourceSpec
// get the owners if the resource is blocked or
// TODO: https://github.com/nirmata/kyverno/issues/535
@ -37,8 +37,8 @@ func (pvb *pvBuilder) generate(info Info) []kyverno.PolicyViolation {
return pvs
}
func (pvb *pvBuilder) buildPolicyViolations(owners []kyverno.ResourceSpec, info Info) []kyverno.PolicyViolation {
var pvs []kyverno.PolicyViolation
func (pvb *pvBuilder) buildPolicyViolations(owners []kyverno.ResourceSpec, info Info) []kyverno.PolicyViolationTemplate {
var pvs []kyverno.PolicyViolationTemplate
if len(owners) != 0 {
// there are resource owners
// generate PV on them
@ -54,8 +54,8 @@ func (pvb *pvBuilder) buildPolicyViolations(owners []kyverno.ResourceSpec, info
return pvs
}
func (pvb *pvBuilder) build(policy, kind, namespace, name string, rules []kyverno.ViolatedRule) *kyverno.PolicyViolation {
pv := &kyverno.PolicyViolation{
func (pvb *pvBuilder) build(policy, kind, namespace, name string, rules []kyverno.ViolatedRule) *kyverno.PolicyViolationTemplate {
pv := &kyverno.PolicyViolationTemplate{
Spec: kyverno.PolicyViolationSpec{
Policy: policy,
ResourceSpec: kyverno.ResourceSpec{

View file

@ -34,7 +34,7 @@ func newClusterPV(dclient *client.Client,
return &cpv
}
func (cpv *clusterPV) create(pv kyverno.PolicyViolation) error {
func (cpv *clusterPV) create(pv kyverno.PolicyViolationTemplate) error {
newPv := kyverno.ClusterPolicyViolation(pv)
// PV already exists
oldPv, err := cpv.getExisting(newPv)

View file

@ -249,5 +249,5 @@ func (gen *Generator) syncHandler(info Info) error {
// Provides an interface to generate policy violations
// implementations for namespaced and cluster PV
type pvGenerator interface {
create(policyViolation kyverno.PolicyViolation) error
create(policyViolation kyverno.PolicyViolationTemplate) error
}