Skip to content

Commit c0b0f1a

Browse files
committed
Remove unused field, unify pointer-ness
Signed-off-by: Andy Goldstein <[email protected]>
1 parent dee7a1e commit c0b0f1a

File tree

4 files changed

+4
-21
lines changed

4 files changed

+4
-21
lines changed

pkg/virtual/syncer/builder/build.go

-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"k8s.io/client-go/tools/cache"
2727

2828
workloadv1alpha1 "github.com/kcp-dev/kcp/pkg/apis/workload/v1alpha1"
29-
kcpclientset "github.com/kcp-dev/kcp/pkg/client/clientset/versioned/cluster"
3029
kcpinformers "github.com/kcp-dev/kcp/pkg/client/informers/externalversions"
3130
"github.com/kcp-dev/kcp/pkg/indexers"
3231
"github.com/kcp-dev/kcp/pkg/virtual/framework/forwardingregistry"
@@ -49,7 +48,6 @@ func BuildVirtualWorkspace(
4948
rootPathPrefix string,
5049
kubeClusterClient kcpkubernetesclientset.ClusterInterface,
5150
dynamicClusterClient kcpdynamic.ClusterInterface,
52-
kcpClusterClient kcpclientset.ClusterInterface,
5351
cachedKCPInformers kcpinformers.SharedInformerFactory,
5452
) []rootapiserver.NamedVirtualWorkspace {
5553
if !strings.HasSuffix(rootPathPrefix, "/") {
@@ -73,7 +71,6 @@ func BuildVirtualWorkspace(
7371
provider := templateProvider{
7472
kubeClusterClient: kubeClusterClient,
7573
dynamicClusterClient: dynamicClusterClient,
76-
kcpClusterClient: kcpClusterClient,
7774
cachedKCPInformers: cachedKCPInformers,
7875
rootPathPrefix: rootPathPrefix,
7976
}

pkg/virtual/syncer/builder/template.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import (
3838
apisv1alpha1 "github.com/kcp-dev/kcp/pkg/apis/apis/v1alpha1"
3939
workloadv1alpha1 "github.com/kcp-dev/kcp/pkg/apis/workload/v1alpha1"
4040
"github.com/kcp-dev/kcp/pkg/authorization/delegated"
41-
kcpclientset "github.com/kcp-dev/kcp/pkg/client/clientset/versioned/cluster"
4241
kcpinformers "github.com/kcp-dev/kcp/pkg/client/informers/externalversions"
4342
"github.com/kcp-dev/kcp/pkg/virtual/framework"
4443
virtualworkspacesdynamic "github.com/kcp-dev/kcp/pkg/virtual/framework/dynamic"
@@ -54,7 +53,6 @@ import (
5453
type templateProvider struct {
5554
kubeClusterClient kcpkubernetesclientset.ClusterInterface
5655
dynamicClusterClient kcpdynamic.ClusterInterface
57-
kcpClusterClient kcpclientset.ClusterInterface
5856
cachedKCPInformers kcpinformers.SharedInformerFactory
5957
rootPathPrefix string
6058
}
@@ -70,8 +68,8 @@ type templateParameters struct {
7068
storageWrapperBuilder func(labels.Requirements) forwardingregistry.StorageWrapper
7169
}
7270

73-
func (p *templateProvider) newTemplate(parameters templateParameters) template {
74-
return template{
71+
func (p *templateProvider) newTemplate(parameters templateParameters) *template {
72+
return &template{
7573
templateProvider: *p,
7674
templateParameters: parameters,
7775
readyCh: make(chan struct{}),
@@ -205,7 +203,6 @@ func (t *template) authorize(ctx context.Context, a authorizer.Attributes) (auth
205203
func (t *template) bootstrapManagement(mainConfig genericapiserver.CompletedConfig) (apidefinition.APIDefinitionSetGetter, error) {
206204
apiReconciler, err := apireconciler.NewAPIReconciler(
207205
t.virtualWorkspaceName,
208-
t.kcpClusterClient,
209206
t.cachedKCPInformers.Workload().V1alpha1().SyncTargets(),
210207
t.cachedKCPInformers.Apis().V1alpha1().APIResourceSchemas(),
211208
t.cachedKCPInformers.Apis().V1alpha1().APIExports(),
@@ -263,7 +260,7 @@ func (t *template) bootstrapManagement(mainConfig genericapiserver.CompletedConf
263260
return apiReconciler, nil
264261
}
265262

266-
func (t template) buildVirtualWorkspace() *virtualworkspacesdynamic.DynamicVirtualWorkspace {
263+
func (t *template) buildVirtualWorkspace() *virtualworkspacesdynamic.DynamicVirtualWorkspace {
267264
return &virtualworkspacesdynamic.DynamicVirtualWorkspace{
268265
RootPathResolver: framework.RootPathResolverFunc(t.resolveRootPath),
269266
Authorizer: authorizer.AuthorizerFunc(t.authorize),

pkg/virtual/syncer/controllers/apireconciler/syncer_apireconciler_controller.go

-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737

3838
apisv1alpha1 "github.com/kcp-dev/kcp/pkg/apis/apis/v1alpha1"
3939
workloadv1alpha1 "github.com/kcp-dev/kcp/pkg/apis/workload/v1alpha1"
40-
kcpclientset "github.com/kcp-dev/kcp/pkg/client/clientset/versioned/cluster"
4140
apisv1alpha1informers "github.com/kcp-dev/kcp/pkg/client/informers/externalversions/apis/v1alpha1"
4241
workloadv1alpha1informers "github.com/kcp-dev/kcp/pkg/client/informers/externalversions/workload/v1alpha1"
4342
apisv1alpha1listers "github.com/kcp-dev/kcp/pkg/client/listers/apis/v1alpha1"
@@ -59,7 +58,6 @@ type AllowedAPIfilterFunc func(apiGroupResource schema.GroupResource) bool
5958

6059
func NewAPIReconciler(
6160
virtualWorkspaceName string,
62-
kcpClusterClient kcpclientset.ClusterInterface,
6361
syncTargetInformer workloadv1alpha1informers.SyncTargetClusterInformer,
6462
apiResourceSchemaInformer apisv1alpha1informers.APIResourceSchemaClusterInformer,
6563
apiExportInformer apisv1alpha1informers.APIExportClusterInformer,
@@ -71,8 +69,6 @@ func NewAPIReconciler(
7169
c := &APIReconciler{
7270
virtualWorkspaceName: virtualWorkspaceName,
7371

74-
kcpClusterClient: kcpClusterClient,
75-
7672
syncTargetLister: syncTargetInformer.Lister(),
7773
syncTargetIndexer: syncTargetInformer.Informer().GetIndexer(),
7874

@@ -128,8 +124,6 @@ func NewAPIReconciler(
128124
type APIReconciler struct {
129125
virtualWorkspaceName string
130126

131-
kcpClusterClient kcpclientset.ClusterInterface
132-
133127
syncTargetLister workloadv1alpha1listers.SyncTargetClusterLister
134128
syncTargetIndexer cache.Indexer
135129

pkg/virtual/syncer/options/options.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323

2424
"k8s.io/client-go/rest"
2525

26-
kcpclientset "github.com/kcp-dev/kcp/pkg/client/clientset/versioned/cluster"
2726
kcpinformers "github.com/kcp-dev/kcp/pkg/client/informers/externalversions"
2827
"github.com/kcp-dev/kcp/pkg/virtual/framework/rootapiserver"
2928
"github.com/kcp-dev/kcp/pkg/virtual/syncer/builder"
@@ -56,10 +55,6 @@ func (o *Syncer) NewVirtualWorkspaces(
5655
cachedKCPInformers kcpinformers.SharedInformerFactory,
5756
) (workspaces []rootapiserver.NamedVirtualWorkspace, err error) {
5857
config = rest.AddUserAgent(rest.CopyConfig(config), "syncer-virtual-workspace")
59-
kcpClusterClient, err := kcpclientset.NewForConfig(config)
60-
if err != nil {
61-
return nil, err
62-
}
6358
kubeClusterClient, err := kcpkubernetesclientset.NewForConfig(config)
6459
if err != nil {
6560
return nil, err
@@ -69,5 +64,5 @@ func (o *Syncer) NewVirtualWorkspaces(
6964
return nil, err
7065
}
7166

72-
return builder.BuildVirtualWorkspace(rootPathPrefix, kubeClusterClient, dynamicClusterClient, kcpClusterClient, cachedKCPInformers), nil
67+
return builder.BuildVirtualWorkspace(rootPathPrefix, kubeClusterClient, dynamicClusterClient, cachedKCPInformers), nil
7368
}

0 commit comments

Comments
 (0)