Skip to content

Commit

Permalink
Cleanup deadcode in multicluster controller (istio#54426)
Browse files Browse the repository at this point in the history
All of this is handled in other parts of the code now so this was dead
  • Loading branch information
howardjohn authored Dec 19, 2024
1 parent 52e0d5c commit aeb416a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 23 deletions.
3 changes: 0 additions & 3 deletions pilot/pkg/bootstrap/servicecontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,8 @@ func (s *Server) initKubeRegistry(args *PilotArgs) (err error) {
args.RegistryOptions.KubeOptions.MeshServiceController = s.ServiceController()
// pass namespace to k8s service registry
kubecontroller.NewMulticluster(args.PodName,
s.kubeClient.Kube(),
args.RegistryOptions.ClusterRegistriesNamespace,
args.RegistryOptions.KubeOptions,
s.serviceEntryController,
s.configController,
s.istiodCertBundleWatcher,
args.Revision,
s.shouldStartNsController(),
Expand Down
18 changes: 2 additions & 16 deletions pilot/pkg/serviceregistry/kube/controller/multicluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"

"istio.io/api/annotation"
"istio.io/istio/pilot/pkg/config/kube/crdclient"
Expand Down Expand Up @@ -76,33 +75,24 @@ type Multicluster struct {
// options to use when creating kube controllers
opts Options

// client for reading remote-secrets to initialize multicluster registries
client kubernetes.Interface
s server.Instance
s server.Instance

serviceEntryController *serviceentry.Controller
configController model.ConfigStoreController
XDSUpdater model.XDSUpdater

clusterLocal model.ClusterLocalProvider

startNsController bool
caBundleWatcher *keycertbundle.Watcher
revision string

// secretNamespace where we get cluster-access secrets
secretNamespace string
component *multicluster.Component[*kubeController]
component *multicluster.Component[*kubeController]
}

// NewMulticluster initializes data structure to store multicluster information
func NewMulticluster(
serverID string,
kc kubernetes.Interface,
secretNamespace string,
opts Options,
serviceEntryController *serviceentry.Controller,
configController model.ConfigStoreController,
caBundleWatcher *keycertbundle.Watcher,
revision string,
startNsController bool,
Expand All @@ -114,14 +104,10 @@ func NewMulticluster(
serverID: serverID,
opts: opts,
serviceEntryController: serviceEntryController,
configController: configController,
startNsController: startNsController,
caBundleWatcher: caBundleWatcher,
revision: revision,
XDSUpdater: opts.XDSUpdater,
clusterLocal: clusterLocal,
secretNamespace: secretNamespace,
client: kc,
s: s,
}
mc.component = multicluster.BuildMultiClusterComponent(controller, func(cluster *multicluster.Cluster) *kubeController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ func Test_KubeSecretController(t *testing.T) {
stop := test.NewStop(t)
s := server.New()
mcc := initController(clientset, testSecretNameSpace, stop)
mc := NewMulticluster("pilot-abc-123", clientset.Kube(), testSecretNameSpace, Options{
mc := NewMulticluster("pilot-abc-123", Options{
ClusterID: "cluster-1",
DomainSuffix: DomainSuffix,
MeshWatcher: mesh.NewFixedWatcher(&meshconfig.MeshConfig{}),
MeshServiceController: mockserviceController,
}, nil, nil, nil, "default", false, nil, s, mcc)
}, nil, nil, "default", false, nil, s, mcc)
assert.NoError(t, mcc.Run(stop))
go mockserviceController.Run(stop)
clientset.RunAndWait(stop)
Expand Down Expand Up @@ -138,12 +138,12 @@ func Test_KubeSecretController_ExternalIstiod_MultipleClusters(t *testing.T) {
s := server.New()
certWatcher := keycertbundle.NewWatcher()
mcc := initController(clientset, testSecretNameSpace, stop)
mc := NewMulticluster("pilot-abc-123", clientset.Kube(), testSecretNameSpace, Options{
mc := NewMulticluster("pilot-abc-123", Options{
ClusterID: "cluster-1",
DomainSuffix: DomainSuffix,
MeshWatcher: mesh.NewFixedWatcher(&meshconfig.MeshConfig{}),
MeshServiceController: mockserviceController,
}, nil, nil, certWatcher, "default", false, nil, s, mcc)
}, nil, certWatcher, "default", false, nil, s, mcc)
assert.NoError(t, mcc.Run(stop))
go mockserviceController.Run(stop)
clientset.RunAndWait(stop)
Expand Down

0 comments on commit aeb416a

Please sign in to comment.