Skip to content

Commit

Permalink
Merge pull request #2687 from panslava/master
Browse files Browse the repository at this point in the history
Remove unused KubeConfig parameter
  • Loading branch information
k8s-ci-robot authored Sep 24, 2024
2 parents 83eabdf + 701e3b7 commit 1e99441
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/glbc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func main() {
EnableWeightedL4NetLB: flags.F.EnableWeightedL4NetLB,
DisableL4LBFirewall: flags.F.DisableL4LBFirewall,
}
ctx := ingctx.NewControllerContext(kubeConfig, kubeClient, backendConfigClient, frontendConfigClient, firewallCRClient, svcNegClient, ingParamsClient, svcAttachmentClient, networkClient, nodeTopologyClient, eventRecorderKubeClient, cloud, namer, kubeSystemUID, ctxConfig, rootLogger)
ctx := ingctx.NewControllerContext(kubeClient, backendConfigClient, frontendConfigClient, firewallCRClient, svcNegClient, ingParamsClient, svcAttachmentClient, networkClient, nodeTopologyClient, eventRecorderKubeClient, cloud, namer, kubeSystemUID, ctxConfig, rootLogger)
go app.RunHTTPServer(ctx.HealthCheck, rootLogger)

var once sync.Once
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/operator/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestReferencesSvcNeg(t *testing.T) {
HealthCheckPath: "/",
EnableIngressRegionalExternal: true,
}
ctx := context.NewControllerContext(nil, kubeClient, nil, nil, nil, nil, nil, nil, nil, nil, kubeClient /*kube client to be used for events*/, gceClient, namer, "" /*kubeSystemUID*/, ctxConfig, klog.TODO())
ctx := context.NewControllerContext(kubeClient, nil, nil, nil, nil, nil, nil, nil, nil, kubeClient /*kube client to be used for events*/, gceClient, namer, "" /*kubeSystemUID*/, ctxConfig, klog.TODO())

if err := addTestService(ctx); err != nil {
t.Fatalf("Failed to add test service: %v", err)
Expand Down
4 changes: 0 additions & 4 deletions pkg/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/cloud-provider-gcp/providers/gce"
Expand Down Expand Up @@ -75,7 +74,6 @@ const (

// ControllerContext holds the state needed for the execution of the controller.
type ControllerContext struct {
KubeConfig *rest.Config
KubeClient kubernetes.Interface
SvcNegClient svcnegclient.Interface
SAClient serviceattachmentclient.Interface
Expand Down Expand Up @@ -155,7 +153,6 @@ type ControllerContextConfig struct {

// NewControllerContext returns a new shared set of informers.
func NewControllerContext(
kubeConfig *rest.Config,
kubeClient kubernetes.Interface,
backendConfigClient backendconfigclient.Interface,
frontendConfigClient frontendconfigclient.Interface,
Expand Down Expand Up @@ -185,7 +182,6 @@ func NewControllerContext(
}

context := &ControllerContext{
KubeConfig: kubeConfig,
KubeClient: kubeClient,
FirewallClient: firewallClient,
SvcNegClient: svcnegClient,
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func newLoadBalancerController() *LoadBalancerController {
HealthCheckPath: "/",
EnableIngressRegionalExternal: true,
}
ctx := context.NewControllerContext(nil, kubeClient, backendConfigClient, nil, nil, svcNegClient, nil, nil, nil, nil, kubeClient /*kube client to be used for events*/, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig, klog.TODO())
ctx := context.NewControllerContext(kubeClient, backendConfigClient, nil, nil, svcNegClient, nil, nil, nil, nil, kubeClient /*kube client to be used for events*/, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig, klog.TODO())
lbc := NewLoadBalancerController(ctx, stopCh, klog.TODO())
// TODO(rramkumar): Fix this so we don't have to override with our fake
lbc.instancePool = instancegroups.NewManager(&instancegroups.ManagerConfig{
Expand Down
2 changes: 1 addition & 1 deletion pkg/firewalls/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func newFirewallController() *FirewallController {
ResyncPeriod: 1 * time.Minute,
DefaultBackendSvcPort: test.DefaultBeSvcPort,
}
ctx := context.NewControllerContext(nil, kubeClient, backendConfigClient, nil, firewallClient, nil, nil, nil, nil, nil, kubeClient /*kube client to be used for events*/, fakeGCE, defaultNamer, "" /*kubeSystemUID*/, ctxConfig, klog.TODO())
ctx := context.NewControllerContext(kubeClient, backendConfigClient, nil, firewallClient, nil, nil, nil, nil, nil, kubeClient /*kube client to be used for events*/, fakeGCE, defaultNamer, "" /*kubeSystemUID*/, ctxConfig, klog.TODO())
fwc := NewFirewallController(ctx, []string{"30000-32767"}, false, false, true, make(chan struct{}), klog.TODO())
fwc.hasSynced = func() bool { return true }

Expand Down
2 changes: 1 addition & 1 deletion pkg/l4lb/l4controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ func newServiceController(t *testing.T, fakeGCE *gce.Cloud) *L4Controller {
ResyncPeriod: 1 * time.Minute,
NumL4Workers: 5,
}
ctx := context.NewControllerContext(nil, kubeClient, nil, nil, nil, svcNegClient, nil, nil, nil, nil, kubeClient /*kube client to be used for events*/, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig, klog.TODO())
ctx := context.NewControllerContext(kubeClient, nil, nil, nil, svcNegClient, nil, nil, nil, nil, kubeClient /*kube client to be used for events*/, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig, klog.TODO())
// Add some nodes so that NEG linker kicks in during ILB creation.
nodes, err := test.CreateAndInsertNodes(ctx.Cloud, []string{"instance-1"}, vals.ZoneName)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/l4lb/l4netlbcontroller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func buildContext(vals gce.TestClusterValues) *ingctx.ControllerContext {
NumL4NetLBWorkers: 5,
MaxIGSize: 1000,
}
return ingctx.NewControllerContext(nil, kubeClient, nil, nil, nil, svcNegClient, nil, nil, networkClient, nil, kubeClient /*kube client to be used for events*/, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig, klog.TODO())
return ingctx.NewControllerContext(kubeClient, nil, nil, nil, svcNegClient, nil, nil, networkClient, nil, kubeClient /*kube client to be used for events*/, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig, klog.TODO())
}

func newL4NetLBServiceController() *L4NetLBController {
Expand Down
2 changes: 1 addition & 1 deletion pkg/psc/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ func newTestController(clusterType string) *Controller {

flags.F.GKEClusterName = ClusterName
flags.F.GKEClusterType = clusterType
ctx := context.NewControllerContext(nil, kubeClient, nil, nil, nil, nil, nil, saClient, nil, nil, kubeClient /*kube client to be used for events*/, gceClient, resourceNamer, kubeSystemUID, ctxConfig, klog.TODO())
ctx := context.NewControllerContext(kubeClient, nil, nil, nil, nil, nil, saClient, nil, nil, kubeClient /*kube client to be used for events*/, gceClient, resourceNamer, kubeSystemUID, ctxConfig, klog.TODO())

return NewController(ctx, make(<-chan struct{}), klog.TODO())
}
Expand Down

0 comments on commit 1e99441

Please sign in to comment.