Skip to content

Commit

Permalink
Remove unused field, unify pointer-ness
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Goldstein <[email protected]>
  • Loading branch information
ncdc committed Feb 6, 2023
1 parent dee7a1e commit c0b0f1a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
3 changes: 0 additions & 3 deletions pkg/virtual/syncer/builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"k8s.io/client-go/tools/cache"

workloadv1alpha1 "github.com/kcp-dev/kcp/pkg/apis/workload/v1alpha1"
kcpclientset "github.com/kcp-dev/kcp/pkg/client/clientset/versioned/cluster"
kcpinformers "github.com/kcp-dev/kcp/pkg/client/informers/externalversions"
"github.com/kcp-dev/kcp/pkg/indexers"
"github.com/kcp-dev/kcp/pkg/virtual/framework/forwardingregistry"
Expand All @@ -49,7 +48,6 @@ func BuildVirtualWorkspace(
rootPathPrefix string,
kubeClusterClient kcpkubernetesclientset.ClusterInterface,
dynamicClusterClient kcpdynamic.ClusterInterface,
kcpClusterClient kcpclientset.ClusterInterface,
cachedKCPInformers kcpinformers.SharedInformerFactory,
) []rootapiserver.NamedVirtualWorkspace {
if !strings.HasSuffix(rootPathPrefix, "/") {
Expand All @@ -73,7 +71,6 @@ func BuildVirtualWorkspace(
provider := templateProvider{
kubeClusterClient: kubeClusterClient,
dynamicClusterClient: dynamicClusterClient,
kcpClusterClient: kcpClusterClient,
cachedKCPInformers: cachedKCPInformers,
rootPathPrefix: rootPathPrefix,
}
Expand Down
9 changes: 3 additions & 6 deletions pkg/virtual/syncer/builder/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
apisv1alpha1 "github.com/kcp-dev/kcp/pkg/apis/apis/v1alpha1"
workloadv1alpha1 "github.com/kcp-dev/kcp/pkg/apis/workload/v1alpha1"
"github.com/kcp-dev/kcp/pkg/authorization/delegated"
kcpclientset "github.com/kcp-dev/kcp/pkg/client/clientset/versioned/cluster"
kcpinformers "github.com/kcp-dev/kcp/pkg/client/informers/externalversions"
"github.com/kcp-dev/kcp/pkg/virtual/framework"
virtualworkspacesdynamic "github.com/kcp-dev/kcp/pkg/virtual/framework/dynamic"
Expand All @@ -54,7 +53,6 @@ import (
type templateProvider struct {
kubeClusterClient kcpkubernetesclientset.ClusterInterface
dynamicClusterClient kcpdynamic.ClusterInterface
kcpClusterClient kcpclientset.ClusterInterface
cachedKCPInformers kcpinformers.SharedInformerFactory
rootPathPrefix string
}
Expand All @@ -70,8 +68,8 @@ type templateParameters struct {
storageWrapperBuilder func(labels.Requirements) forwardingregistry.StorageWrapper
}

func (p *templateProvider) newTemplate(parameters templateParameters) template {
return template{
func (p *templateProvider) newTemplate(parameters templateParameters) *template {
return &template{
templateProvider: *p,
templateParameters: parameters,
readyCh: make(chan struct{}),
Expand Down Expand Up @@ -205,7 +203,6 @@ func (t *template) authorize(ctx context.Context, a authorizer.Attributes) (auth
func (t *template) bootstrapManagement(mainConfig genericapiserver.CompletedConfig) (apidefinition.APIDefinitionSetGetter, error) {
apiReconciler, err := apireconciler.NewAPIReconciler(
t.virtualWorkspaceName,
t.kcpClusterClient,
t.cachedKCPInformers.Workload().V1alpha1().SyncTargets(),
t.cachedKCPInformers.Apis().V1alpha1().APIResourceSchemas(),
t.cachedKCPInformers.Apis().V1alpha1().APIExports(),
Expand Down Expand Up @@ -263,7 +260,7 @@ func (t *template) bootstrapManagement(mainConfig genericapiserver.CompletedConf
return apiReconciler, nil
}

func (t template) buildVirtualWorkspace() *virtualworkspacesdynamic.DynamicVirtualWorkspace {
func (t *template) buildVirtualWorkspace() *virtualworkspacesdynamic.DynamicVirtualWorkspace {
return &virtualworkspacesdynamic.DynamicVirtualWorkspace{
RootPathResolver: framework.RootPathResolverFunc(t.resolveRootPath),
Authorizer: authorizer.AuthorizerFunc(t.authorize),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (

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

func NewAPIReconciler(
virtualWorkspaceName string,
kcpClusterClient kcpclientset.ClusterInterface,
syncTargetInformer workloadv1alpha1informers.SyncTargetClusterInformer,
apiResourceSchemaInformer apisv1alpha1informers.APIResourceSchemaClusterInformer,
apiExportInformer apisv1alpha1informers.APIExportClusterInformer,
Expand All @@ -71,8 +69,6 @@ func NewAPIReconciler(
c := &APIReconciler{
virtualWorkspaceName: virtualWorkspaceName,

kcpClusterClient: kcpClusterClient,

syncTargetLister: syncTargetInformer.Lister(),
syncTargetIndexer: syncTargetInformer.Informer().GetIndexer(),

Expand Down Expand Up @@ -128,8 +124,6 @@ func NewAPIReconciler(
type APIReconciler struct {
virtualWorkspaceName string

kcpClusterClient kcpclientset.ClusterInterface

syncTargetLister workloadv1alpha1listers.SyncTargetClusterLister
syncTargetIndexer cache.Indexer

Expand Down
7 changes: 1 addition & 6 deletions pkg/virtual/syncer/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (

"k8s.io/client-go/rest"

kcpclientset "github.com/kcp-dev/kcp/pkg/client/clientset/versioned/cluster"
kcpinformers "github.com/kcp-dev/kcp/pkg/client/informers/externalversions"
"github.com/kcp-dev/kcp/pkg/virtual/framework/rootapiserver"
"github.com/kcp-dev/kcp/pkg/virtual/syncer/builder"
Expand Down Expand Up @@ -56,10 +55,6 @@ func (o *Syncer) NewVirtualWorkspaces(
cachedKCPInformers kcpinformers.SharedInformerFactory,
) (workspaces []rootapiserver.NamedVirtualWorkspace, err error) {
config = rest.AddUserAgent(rest.CopyConfig(config), "syncer-virtual-workspace")
kcpClusterClient, err := kcpclientset.NewForConfig(config)
if err != nil {
return nil, err
}
kubeClusterClient, err := kcpkubernetesclientset.NewForConfig(config)
if err != nil {
return nil, err
Expand All @@ -69,5 +64,5 @@ func (o *Syncer) NewVirtualWorkspaces(
return nil, err
}

return builder.BuildVirtualWorkspace(rootPathPrefix, kubeClusterClient, dynamicClusterClient, kcpClusterClient, cachedKCPInformers), nil
return builder.BuildVirtualWorkspace(rootPathPrefix, kubeClusterClient, dynamicClusterClient, cachedKCPInformers), nil
}

0 comments on commit c0b0f1a

Please sign in to comment.