1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

chore: make dclient import aliases consistent (#3951)

* chore: make kyverno api import aliases consistent

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* chore: make apimachinery api import aliases consistent

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* chore: make dclient api import aliases consistent

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
Charles-Edouard Brétéché 2022-05-17 16:40:51 +02:00 committed by GitHub
parent 666bcb3c15
commit 5243763674
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 76 additions and 74 deletions

View file

@ -53,3 +53,5 @@ linters-settings:
alias: $1$2
- pkg: k8s.io/api/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: github.com/kyverno/kyverno/pkg/dclient
alias: dclient

View file

@ -12,7 +12,7 @@ import (
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/common"
sanitizederror "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/sanitizedError"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/store"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/openapi"
policy2 "github.com/kyverno/kyverno/pkg/policy"
"github.com/kyverno/kyverno/pkg/policyreport"
@ -170,13 +170,13 @@ func applyCommandHelper(resourcePaths []string, userInfoPath string, cluster boo
return rc, resources, skipInvalidPolicies, pvInfos, sanitizederror.NewWithError("failed to initialize openAPIController", err)
}
var dClient client.Interface
var dClient dclient.Interface
if cluster {
restConfig, err := kubernetesConfig.ToRESTConfig()
if err != nil {
return rc, resources, skipInvalidPolicies, pvInfos, err
}
dClient, err = client.NewClient(restConfig, 15*time.Minute, make(chan struct{}))
dClient, err = dclient.NewClient(restConfig, 15*time.Minute, make(chan struct{}))
if err != nil {
return rc, resources, skipInvalidPolicies, pvInfos, err
}

View file

@ -25,7 +25,7 @@ import (
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/store"
"github.com/kyverno/kyverno/pkg/autogen"
"github.com/kyverno/kyverno/pkg/background/generate"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/engine/response"
"github.com/kyverno/kyverno/pkg/openapi"
policy2 "github.com/kyverno/kyverno/pkg/policy"
@ -708,7 +708,7 @@ func getFullPath(paths []string, policyResourcePath string, isGit bool) []string
func applyPoliciesFromPath(fs billy.Filesystem, policyBytes []byte, isGit bool, policyResourcePath string, rc *resultCounts, openAPIController *openapi.Controller, tf *testFilter) (err error) {
engineResponses := make([]*response.EngineResponse, 0)
var dClient client.Interface
var dClient dclient.Interface
values := &Test{}
var variablesString string
var pvInfos []policyreport.Info

View file

@ -21,7 +21,7 @@ import (
sanitizederror "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/sanitizedError"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/store"
"github.com/kyverno/kyverno/pkg/autogen"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/engine"
engineContext "github.com/kyverno/kyverno/pkg/engine/context"
"github.com/kyverno/kyverno/pkg/engine/response"
@ -654,7 +654,7 @@ func GetPoliciesFromPaths(fs billy.Filesystem, dirPath []string, isGit bool, pol
// GetResourceAccordingToResourcePath - get resources according to the resource path
func GetResourceAccordingToResourcePath(fs billy.Filesystem, resourcePaths []string,
cluster bool, policies []kyvernov1.PolicyInterface, dClient client.Interface, namespace string, policyReport bool, isGit bool, policyResourcePath string,
cluster bool, policies []kyvernov1.PolicyInterface, dClient dclient.Interface, namespace string, policyReport bool, isGit bool, policyResourcePath string,
) (resources []*unstructured.Unstructured, err error) {
if isGit {
resources, err = GetResourcesWithTest(fs, policies, resourcePaths, isGit, policyResourcePath)

View file

@ -12,7 +12,7 @@ import (
"github.com/go-git/go-billy/v5"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
"github.com/kyverno/kyverno/pkg/autogen"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
engineutils "github.com/kyverno/kyverno/pkg/engine/utils"
yamlutils "github.com/kyverno/kyverno/pkg/utils/yaml"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@ -26,7 +26,7 @@ import (
// the resources are fetched from
// - local paths to resources, if given
// - the k8s cluster, if given
func GetResources(policies []kyvernov1.PolicyInterface, resourcePaths []string, dClient client.Interface, cluster bool, namespace string, policyReport bool) ([]*unstructured.Unstructured, error) {
func GetResources(policies []kyvernov1.PolicyInterface, resourcePaths []string, dClient dclient.Interface, cluster bool, namespace string, policyReport bool) ([]*unstructured.Unstructured, error) {
resources := make([]*unstructured.Unstructured, 0)
var err error
resourceTypesMap := make(map[string]bool)
@ -59,7 +59,7 @@ func GetResources(policies []kyvernov1.PolicyInterface, resourcePaths []string,
return resources, err
}
func whenClusterIsTrue(resourceTypes []string, dClient client.Interface, namespace string, resourcePaths []string, policyReport bool) ([]*unstructured.Unstructured, error) {
func whenClusterIsTrue(resourceTypes []string, dClient dclient.Interface, namespace string, resourcePaths []string, policyReport bool) ([]*unstructured.Unstructured, error) {
resources := make([]*unstructured.Unstructured, 0)
resourceMap, err := getResourcesOfTypeFromCluster(resourceTypes, dClient, namespace)
if err != nil {
@ -186,7 +186,7 @@ func GetResource(resourceBytes []byte) ([]*unstructured.Unstructured, error) {
return resources, nil
}
func getResourcesOfTypeFromCluster(resourceTypes []string, dClient client.Interface, namespace string) (map[string]*unstructured.Unstructured, error) {
func getResourcesOfTypeFromCluster(resourceTypes []string, dClient dclient.Interface, namespace string) (map[string]*unstructured.Unstructured, error) {
r := make(map[string]*unstructured.Unstructured)
for _, kind := range resourceTypes {

View file

@ -13,7 +13,7 @@ import (
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
"github.com/kyverno/kyverno/pkg/config"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
engineUtils "github.com/kyverno/kyverno/pkg/engine/utils"
"github.com/kyverno/kyverno/pkg/leaderelection"
"github.com/kyverno/kyverno/pkg/policyreport"
@ -82,7 +82,7 @@ func main() {
// DYNAMIC CLIENT
// - client for all registered resources
client, err := client.NewClient(clientConfig, 15*time.Minute, stopCh)
client, err := dclient.NewClient(clientConfig, 15*time.Minute, stopCh)
if err != nil {
setupLog.Error(err, "Failed to create client")
os.Exit(1)
@ -203,7 +203,7 @@ func acquireLeader(ctx context.Context, kubeClient kubernetes.Interface) error {
return err
}
func executeRequest(client client.Interface, kyvernoclient kyvernoclient.Interface, req request) error {
func executeRequest(client dclient.Interface, kyvernoclient kyvernoclient.Interface, req request) error {
switch req.kind {
case policyReportKind:
return removePolicyReport(client, req.kind)
@ -253,7 +253,7 @@ func gen(done <-chan struct{}, stopCh <-chan struct{}, requests ...request) <-ch
}
// processes the requests
func process(client client.Interface, kyvernoclient kyvernoclient.Interface, done <-chan struct{}, stopCh <-chan struct{}, requests <-chan request) <-chan error {
func process(client dclient.Interface, kyvernoclient kyvernoclient.Interface, done <-chan struct{}, stopCh <-chan struct{}, requests <-chan request) <-chan error {
logger := log.Log.WithName("process")
out := make(chan error)
go func() {
@ -307,7 +307,7 @@ func merge(done <-chan struct{}, stopCh <-chan struct{}, processes ...<-chan err
return out
}
func removeClusterPolicyReport(client client.Interface, kind string) error {
func removeClusterPolicyReport(client dclient.Interface, kind string) error {
logger := log.Log.WithName("removeClusterPolicyReport")
cpolrs, err := client.ListResource("", kind, "", policyreport.LabelSelector)
@ -322,7 +322,7 @@ func removeClusterPolicyReport(client client.Interface, kind string) error {
return nil
}
func removePolicyReport(client client.Interface, kind string) error {
func removePolicyReport(client dclient.Interface, kind string) error {
logger := log.Log.WithName("removePolicyReport")
polrs, err := client.ListResource("", kind, metav1.NamespaceAll, policyreport.LabelSelector)
@ -338,7 +338,7 @@ func removePolicyReport(client client.Interface, kind string) error {
return nil
}
func addClusterPolicyReportSelectorLabel(client client.Interface) {
func addClusterPolicyReportSelectorLabel(client dclient.Interface) {
logger := log.Log.WithName("addClusterPolicyReportSelectorLabel")
cpolrs, err := client.ListResource("", clusterPolicyReportKind, "", updateLabelSelector)
@ -354,7 +354,7 @@ func addClusterPolicyReportSelectorLabel(client client.Interface) {
}
}
func addPolicyReportSelectorLabel(client client.Interface) {
func addPolicyReportSelectorLabel(client dclient.Interface) {
logger := log.Log.WithName("addPolicyReportSelectorLabel")
polrs, err := client.ListResource("", policyReportKind, metav1.NamespaceAll, updateLabelSelector)
@ -370,7 +370,7 @@ func addPolicyReportSelectorLabel(client client.Interface) {
}
}
func removeReportChangeRequest(client client.Interface, kind string) error {
func removeReportChangeRequest(client dclient.Interface, kind string) error {
logger := log.Log.WithName("removeReportChangeRequest")
ns := config.KyvernoNamespace()
@ -387,7 +387,7 @@ func removeReportChangeRequest(client client.Interface, kind string) error {
return nil
}
func removeClusterReportChangeRequest(client client.Interface, kind string) error {
func removeClusterReportChangeRequest(client dclient.Interface, kind string) error {
crcrList, err := client.ListResource("", kind, "", nil)
if err != nil {
log.Log.Error(err, "failed to list clusterReportChangeRequest")
@ -400,7 +400,7 @@ func removeClusterReportChangeRequest(client client.Interface, kind string) erro
return nil
}
func deleteResource(client client.Interface, apiversion, kind, ns, name string) {
func deleteResource(client dclient.Interface, apiversion, kind, ns, name string) {
err := client.DeleteResource(apiversion, kind, ns, name, false)
if err != nil && !errors.IsNotFound(err) {
log.Log.Error(err, "failed to delete resource", "kind", kind, "name", name)
@ -410,7 +410,7 @@ func deleteResource(client client.Interface, apiversion, kind, ns, name string)
log.Log.Info("successfully cleaned up resource", "kind", kind, "name", name)
}
func addSelectorLabel(client client.Interface, apiversion, kind, ns, name string) {
func addSelectorLabel(client dclient.Interface, apiversion, kind, ns, name string) {
res, err := client.GetResource(apiversion, kind, ns, name)
if err != nil && !errors.IsNotFound(err) {
log.Log.Error(err, "failed to get resource", "kind", kind, "name", name)

View file

@ -4,7 +4,7 @@ import (
"fmt"
"reflect"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
authorizationv1 "k8s.io/api/authorization/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
@ -15,11 +15,11 @@ type CanIOptions struct {
namespace string
verb string
kind string
client client.Interface
client dclient.Interface
}
// NewCanI returns a new instance of operation access controller evaluator
func NewCanI(client client.Interface, kind, namespace, verb string) *CanIOptions {
func NewCanI(client dclient.Interface, kind, namespace, verb string) *CanIOptions {
return &CanIOptions{
namespace: namespace,
kind: kind,

View file

@ -1,4 +1,4 @@
package client
package dclient
import (
"context"

View file

@ -1,4 +1,4 @@
package client
package dclient
import (
"context"

View file

@ -1,4 +1,4 @@
package client
package dclient
import (
"fmt"

View file

@ -1,4 +1,4 @@
package client
package dclient
import (
"testing"

View file

@ -1,4 +1,4 @@
package client
package dclient
import (
"fmt"

View file

@ -1,4 +1,4 @@
package client
package dclient
import "sigs.k8s.io/controller-runtime/pkg/log"

View file

@ -1,4 +1,4 @@
package client
package dclient
import (
"k8s.io/apimachinery/pkg/runtime"

View file

@ -1,4 +1,4 @@
package client
package dclient
import (
"strings"

View file

@ -3,7 +3,7 @@ package engine
import (
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/engine/context"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
@ -26,7 +26,7 @@ type PolicyContext struct {
AdmissionInfo kyvernov1beta1.RequestInfo
// Dynamic client - used for api lookups
Client client.Interface
Client dclient.Interface
// Config handler
ExcludeGroupRole []string

View file

@ -7,7 +7,7 @@ import (
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1"
kyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
corev1 "k8s.io/api/core/v1"
errors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
@ -21,7 +21,7 @@ import (
// Generator generate events
type Generator struct {
client client.Interface
client dclient.Interface
// list/get cluster policy
cpLister kyvernolister.ClusterPolicyLister
// list/get policy
@ -46,7 +46,7 @@ type Interface interface {
}
// NewEventGenerator to generate a new event controller
func NewEventGenerator(client client.Interface, cpInformer kyvernoinformer.ClusterPolicyInformer, pInformer kyvernoinformer.PolicyInformer, log logr.Logger) *Generator {
func NewEventGenerator(client dclient.Interface, cpInformer kyvernoinformer.ClusterPolicyInformer, pInformer kyvernoinformer.PolicyInformer, log logr.Logger) *Generator {
gen := Generator{
client: client,
cpLister: cpInformer.Lister(),
@ -65,7 +65,7 @@ func rateLimiter() workqueue.RateLimiter {
return workqueue.DefaultItemBasedRateLimiter()
}
func initRecorder(client client.Interface, eventSource Source, log logr.Logger) record.EventRecorder {
func initRecorder(client dclient.Interface, eventSource Source, log logr.Logger) record.EventRecorder {
// Initialize Event Broadcaster
err := scheme.AddToScheme(scheme.Scheme)
if err != nil {

View file

@ -9,7 +9,7 @@ import (
"github.com/googleapis/gnostic/compiler"
openapiv2 "github.com/googleapis/gnostic/openapiv2"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/pkg/errors"
"gopkg.in/yaml.v3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -20,7 +20,7 @@ import (
)
type crdSync struct {
client client.Interface
client dclient.Interface
controller *Controller
}
@ -52,7 +52,7 @@ var crdDefinitionNew struct {
}
// NewCRDSync ...
func NewCRDSync(client client.Interface, controller *Controller) *crdSync {
func NewCRDSync(client dclient.Interface, controller *Controller) *crdSync {
if controller == nil {
panic(fmt.Errorf("nil controller sent into crd sync"))
}

View file

@ -9,7 +9,7 @@ import (
jsonpatch "github.com/evanphx/json-patch/v5"
"github.com/go-logr/logr"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/engine"
"github.com/kyverno/kyverno/pkg/engine/context"
"github.com/kyverno/kyverno/pkg/engine/response"
@ -20,7 +20,7 @@ import (
// applyPolicy applies policy on a resource
func applyPolicy(policy kyvernov1.PolicyInterface, resource unstructured.Unstructured,
logger logr.Logger, excludeGroupRole []string,
client client.Interface, namespaceLabels map[string]string,
client dclient.Interface, namespaceLabels map[string]string,
) (responses []*response.EngineResponse) {
startTime := time.Now()
defer func() {

View file

@ -21,7 +21,7 @@ import (
kyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1"
urkyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1beta1"
"github.com/kyverno/kyverno/pkg/config"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/event"
"github.com/kyverno/kyverno/pkg/metrics"
"github.com/kyverno/kyverno/pkg/policyreport"
@ -53,7 +53,7 @@ const (
// PolicyController is responsible for synchronizing Policy objects stored
// in the system with the corresponding policy violations
type PolicyController struct {
client client.Interface
client dclient.Interface
kyvernoClient kyvernoclient.Interface
pInformer kyvernoinformer.ClusterPolicyInformer
npInformer kyvernoinformer.PolicyInformer
@ -98,7 +98,7 @@ type PolicyController struct {
func NewPolicyController(
kubeClient kubernetes.Interface,
kyvernoClient kyvernoclient.Interface,
client client.Interface,
client dclient.Interface,
pInformer kyvernoinformer.ClusterPolicyInformer,
npInformer kyvernoinformer.PolicyInformer,
urInformer urkyvernoinformer.UpdateRequestInformer,
@ -504,7 +504,7 @@ func (pc *PolicyController) getPolicy(key string) (policy kyvernov1.PolicyInterf
return
}
func generateTriggers(client client.Interface, rule kyvernov1.Rule, log logr.Logger) []*unstructured.Unstructured {
func generateTriggers(client dclient.Interface, rule kyvernov1.Rule, log logr.Logger) []*unstructured.Unstructured {
list := &unstructured.UnstructuredList{}
kinds := fetchUniqueKinds(rule)

View file

@ -12,7 +12,7 @@ import (
"testing"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/engine"
"github.com/kyverno/kyverno/pkg/engine/context"
"github.com/kyverno/kyverno/pkg/engine/response"
@ -203,12 +203,12 @@ func runTestCase(t *testing.T, tc TestCase) bool {
return true
}
func createNamespace(client client.Interface, ns *unstructured.Unstructured) error {
func createNamespace(client dclient.Interface, ns *unstructured.Unstructured) error {
_, err := client.CreateResource("", "Namespace", "", ns, false)
return err
}
func validateGeneratedResources(t *testing.T, client client.Interface, policy kyvernov1.ClusterPolicy, namespace string, expected []kyvernov1.ResourceSpec) {
func validateGeneratedResources(t *testing.T, client dclient.Interface, policy kyvernov1.ClusterPolicy, namespace string, expected []kyvernov1.ResourceSpec) {
t.Helper()
t.Log("--validate if resources are generated---")
// list of expected generated resources
@ -357,7 +357,7 @@ func loadPolicyResource(t *testing.T, file string) *unstructured.Unstructured {
return resources[0]
}
func getClient(t *testing.T, files []string) client.Interface {
func getClient(t *testing.T, files []string) dclient.Interface {
t.Helper()
var objects []k8sRuntime.Object
for _, file := range files {
@ -366,14 +366,14 @@ func getClient(t *testing.T, files []string) client.Interface {
// create mock client
scheme := k8sRuntime.NewScheme()
// mock client expects the resource to be as runtime.Object
c, err := client.NewMockClient(scheme, nil, objects...)
c, err := dclient.NewMockClient(scheme, nil, objects...)
if err != nil {
t.Errorf("failed to create client. %v", err)
return nil
}
// get GVR from GVK
gvrs := getGVRForResources(objects)
c.SetDiscovery(client.NewFakeDiscoveryClient(gvrs))
c.SetDiscovery(dclient.NewFakeDiscoveryClient(gvrs))
t.Log("created mock client with pre-loaded resources")
return c
}

View file

@ -9,7 +9,7 @@ import (
"github.com/go-logr/logr"
wildcard "github.com/kyverno/go-wildcard"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
engineutils "github.com/kyverno/kyverno/pkg/engine/utils"
"github.com/pkg/errors"
admissionv1 "k8s.io/api/admission/v1"
@ -99,7 +99,7 @@ func compareString(str, name string) bool {
}
// CRDsInstalled checks if the Kyverno CRDs are installed or not
func CRDsInstalled(discovery client.IDiscovery) bool {
func CRDsInstalled(discovery dclient.IDiscovery) bool {
kyvernoCRDs := []string{"ClusterPolicy", "ClusterPolicyReport", "PolicyReport", "ClusterReportChangeRequest", "ReportChangeRequest"}
for _, crd := range kyvernoCRDs {
if !isCRDInstalled(discovery, crd) {
@ -110,7 +110,7 @@ func CRDsInstalled(discovery client.IDiscovery) bool {
return true
}
func isCRDInstalled(discoveryClient client.IDiscovery, kind string) bool {
func isCRDInstalled(discoveryClient dclient.IDiscovery, kind string) bool {
gvr, err := discoveryClient.GetGVRFromKind(kind)
if gvr.Empty() {
if err == nil {

View file

@ -15,7 +15,7 @@ import (
kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1"
kyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1"
"github.com/kyverno/kyverno/pkg/config"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/utils"
kubeutils "github.com/kyverno/kyverno/pkg/utils/kube"
"github.com/pkg/errors"
@ -39,7 +39,7 @@ var DefaultWebhookTimeout int32 = 10
// it is NOT multi-thread safe
type webhookConfigManager struct {
// clients
discoveryClient client.IDiscovery
discoveryClient dclient.IDiscovery
kubeClient kubernetes.Interface
kyvernoClient kyvernoclient.Interface
@ -77,7 +77,7 @@ type manage interface {
}
func newWebhookConfigManager(
discoveryClient client.IDiscovery,
discoveryClient dclient.IDiscovery,
kubeClient kubernetes.Interface,
kyvernoClient kyvernoclient.Interface,
pInformer kyvernoinformer.ClusterPolicyInformer,

View file

@ -13,7 +13,7 @@ import (
kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1"
"github.com/kyverno/kyverno/pkg/config"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/utils"
"github.com/pkg/errors"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
@ -66,7 +66,7 @@ type Register struct {
// NewRegister creates new Register instance
func NewRegister(
clientConfig *rest.Config,
client client.Interface,
client dclient.Interface,
kubeClient kubernetes.Interface,
kyvernoClient kyvernoclient.Interface,
mwcInformer adminformers.MutatingWebhookConfigurationInformer,

View file

@ -6,7 +6,7 @@ import (
"time"
"github.com/go-logr/logr"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/openapi"
policyvalidate "github.com/kyverno/kyverno/pkg/policy"
"github.com/kyverno/kyverno/pkg/policymutation"
@ -16,11 +16,11 @@ import (
)
type handlers struct {
client client.Interface
client dclient.Interface
openAPIController *openapi.Controller
}
func NewHandlers(client client.Interface, openAPIController *openapi.Controller) webhooks.Handlers {
func NewHandlers(client dclient.Interface, openAPIController *openapi.Controller) webhooks.Handlers {
return &handlers{
client: client,
openAPIController: openAPIController,

View file

@ -13,7 +13,7 @@ import (
urlister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1beta1"
"github.com/kyverno/kyverno/pkg/common"
"github.com/kyverno/kyverno/pkg/config"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/engine"
enginectx "github.com/kyverno/kyverno/pkg/engine/context"
"github.com/kyverno/kyverno/pkg/engine/response"
@ -40,7 +40,7 @@ import (
type handlers struct {
// clients
client client.Interface
client dclient.Interface
kyvernoClient kyvernoclient.Interface
// config
@ -65,7 +65,7 @@ type handlers struct {
}
func NewHandlers(
client client.Interface,
client dclient.Interface,
kyvernoClient kyvernoclient.Interface,
configuration config.Configuration,
promConfig *metrics.PromConfig,

View file

@ -10,7 +10,7 @@ import (
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
"github.com/kyverno/kyverno/pkg/autogen"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/engine"
enginectx "github.com/kyverno/kyverno/pkg/engine/context"
"github.com/kyverno/kyverno/pkg/engine/response"
@ -222,7 +222,7 @@ func hasAnnotations(context *engine.PolicyContext) bool {
return len(annotations) != 0
}
func getGeneratedByResource(newRes *unstructured.Unstructured, resLabels map[string]string, client client.Interface, rule kyvernov1.Rule, logger logr.Logger) (kyvernov1.Rule, error) {
func getGeneratedByResource(newRes *unstructured.Unstructured, resLabels map[string]string, client dclient.Interface, rule kyvernov1.Rule, logger logr.Logger) (kyvernov1.Rule, error) {
var apiVersion, kind, name, namespace string
sourceRequest := &admissionv1.AdmissionRequest{}
kind = resLabels["kyverno.io/generated-by-kind"]

View file

@ -8,7 +8,7 @@ import (
"github.com/kyverno/kyverno/api/kyverno/v1beta1"
"github.com/kyverno/kyverno/pkg/common"
"github.com/kyverno/kyverno/pkg/config"
client "github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/dclient"
"github.com/kyverno/kyverno/pkg/engine"
"github.com/kyverno/kyverno/pkg/event"
"github.com/kyverno/kyverno/pkg/metrics"
@ -42,7 +42,7 @@ type AuditHandler interface {
}
type auditHandler struct {
client client.Interface
client dclient.Interface
queue workqueue.RateLimitingInterface
pCache policycache.Cache
eventGen event.Interface
@ -66,7 +66,7 @@ func NewValidateAuditHandler(pCache policycache.Cache,
namespaces informers.NamespaceInformer,
log logr.Logger,
dynamicConfig config.Configuration,
client client.Interface,
client dclient.Interface,
promConfig *metrics.PromConfig,
) AuditHandler {
return &auditHandler{