Skip to content

Commit

Permalink
Remove unneeded member variables (#6331)
Browse files Browse the repository at this point in the history
Signed-off-by: Quan Tian <[email protected]>
  • Loading branch information
tnqn authored May 16, 2024
1 parent 14d808b commit a9c4069
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 15 deletions.
1 change: 0 additions & 1 deletion cmd/antrea-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,6 @@ func run(o *Options) error {
externalIPController, err = serviceexternalip.NewServiceExternalIPController(
nodeConfig.Name,
nodeConfig.NodeTransportInterfaceName,
k8sClient,
memberlistCluster,
serviceInformer,
endpointsInformer,
Expand Down
5 changes: 0 additions & 5 deletions pkg/agent/controller/serviceexternalip/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
coreinformers "k8s.io/client-go/informers/core/v1"
"k8s.io/client-go/kubernetes"
corelisters "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
Expand Down Expand Up @@ -64,8 +63,6 @@ type ServiceExternalIPController struct {
serviceLister corelisters.ServiceLister
serviceListerSynced cache.InformerSynced

client kubernetes.Interface

endpointsInformer cache.SharedIndexInformer
endpointsLister corelisters.EndpointsLister
endpointsListerSynced cache.InformerSynced
Expand All @@ -87,14 +84,12 @@ var _ querier.ServiceExternalIPStatusQuerier = (*ServiceExternalIPController)(ni
func NewServiceExternalIPController(
nodeName string,
nodeTransportInterface string,
client kubernetes.Interface,
cluster memberlist.Interface,
serviceInformer coreinformers.ServiceInformer,
endpointsInformer coreinformers.EndpointsInformer,
) (*ServiceExternalIPController, error) {
c := &ServiceExternalIPController{
nodeName: nodeName,
client: client,
cluster: cluster,
queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "AgentServiceExternalIP"),
serviceInformer: serviceInformer.Informer(),
Expand Down
3 changes: 0 additions & 3 deletions pkg/agent/controller/serviceexternalip/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func (f *fakeMemberlistCluster) ShouldSelectIP(ip string, pool string, filters .
type fakeController struct {
*ServiceExternalIPController
mockController *gomock.Controller
clientset *fake.Clientset
informerFactory informers.SharedInformerFactory
mockIPAssigner *ipassignertest.MockIPAssigner
fakeMemberlistCluster *fakeMemberlistCluster
Expand Down Expand Up @@ -136,7 +135,6 @@ func newFakeController(t *testing.T, objs ...runtime.Object) *fakeController {
endpointsListerSynced: endpointInformer.Informer().HasSynced,
endpointsLister: endpointInformer.Lister(),
queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "serviceExternalIP"),
client: clientset,
externalIPStates: make(map[apimachinerytypes.NamespacedName]externalIPState),
cluster: memberlistCluster,
ipAssigner: mockIPAssigner,
Expand All @@ -145,7 +143,6 @@ func newFakeController(t *testing.T, objs ...runtime.Object) *fakeController {
return &fakeController{
ServiceExternalIPController: eipController,
mockController: controller,
clientset: clientset,
informerFactory: informerFactory,
mockIPAssigner: mockIPAssigner,
fakeMemberlistCluster: memberlistCluster,
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/secondarynetwork/init_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func Initialize(
// k8s.v1.cni.cncf.io/networks Annotation defined.
if podWatchController, err := podwatch.NewPodController(
k8sClient, netAttachDefClient, podInformer,
nodeName, podUpdateSubscriber, ovsBridgeClient); err != nil {
podUpdateSubscriber, ovsBridgeClient); err != nil {
return err
} else {
go podWatchController.Run(stopCh)
Expand Down
3 changes: 0 additions & 3 deletions pkg/agent/secondarynetwork/podwatch/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ type podController struct {
netAttachDefClient netdefclient.K8sCniCncfIoV1Interface
queue workqueue.RateLimitingInterface
podInformer cache.SharedIndexInformer
nodeName string
podUpdateSubscriber channel.Subscriber
ovsBridgeClient ovsconfig.OVSBridgeClient
interfaceStore interfacestore.InterfaceStore
Expand All @@ -102,7 +101,6 @@ func NewPodController(
kubeClient clientset.Interface,
netAttachDefClient netdefclient.K8sCniCncfIoV1Interface,
podInformer cache.SharedIndexInformer,
nodeName string,
podUpdateSubscriber channel.Subscriber,
ovsBridgeClient ovsconfig.OVSBridgeClient,
) (*podController, error) {
Expand All @@ -117,7 +115,6 @@ func NewPodController(
queue: workqueue.NewNamedRateLimitingQueue(
workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "podcontroller"),
podInformer: podInformer,
nodeName: nodeName,
podUpdateSubscriber: podUpdateSubscriber,
ovsBridgeClient: ovsBridgeClient,
interfaceStore: ifaceStore,
Expand Down
2 changes: 0 additions & 2 deletions pkg/agent/secondarynetwork/podwatch/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ func TestPodControllerRun(t *testing.T) {
client,
netdefclient,
informerFactory.Core().V1().Pods().Informer(),
testNode,
nil, nil)
podController.interfaceConfigurator = interfaceConfigurator
podController.ipamAllocator = mockIPAM
Expand Down Expand Up @@ -916,7 +915,6 @@ func testPodController(ctrl *gomock.Controller) (
workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay),
"podcontroller"),
podInformer: informerFactory.Core().V1().Pods().Informer(),
nodeName: testNode,
interfaceConfigurator: interfaceConfigurator,
ipamAllocator: mockIPAM,
interfaceStore: interfacestore.NewInterfaceStore(),
Expand Down

0 comments on commit a9c4069

Please sign in to comment.