Use a client interface instead of a concrete type

Aids testing

Kubernetes-commit: b9bebe8a4e12648a68ed02036ff8d4a7ec9be2eb
This commit is contained in:
Clayton Coleman
2017-07-22 14:53:26 -04:00
committed by Kubernetes Publisher
parent 27faac48eb
commit 684e17ef90
2 changed files with 2 additions and 3 deletions

View File

@@ -18,7 +18,6 @@ go_library(
deps = [ deps = [
"//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library", "//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
"//vendor/k8s.io/client-go/tools/record:go_default_library", "//vendor/k8s.io/client-go/tools/record:go_default_library",
], ],

View File

@@ -20,7 +20,7 @@ import (
"fmt" "fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cs "k8s.io/client-go/kubernetes" corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/tools/record" "k8s.io/client-go/tools/record"
) )
@@ -76,7 +76,7 @@ type Interface interface {
} }
// Manufacture will create a lock of a given type according to the input parameters // Manufacture will create a lock of a given type according to the input parameters
func New(lockType string, ns string, name string, client *cs.Clientset, rlc ResourceLockConfig) (Interface, error) { func New(lockType string, ns string, name string, client corev1.CoreV1Interface, rlc ResourceLockConfig) (Interface, error) {
switch lockType { switch lockType {
case EndpointsResourceLock: case EndpointsResourceLock:
return &EndpointsLock{ return &EndpointsLock{