diff --git a/pkg/reconciler/v1alpha1/broker/broker.go b/pkg/reconciler/v1alpha1/broker/broker.go index afce06aebab..dda117d34de 100644 --- a/pkg/reconciler/v1alpha1/broker/broker.go +++ b/pkg/reconciler/v1alpha1/broker/broker.go @@ -36,7 +36,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/client" runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" @@ -58,9 +57,8 @@ const ( ) type reconciler struct { - client client.Client - restConfig *rest.Config - recorder record.EventRecorder + client client.Client + recorder record.EventRecorder logger *zap.Logger diff --git a/pkg/reconciler/v1alpha1/broker/broker_test.go b/pkg/reconciler/v1alpha1/broker/broker_test.go index 72de1f15252..42d4fa7958f 100644 --- a/pkg/reconciler/v1alpha1/broker/broker_test.go +++ b/pkg/reconciler/v1alpha1/broker/broker_test.go @@ -36,7 +36,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/reconcile" @@ -70,11 +69,11 @@ var ( func init() { // Add types to scheme - v1alpha1.AddToScheme(scheme.Scheme) + _ = v1alpha1.AddToScheme(scheme.Scheme) } func TestProvideController(t *testing.T) { - //TODO(grantr) This needs a mock of manager.Manager. Creating a manager + // TODO(grantr) This needs a mock of manager.Manager. Creating a manager // with a fake Config fails because the Manager tries to contact the // apiserver. @@ -189,7 +188,7 @@ func TestReconcile(t *testing.T) { // differ from expected. // TODO uncomment the following line once our test framework supports searching for // GenerateName. - //makeDifferentChannel(), + // makeDifferentChannel(), }, WantEvent: []corev1.Event{ { @@ -535,7 +534,7 @@ func TestReconcile(t *testing.T) { WantPresent: []runtime.Object{ makeReadyBroker(), // TODO Uncomment makeChannel() when our test framework handles generateName. - //makeChannel(), + // makeChannel(), makeFilterDeployment(), makeFilterService(), makeIngressDeployment(), @@ -553,10 +552,9 @@ func TestReconcile(t *testing.T) { recorder := tc.GetEventRecorder() r := &reconciler{ - client: c, - restConfig: &rest.Config{}, - recorder: recorder, - logger: zap.NewNop(), + client: c, + recorder: recorder, + logger: zap.NewNop(), filterImage: filterImage, filterServiceAccountName: filterSA, diff --git a/pkg/reconciler/v1alpha1/namespace/namespace.go b/pkg/reconciler/v1alpha1/namespace/namespace.go index e5272122b13..cf427a4895f 100644 --- a/pkg/reconciler/v1alpha1/namespace/namespace.go +++ b/pkg/reconciler/v1alpha1/namespace/namespace.go @@ -31,7 +31,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" @@ -62,9 +61,8 @@ const ( ) type reconciler struct { - client client.Client - restConfig *rest.Config - recorder record.EventRecorder + client client.Client + recorder record.EventRecorder logger *zap.Logger } diff --git a/pkg/reconciler/v1alpha1/namespace/namespace_test.go b/pkg/reconciler/v1alpha1/namespace/namespace_test.go index 7c1b9e2769c..87e522fe010 100644 --- a/pkg/reconciler/v1alpha1/namespace/namespace_test.go +++ b/pkg/reconciler/v1alpha1/namespace/namespace_test.go @@ -31,7 +31,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/handler" @@ -241,10 +240,9 @@ func TestReconcile(t *testing.T) { recorder := tc.GetEventRecorder() r := &reconciler{ - client: c, - restConfig: &rest.Config{}, - recorder: recorder, - logger: zap.NewNop(), + client: c, + recorder: recorder, + logger: zap.NewNop(), } tc.ReconcileKey = fmt.Sprintf("%s/%s", "", testNS) tc.IgnoreTimes = true diff --git a/pkg/reconciler/v1alpha1/trigger/trigger.go b/pkg/reconciler/v1alpha1/trigger/trigger.go index 610224dc570..60d96e39862 100644 --- a/pkg/reconciler/v1alpha1/trigger/trigger.go +++ b/pkg/reconciler/v1alpha1/trigger/trigger.go @@ -64,7 +64,6 @@ const ( type reconciler struct { client client.Client - restConfig *rest.Config dynamicClient dynamic.Interface recorder record.EventRecorder @@ -159,7 +158,6 @@ func (r *reconciler) InjectClient(c client.Client) error { } func (r *reconciler) InjectConfig(c *rest.Config) error { - r.restConfig = c var err error r.dynamicClient, err = dynamic.NewForConfig(c) return err diff --git a/pkg/reconciler/v1alpha1/trigger/trigger_test.go b/pkg/reconciler/v1alpha1/trigger/trigger_test.go index b65d27e9451..ea05130025a 100644 --- a/pkg/reconciler/v1alpha1/trigger/trigger_test.go +++ b/pkg/reconciler/v1alpha1/trigger/trigger_test.go @@ -22,7 +22,6 @@ import ( "fmt" "testing" - "github.com/google/go-cmp/cmp" "github.com/knative/eventing/pkg/apis/eventing/v1alpha1" "github.com/knative/eventing/pkg/reconciler/names" controllertesting "github.com/knative/eventing/pkg/reconciler/testing" @@ -120,11 +119,6 @@ func TestInjectConfig(t *testing.T) { t.Fatalf("Unexpected error injecting the config: %v", err) } - gotCfg := r.restConfig - if diff := cmp.Diff(wantCfg, gotCfg); diff != "" { - t.Errorf("Unexpected config (-want, +got): %v", diff) - } - wantDynClient, err := dynamic.NewForConfig(wantCfg) if err != nil { t.Fatalf("Unexpected error generating dynamic client: %v", err) @@ -463,7 +457,6 @@ func TestReconcile(t *testing.T) { r := &reconciler{ client: c, dynamicClient: dc, - restConfig: &rest.Config{}, recorder: recorder, logger: zap.NewNop(), }