Repository: submariner-io/lighthouse
Pull request #927 (2022-10-26 22:07:49)

Revert "Make lighthouse depend on coredns"
Reverts https://github.com/submariner-io/lighthouse/pull/912. Having the base module depend on `coredns` breaks users of `lighthouse` (the referenced version doesn't exist) and really defeats the purpose of having a separate `coredns` module which was to avoid users having to pull in the `coredns` dependencies.


submariner-bot: 🤖 Created branch: z_pr927/tpantelis/revert_912 
🚀 Full E2E won't run until the "ready-to-test" label is applied. I will add it automatically once the PR has 2 approvals, or you can add it manually.

Patch:
diff --git a/coredns/constants/constants.go b/coredns/constants/constants.go
index b13a3b6..310c4cd 100644
--- a/coredns/constants/constants.go
+++ b/coredns/constants/constants.go
@@ -20,11 +20,5 @@ package constants
 
 const (
 	LoadBalancerWeightAnnotationPrefix = "lighthouse-lb-weight.submariner.io"
-	LighthouseLabelSourceName          = "lighthouse.submariner.io/sourceName"
-	LabelSourceNamespace               = "lighthouse.submariner.io/sourceNamespace"
-	LighthouseLabelSourceCluster       = "lighthouse.submariner.io/sourceCluster"
-	LabelValueManagedBy                = "lighthouse-agent.submariner.io"
-	MCSLabelServiceName                = "multicluster.kubernetes.io/service-name"
-	MCSLabelSourceCluster              = "multicluster.kubernetes.io/source-cluster"
 	KubernetesServiceName              = "kubernetes.io/service-name"
 )
diff --git a/coredns/endpointslice/controller.go b/coredns/endpointslice/controller.go
index 23beb40..2fccf7d 100644
--- a/coredns/endpointslice/controller.go
+++ b/coredns/endpointslice/controller.go
@@ -22,7 +22,7 @@ import (
 	"context"
 
 	"github.com/pkg/errors"
-	"github.com/submariner-io/lighthouse/coredns/constants"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	discovery "k8s.io/api/discovery/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/labels"
diff --git a/coredns/endpointslice/map.go b/coredns/endpointslice/map.go
index 153bf6a..905590a 100644
--- a/coredns/endpointslice/map.go
+++ b/coredns/endpointslice/map.go
@@ -23,8 +23,9 @@ import (
 	"sync"
 
 	"github.com/submariner-io/admiral/pkg/log"
-	"github.com/submariner-io/lighthouse/coredns/constants"
+	coredns "github.com/submariner-io/lighthouse/coredns/constants"
 	"github.com/submariner-io/lighthouse/coredns/serviceimport"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	discovery "k8s.io/api/discovery/v1"
 	apierrors "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -128,11 +129,12 @@ func (m *Map) Put(es *discovery.EndpointSlice) {
 		retryErr := retry.OnError(retry.DefaultBackoff, func(err error) bool {
 			return !apierrors.IsNotFound(err)
 		}, func() error {
-			localSlices, err := m.kubeClient.DiscoveryV1().EndpointSlices(es.Labels[constants.LabelSourceNamespace]).List(context.TODO(), metav1.ListOptions{
-				LabelSelector: labels.Set(map[string]string{
-					constants.KubernetesServiceName: es.Labels[constants.MCSLabelServiceName],
-				}).String(),
-			})
+			localSlices, err := m.kubeClient.DiscoveryV1().EndpointSlices(es.Labels[constants.LabelSourceNamespace]).List(context.TODO(),
+				metav1.ListOptions{
+					LabelSelector: labels.Set(map[string]string{
+						coredns.KubernetesServiceName: es.Labels[constants.MCSLabelServiceName],
+					}).String(),
+				})
 			if err != nil {
 				return err
 			}
@@ -147,7 +149,8 @@ func (m *Map) Put(es *discovery.EndpointSlice) {
 			return nil
 		})
 		if retryErr != nil {
-			klog.Errorf("Error finding local endpoint slice for service (%s/%s): %+v", es.Labels[constants.LabelSourceNamespace], es.Labels[constants.MCSLabelServiceName], retryErr)
+			klog.Errorf("Error finding local endpoint slice for service (%s/%s): %+v", es.Labels[constants.LabelSourceNamespace],
+				es.Labels[constants.MCSLabelServiceName], retryErr)
 			return
 		}
 		if localSlice == nil {
diff --git a/coredns/go.mod b/coredns/go.mod
index 35c573d..08b97ca 100644
--- a/coredns/go.mod
+++ b/coredns/go.mod
@@ -11,6 +11,7 @@ require (
 	github.com/pkg/errors v0.9.1
 	github.com/prometheus/client_golang v1.13.0
 	github.com/submariner-io/admiral v0.14.0-m2
+	github.com/submariner-io/lighthouse v0.14.0-m1
 	k8s.io/api v0.25.0
 	k8s.io/apimachinery v0.25.0
 	k8s.io/client-go v0.24.4
@@ -18,6 +19,9 @@ require (
 	sigs.k8s.io/mcs-api v0.1.0
 )
 
+// Local project
+replace github.com/submariner-io/lighthouse => ../
+
 require (
 	cloud.google.com/go/compute v1.7.0 // indirect
 	github.com/DataDog/datadog-agent/pkg/obfuscate v0.0.0-20211129110424-6491aa3bf583 // indirect
diff --git a/coredns/serviceimport/map.go b/coredns/serviceimport/map.go
index 994759c..2c3a94a 100644
--- a/coredns/serviceimport/map.go
+++ b/coredns/serviceimport/map.go
@@ -23,7 +23,8 @@ import (
 	"sync"
 
 	"github.com/submariner-io/lighthouse/coredns/constants"
-	"github.com/submariner-io/lighthouse/coredns/loadbalancer"
+	lhconstants "github.com/submariner-io/lighthouse/pkg/constants"
+	"github.com/submariner-io/lighthouse/pkg/loadbalancer"
 	"k8s.io/klog/v2"
 	mcsv1a1 "sigs.k8s.io/mcs-api/pkg/apis/v1alpha1"
 )
@@ -151,7 +152,7 @@ func (m *Map) Put(serviceImport *mcsv1a1.ServiceImport) {
 		}
 
 		if serviceImport.Spec.Type == mcsv1a1.ClusterSetIP {
-			clusterName := serviceImport.GetLabels()[constants.LighthouseLabelSourceCluster]
+			clusterName := serviceImport.GetLabels()[lhconstants.LighthouseLabelSourceCluster]
 
 			record := &DNSRecord{
 				IP:          serviceImport.Spec.IPs[0],
diff --git a/go.mod b/go.mod
index c24601c..77364c2 100644
--- a/go.mod
+++ b/go.mod
@@ -9,7 +9,6 @@ require (
 	github.com/pkg/errors v0.9.1
 	github.com/prometheus/client_golang v1.13.0
 	github.com/submariner-io/admiral v0.14.0-m2
-	github.com/submariner-io/lighthouse/coredns v0.14.0-m2
 	github.com/submariner-io/shipyard v0.14.0-m2
 	github.com/uw-labs/lichen v0.1.7
 	k8s.io/api v0.25.0
@@ -21,9 +20,6 @@ require (
 	sigs.k8s.io/mcs-api v0.1.0
 )
 
-// Local submodule
-replace github.com/submariner-io/lighthouse/coredns => ./coredns
-
 require (
 	cloud.google.com/go/compute v1.7.0 // indirect
 	github.com/PuerkitoBio/purell v1.1.1 // indirect
diff --git a/go.sum b/go.sum
index b994362..87490ee 100644
--- a/go.sum
+++ b/go.sum
@@ -572,7 +572,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
 github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
+github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
 github.com/submariner-io/admiral v0.14.0-m2 h1:STSW1R8D9XmwxzdO3UeVTdaNoL1ruleW3ClYrGd8NbQ=
 github.com/submariner-io/admiral v0.14.0-m2/go.mod h1:aGaCtUQBooh0w8/nAPy/GDdWC4mthaiT9YydzoJIJcM=
 github.com/submariner-io/shipyard v0.14.0-m2 h1:C5/Pi/fHPpFWcg7gpUWTaYL+x/ezBSWD5PDGsm0yauY=
@@ -611,7 +611,7 @@ go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
 go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
 go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
 go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
-go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
+go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
 go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
 go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
 go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
diff --git a/pkg/agent/controller/agent.go b/pkg/agent/controller/agent.go
index e477f05..546ef5b 100644
--- a/pkg/agent/controller/agent.go
+++ b/pkg/agent/controller/agent.go
@@ -30,8 +30,7 @@ import (
 	"github.com/submariner-io/admiral/pkg/syncer"
 	"github.com/submariner-io/admiral/pkg/syncer/broker"
 	"github.com/submariner-io/admiral/pkg/util"
-	"github.com/submariner-io/lighthouse/coredns/constants"
-	lhconstants "github.com/submariner-io/lighthouse/pkg/constants"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	corev1 "k8s.io/api/core/v1"
 	discovery "k8s.io/api/discovery/v1"
 	apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -199,8 +198,8 @@ func (a *Controller) Start(stopCh <-chan struct{}) error {
 		return a.serviceImportLister(func(si *mcsv1a1.ServiceImport) runtime.Object {
 			return &mcsv1a1.ServiceExport{
 				ObjectMeta: metav1.ObjectMeta{
-					Name:      si.GetAnnotations()[lhconstants.OriginName],
-					Namespace: si.GetAnnotations()[lhconstants.OriginNamespace],
+					Name:      si.GetAnnotations()[constants.OriginName],
+					Namespace: si.GetAnnotations()[constants.OriginNamespace],
 				},
 			}
 		})
@@ -210,8 +209,8 @@ func (a *Controller) Start(stopCh <-chan struct{}) error {
 		return a.serviceImportLister(func(si *mcsv1a1.ServiceImport) runtime.Object {
 			return &corev1.Service{
 				ObjectMeta: metav1.ObjectMeta{
-					Name:      si.GetAnnotations()[lhconstants.OriginName],
-					Namespace: si.GetAnnotations()[lhconstants.OriginNamespace],
+					Name:      si.GetAnnotations()[constants.OriginName],
+					Namespace: si.GetAnnotations()[constants.OriginNamespace],
 				},
 			}
 		})
@@ -350,15 +349,15 @@ func (a *Controller) onLocalServiceImport(obj runtime.Object, _ int, op syncer.O
 	serviceImport := obj.(*mcsv1a1.ServiceImport)
 
 	if op == syncer.Delete {
-		a.updateExportedServiceStatus(serviceImport.GetAnnotations()[lhconstants.OriginName],
-			serviceImport.GetAnnotations()[lhconstants.OriginNamespace], lhconstants.ServiceExportSynced, corev1.ConditionFalse,
+		a.updateExportedServiceStatus(serviceImport.GetAnnotations()[constants.OriginName],
+			serviceImport.GetAnnotations()[constants.OriginNamespace], constants.ServiceExportSynced, corev1.ConditionFalse,
 			"NoServiceImport", "ServiceImport was deleted")
 
 		return obj, false
 	}
 
-	a.updateExportedServiceStatus(serviceImport.GetAnnotations()[lhconstants.OriginName],
-		serviceImport.GetAnnotations()[lhconstants.OriginNamespace], lhconstants.ServiceExportSynced, corev1.ConditionFalse,
+	a.updateExportedServiceStatus(serviceImport.GetAnnotations()[constants.OriginName],
+		serviceImport.GetAnnotations()[constants.OriginNamespace], constants.ServiceExportSynced, corev1.ConditionFalse,
 		"AwaitingSync", fmt.Sprintf("ServiceImport %sd - awaiting sync to the broker", op))
 
 	return obj, false
@@ -371,8 +370,8 @@ func (a *Controller) onSuccessfulServiceImportSync(synced runtime.Object, op syn
 
 	serviceImport := synced.(*mcsv1a1.ServiceImport)
 
-	a.updateExportedServiceStatus(serviceImport.GetAnnotations()[lhconstants.OriginName],
-		serviceImport.GetAnnotations()[lhconstants.OriginNamespace], lhconstants.ServiceExportSynced, corev1.ConditionTrue, "",
+	a.updateExportedServiceStatus(serviceImport.GetAnnotations()[constants.OriginName],
+		serviceImport.GetAnnotations()[constants.OriginNamespace], constants.ServiceExportSynced, corev1.ConditionTrue, "",
 		"ServiceImport was successfully synced to the broker")
 }
 
@@ -514,8 +513,8 @@ func (a *Controller) newServiceImport(name, namespace string) *mcsv1a1.ServiceIm
 		ObjectMeta: metav1.ObjectMeta{
 			Name: a.getObjectNameWithClusterID(name, namespace),
 			Annotations: map[string]string{
-				lhconstants.OriginName:      name,
-				lhconstants.OriginNamespace: namespace,
+				constants.OriginName:      name,
+				constants.OriginNamespace: namespace,
 			},
 			Labels: map[string]string{
 				constants.LighthouseLabelSourceName:    name,
diff --git a/pkg/agent/controller/cleanup.go b/pkg/agent/controller/cleanup.go
index c74da81..f5fc8b3 100644
--- a/pkg/agent/controller/cleanup.go
+++ b/pkg/agent/controller/cleanup.go
@@ -22,7 +22,7 @@ import (
 	"context"
 
 	"github.com/pkg/errors"
-	"github.com/submariner-io/lighthouse/coredns/constants"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	discovery "k8s.io/api/discovery/v1"
 	apierrors "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
diff --git a/pkg/agent/controller/endpoint.go b/pkg/agent/controller/endpoint.go
index 3fe4306..67243f3 100644
--- a/pkg/agent/controller/endpoint.go
+++ b/pkg/agent/controller/endpoint.go
@@ -25,7 +25,7 @@ import (
 	"github.com/submariner-io/admiral/pkg/log"
 	"github.com/submariner-io/admiral/pkg/syncer"
 	"github.com/submariner-io/admiral/pkg/syncer/broker"
-	"github.com/submariner-io/lighthouse/coredns/constants"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	corev1 "k8s.io/api/core/v1"
 	discovery "k8s.io/api/discovery/v1"
 	apierrors "k8s.io/apimachinery/pkg/api/errors"
diff --git a/pkg/agent/controller/serviceimport.go b/pkg/agent/controller/serviceimport.go
index 8194161..8402307 100644
--- a/pkg/agent/controller/serviceimport.go
+++ b/pkg/agent/controller/serviceimport.go
@@ -24,8 +24,7 @@ import (
 	"github.com/submariner-io/admiral/pkg/log"
 	"github.com/submariner-io/admiral/pkg/syncer"
 	"github.com/submariner-io/admiral/pkg/watcher"
-	"github.com/submariner-io/lighthouse/coredns/constants"
-	lhconstants "github.com/submariner-io/lighthouse/pkg/constants"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	"k8s.io/apimachinery/pkg/api/meta"
 	"k8s.io/apimachinery/pkg/runtime"
 	"k8s.io/client-go/dynamic"
@@ -108,8 +107,8 @@ func (c *ServiceImportController) serviceImportCreatedOrUpdated(serviceImport *m
 	}
 
 	annotations := serviceImport.ObjectMeta.Annotations
-	serviceNameSpace := annotations[lhconstants.OriginNamespace]
-	serviceName := annotations[lhconstants.OriginName]
+	serviceNameSpace := annotations[constants.OriginNamespace]
+	serviceName := annotations[constants.OriginName]
 
 	endpointController, err := startEndpointController(c.localClient, c.restMapper, c.scheme,
 		serviceImport, serviceNameSpace, serviceName, c.clusterID, c.globalIngressIPCache)
diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go
index 2bb8eac..c9b4e1e 100644
--- a/pkg/constants/constants.go
+++ b/pkg/constants/constants.go
@@ -23,8 +23,14 @@ import (
 )
 
 const (
-	OriginName      = "origin-name"
-	OriginNamespace = "origin-namespace"
+	OriginName                   = "origin-name"
+	OriginNamespace              = "origin-namespace"
+	LighthouseLabelSourceName    = "lighthouse.submariner.io/sourceName"
+	LabelSourceNamespace         = "lighthouse.submariner.io/sourceNamespace"
+	LighthouseLabelSourceCluster = "lighthouse.submariner.io/sourceCluster"
+	LabelValueManagedBy          = "lighthouse-agent.submariner.io"
+	MCSLabelServiceName          = "multicluster.kubernetes.io/service-name"
+	MCSLabelSourceCluster        = "multicluster.kubernetes.io/source-cluster"
 )
 
 const ServiceExportSynced v1alpha1.ServiceExportConditionType = "Synced"


Test patch:
diff --git a/coredns/endpointslice/controller_test.go b/coredns/endpointslice/controller_test.go
index c7b79dc..0deacd6 100644
--- a/coredns/endpointslice/controller_test.go
+++ b/coredns/endpointslice/controller_test.go
@@ -24,8 +24,8 @@ import (
 
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
-	"github.com/submariner-io/lighthouse/coredns/constants"
 	"github.com/submariner-io/lighthouse/coredns/endpointslice"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	discovery "k8s.io/api/discovery/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/client-go/kubernetes"
diff --git a/coredns/endpointslice/map_test.go b/coredns/endpointslice/map_test.go
index 94991f4..1ae8c45 100644
--- a/coredns/endpointslice/map_test.go
+++ b/coredns/endpointslice/map_test.go
@@ -23,9 +23,9 @@ import (
 
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
-	"github.com/submariner-io/lighthouse/coredns/constants"
 	"github.com/submariner-io/lighthouse/coredns/endpointslice"
 	"github.com/submariner-io/lighthouse/coredns/serviceimport"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	discovery "k8s.io/api/discovery/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	fakeKubeClient "k8s.io/client-go/kubernetes/fake"
diff --git a/coredns/plugin/handler_test.go b/coredns/plugin/handler_test.go
index d61747d..6cd10bf 100644
--- a/coredns/plugin/handler_test.go
+++ b/coredns/plugin/handler_test.go
@@ -30,10 +30,10 @@ import (
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
 	"github.com/pkg/errors"
-	"github.com/submariner-io/lighthouse/coredns/constants"
 	"github.com/submariner-io/lighthouse/coredns/endpointslice"
 	lighthouse "github.com/submariner-io/lighthouse/coredns/plugin"
 	"github.com/submariner-io/lighthouse/coredns/serviceimport"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	v1 "k8s.io/api/core/v1"
 	discovery "k8s.io/api/discovery/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
diff --git a/coredns/serviceimport/controller_test.go b/coredns/serviceimport/controller_test.go
index bcc5654..cc13f85 100644
--- a/coredns/serviceimport/controller_test.go
+++ b/coredns/serviceimport/controller_test.go
@@ -23,8 +23,8 @@ import (
 
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
-	"github.com/submariner-io/lighthouse/coredns/constants"
 	"github.com/submariner-io/lighthouse/coredns/serviceimport"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/client-go/rest"
 	mcsv1a1 "sigs.k8s.io/mcs-api/pkg/apis/v1alpha1"
diff --git a/pkg/agent/controller/cleanup_test.go b/pkg/agent/controller/cleanup_test.go
index 80dd73d..edf18fc 100644
--- a/pkg/agent/controller/cleanup_test.go
+++ b/pkg/agent/controller/cleanup_test.go
@@ -24,7 +24,7 @@ import (
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
 	"github.com/submariner-io/admiral/pkg/syncer/test"
-	"github.com/submariner-io/lighthouse/coredns/constants"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	discovery "k8s.io/api/discovery/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/client-go/dynamic"
diff --git a/pkg/agent/controller/controller_suite_test.go b/pkg/agent/controller/controller_suite_test.go
index 1ac6e8f..42c4a10 100644
--- a/pkg/agent/controller/controller_suite_test.go
+++ b/pkg/agent/controller/controller_suite_test.go
@@ -37,9 +37,8 @@ import (
 	"github.com/submariner-io/admiral/pkg/log/kzerolog"
 	"github.com/submariner-io/admiral/pkg/syncer/broker"
 	"github.com/submariner-io/admiral/pkg/syncer/test"
-	"github.com/submariner-io/lighthouse/coredns/constants"
 	"github.com/submariner-io/lighthouse/pkg/agent/controller"
-	lhconstants "github.com/submariner-io/lighthouse/pkg/constants"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	corev1 "k8s.io/api/core/v1"
 	discovery "k8s.io/api/discovery/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -287,7 +286,7 @@ func (c *cluster) init(syncerConfig *broker.SyncerConfig) {
 
 	c.chanByCondType = map[mcsv1a1.ServiceExportConditionType]chan mcsv1a1.ServiceExportCondition{}
 	c.chanByCondType[mcsv1a1.ServiceExportValid] = make(chan mcsv1a1.ServiceExportCondition, 100)
-	c.chanByCondType[lhconstants.ServiceExportSynced] = make(chan mcsv1a1.ServiceExportCondition, 100)
+	c.chanByCondType[constants.ServiceExportSynced] = make(chan mcsv1a1.ServiceExportCondition, 100)
 }
 
 //nolint:gocritic // (hugeParam) This function modifies syncerConf so we don't want to pass by pointer.
@@ -778,7 +777,7 @@ func newServiceExportValidCondition(status corev1.ConditionStatus, reason string
 
 func newServiceExportSyncedCondition(status corev1.ConditionStatus, reason string) *mcsv1a1.ServiceExportCondition {
 	return &mcsv1a1.ServiceExportCondition{
-		Type:   lhconstants.ServiceExportSynced,
+		Type:   constants.ServiceExportSynced,
 		Status: status,
 		Reason: &reason,
 	}
diff --git a/coredns/loadbalancer/balancer.go b/pkg/loadbalancer/balancer.go
similarity index 100%
rename from coredns/loadbalancer/balancer.go
rename to pkg/loadbalancer/balancer.go
diff --git a/coredns/loadbalancer/smooth_weighted_round_robin.go b/pkg/loadbalancer/smooth_weighted_round_robin.go
similarity index 100%
rename from coredns/loadbalancer/smooth_weighted_round_robin.go
rename to pkg/loadbalancer/smooth_weighted_round_robin.go
diff --git a/coredns/loadbalancer/smooth_weighted_round_robin_test.go b/pkg/loadbalancer/smooth_weighted_round_robin_test.go
similarity index 99%
rename from coredns/loadbalancer/smooth_weighted_round_robin_test.go
rename to pkg/loadbalancer/smooth_weighted_round_robin_test.go
index fdbc78b..256d286 100644
--- a/coredns/loadbalancer/smooth_weighted_round_robin_test.go
+++ b/pkg/loadbalancer/smooth_weighted_round_robin_test.go
@@ -26,7 +26,7 @@ import (
 
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
-	"github.com/submariner-io/lighthouse/coredns/loadbalancer"
+	"github.com/submariner-io/lighthouse/pkg/loadbalancer"
 )
 
 type server struct {
diff --git a/coredns/loadbalancer/suite_test.go b/pkg/loadbalancer/suite_test.go
similarity index 100%
rename from coredns/loadbalancer/suite_test.go
rename to pkg/loadbalancer/suite_test.go
diff --git a/test/e2e/discovery/statefulsets.go b/test/e2e/discovery/statefulsets.go
index 2f0cb32..a885741 100644
--- a/test/e2e/discovery/statefulsets.go
+++ b/test/e2e/discovery/statefulsets.go
@@ -23,7 +23,7 @@ import (
 
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
-	"github.com/submariner-io/lighthouse/coredns/constants"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	lhframework "github.com/submariner-io/lighthouse/test/e2e/framework"
 	"github.com/submariner-io/shipyard/test/e2e/framework"
 	corev1 "k8s.io/api/core/v1"
diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go
index e5df20a..e8c7573 100644
--- a/test/e2e/framework/framework.go
+++ b/test/e2e/framework/framework.go
@@ -26,8 +26,7 @@ import (
 
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
-	"github.com/submariner-io/lighthouse/coredns/constants"
-	lhconstants "github.com/submariner-io/lighthouse/pkg/constants"
+	"github.com/submariner-io/lighthouse/pkg/constants"
 	"github.com/submariner-io/shipyard/test/e2e/framework"
 	appsv1 "k8s.io/api/apps/v1"
 	v1 "k8s.io/api/core/v1"
@@ -153,17 +152,17 @@ func (f *Framework) AwaitServiceExportedStatusCondition(cluster framework.Cluste
 		se := result.(*mcsv1a1.ServiceExport)
 
 		for i := range se.Status.Conditions {
-			if se.Status.Conditions[i].Type == lhconstants.ServiceExportSynced {
+			if se.Status.Conditions[i].Type == constants.ServiceExportSynced {
 				if se.Status.Conditions[i].Status != v1.ConditionTrue {
 					out, _ := json.MarshalIndent(se.Status.Conditions[i], "", "  ")
-					return false, fmt.Sprintf("ServiceExport %s condition status is %s", lhconstants.ServiceExportSynced, out), nil
+					return false, fmt.Sprintf("ServiceExport %s condition status is %s", constants.ServiceExportSynced, out), nil
 				}
 
 				return true, "", nil
 			}
 		}
 
-		return false, fmt.Sprintf("ServiceExport %s condition status not found", lhconstants.ServiceExportSynced), nil
+		return false, fmt.Sprintf("ServiceExport %s condition status not found", constants.ServiceExportSynced), nil
 	})
 }