Skip to content

Commit

Permalink
Remove Lighthouse-specific ServiceImport/Export
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt authored and aswinsuryan committed Jan 20, 2021
1 parent 8f8fd42 commit 31c63da
Show file tree
Hide file tree
Showing 39 changed files with 13 additions and 2,739 deletions.
10 changes: 0 additions & 10 deletions pkg/agent/controller/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,6 @@ func New(spec *AgentSpecification, syncerConf broker.SyncerConfig, kubeClientSet
return nil, err
}

agentController.lhServiceExportController, err = newLHServiceExportController(syncerConf.LocalClient, syncerConf.RestMapper,
syncerConf.Scheme)
if err != nil {
return nil, err
}

return agentController, nil
}

Expand Down Expand Up @@ -172,10 +166,6 @@ func (a *Controller) Start(stopCh <-chan struct{}) error {
return err
}

if err := a.lhServiceExportController.start(stopCh); err != nil {
return err
}

klog.Info("Agent controller started")

return nil
Expand Down
6 changes: 2 additions & 4 deletions pkg/agent/controller/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/submariner-io/admiral/pkg/syncer/broker"
"github.com/submariner-io/admiral/pkg/syncer/test"
"github.com/submariner-io/lighthouse/pkg/agent/controller"
lighthousev2a1 "github.com/submariner-io/lighthouse/pkg/apis/lighthouse.submariner.io/v2alpha1"
lhconstants "github.com/submariner-io/lighthouse/pkg/constants"
corev1 "k8s.io/api/core/v1"
discovery "k8s.io/api/discovery/v1beta1"
Expand Down Expand Up @@ -371,7 +370,6 @@ func newTestDiver() *testDriver {
Expect(corev1.AddToScheme(syncerScheme)).To(Succeed())
Expect(discovery.AddToScheme(syncerScheme)).To(Succeed())
Expect(mcsv1a1.AddToScheme(syncerScheme)).To(Succeed())
Expect(lighthousev2a1.AddToScheme(syncerScheme)).To(Succeed())

t := &testDriver{
cluster1: cluster{
Expand Down Expand Up @@ -401,7 +399,7 @@ func newTestDiver() *testDriver {
syncerConfig: &broker.SyncerConfig{
BrokerNamespace: test.RemoteNamespace,
RestMapper: test.GetRESTMapperFor(&mcsv1a1.ServiceExport{}, &mcsv1a1.ServiceImport{},
&corev1.Service{}, &corev1.Endpoints{}, &discovery.EndpointSlice{}, &lighthousev2a1.ServiceExport{}),
&corev1.Service{}, &corev1.Endpoints{}, &discovery.EndpointSlice{}),
BrokerClient: fake.NewDynamicClient(syncerScheme),
Scheme: syncerScheme,
},
Expand Down Expand Up @@ -592,7 +590,7 @@ func awaitEndpointSlice(endpointSliceClient, serviceImportClient dynamic.Resourc
controllerFlag := false

Expect(endpointSlice.OwnerReferences[0]).To(Equal(metav1.OwnerReference{
APIVersion: "lighthouse.submariner.io.v2alpha1",
APIVersion: "multicluster.x-k8s.io.v1alpha1",
Kind: "ServiceImport",
Name: siName,
UID: si.GetUID(),
Expand Down
6 changes: 0 additions & 6 deletions pkg/agent/controller/controller_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
lighthousev2a1 "github.com/submariner-io/lighthouse/pkg/apis/lighthouse.submariner.io/v2alpha1"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/klog"
mcsv1a1 "sigs.k8s.io/mcs-api/pkg/apis/v1alpha1"
Expand All @@ -33,11 +32,6 @@ func init() {
if err != nil {
panic(err)
}

err = lighthousev2a1.AddToScheme(scheme.Scheme)
if err != nil {
panic(err)
}
}

func TestController(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/controller/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (e *EndpointController) endpointSliceFromEndpoints(endpoints *corev1.Endpoi
lhconstants.LabelSourceName: e.serviceName,
}
endpointSlice.OwnerReferences = []metav1.OwnerReference{{
APIVersion: "lighthouse.submariner.io.v2alpha1",
APIVersion: "multicluster.x-k8s.io.v1alpha1",
Kind: "ServiceImport",
Name: e.serviceImportName,
UID: e.serviceImportUID,
Expand Down
93 changes: 0 additions & 93 deletions pkg/agent/controller/lhserviceexport.go

This file was deleted.

62 changes: 0 additions & 62 deletions pkg/agent/controller/lhserviceexport_test.go

This file was deleted.

26 changes: 10 additions & 16 deletions pkg/agent/controller/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ import (
)

type Controller struct {
clusterID string
globalnetEnabled bool
namespace string
kubeClientSet kubernetes.Interface
serviceExportClient dynamic.NamespaceableResourceInterface
serviceExportSyncer syncer.Interface
serviceImportSyncer *broker.Syncer
endpointSliceSyncer *broker.Syncer
serviceSyncer syncer.Interface
serviceImportController *ServiceImportController
lhServiceExportController *LHServiceExportController
clusterID string
globalnetEnabled bool
namespace string
kubeClientSet kubernetes.Interface
serviceExportClient dynamic.NamespaceableResourceInterface
serviceExportSyncer syncer.Interface
serviceImportSyncer *broker.Syncer
endpointSliceSyncer *broker.Syncer
serviceSyncer syncer.Interface
serviceImportController *ServiceImportController
}

type AgentSpecification struct {
Expand Down Expand Up @@ -72,8 +71,3 @@ type EndpointController struct {
serviceImportSourceNameSpace string
stopCh chan struct{}
}

type LHServiceExportController struct {
lhServiceExportSyncer syncer.Interface
localClient dynamic.Interface
}
6 changes: 0 additions & 6 deletions pkg/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"

lighthousev2a1 "github.com/submariner-io/lighthouse/pkg/apis/lighthouse.submariner.io/v2alpha1"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/klog"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
Expand Down Expand Up @@ -57,11 +56,6 @@ func main() {
klog.Exitf("Error adding Multicluster v1alpha1 to the scheme: %v", err)
}

err = lighthousev2a1.AddToScheme(scheme.Scheme)
if err != nil {
klog.Exitf("Error adding lighthouse V2alpha1 to the scheme: %v", err)
}

cfg, err := clientcmd.BuildConfigFromFlags(masterURL, kubeConfig)
if err != nil {
klog.Fatalf("Error building kubeconfig: %s", err.Error())
Expand Down
19 changes: 0 additions & 19 deletions pkg/apis/lighthouse.submariner.io/v2alpha1/doc.go

This file was deleted.

59 changes: 0 additions & 59 deletions pkg/apis/lighthouse.submariner.io/v2alpha1/register.go

This file was deleted.

Loading

0 comments on commit 31c63da

Please sign in to comment.