From dcc3179b092b71842c53b881b49ceebaf6467d5f Mon Sep 17 00:00:00 2001 From: Shuting Zhao Date: Mon, 6 Jan 2020 18:53:36 -0800 Subject: [PATCH] remove dclient from pvbuilder --- pkg/policyviolation/builder.go | 13 +++---------- pkg/policyviolation/generator.go | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/pkg/policyviolation/builder.go b/pkg/policyviolation/builder.go index 7986047c5c..736a0f3380 100644 --- a/pkg/policyviolation/builder.go +++ b/pkg/policyviolation/builder.go @@ -5,7 +5,6 @@ import ( "github.com/golang/glog" kyverno "github.com/nirmata/kyverno/pkg/api/kyverno/v1" - client "github.com/nirmata/kyverno/pkg/dclient" "github.com/nirmata/kyverno/pkg/engine/response" ) @@ -34,16 +33,10 @@ type Builder interface { build(policy, kind, namespace, name string, rules []kyverno.ViolatedRule) *kyverno.PolicyViolationTemplate } -type pvBuilder struct { - // dynamic client - dclient *client.Client -} +type pvBuilder struct{} -func newPvBuilder(dclient *client.Client) *pvBuilder { - pvb := pvBuilder{ - dclient: dclient, - } - return &pvb +func newPvBuilder() *pvBuilder { + return &pvBuilder{} } func (pvb *pvBuilder) generate(info Info) kyverno.PolicyViolationTemplate { diff --git a/pkg/policyviolation/generator.go b/pkg/policyviolation/generator.go index 72c103b558..2c94910274 100644 --- a/pkg/policyviolation/generator.go +++ b/pkg/policyviolation/generator.go @@ -218,7 +218,7 @@ func (gen *Generator) syncHandler(info Info) error { glog.V(4).Infof("recieved info:%v", info) var handler pvGenerator var builder Builder - builder = newPvBuilder(gen.dclient) + builder = newPvBuilder() if info.Resource.GetNamespace() == "" { // cluster scope resource generate a clusterpolicy violation handler = newClusterPV(gen.dclient, gen.cpvLister, gen.kyvernoInterface)