Skip to content

Commit d3ade43

Browse files
committed
lint
On-behalf-of: @SAP [email protected]
1 parent b2ad0c7 commit d3ade43

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

internal/controller/syncmanager/controller.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1"
3030

3131
kcpapisv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1"
32-
kcpdevv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1"
3332
apiexportprovider "github.com/kcp-dev/multicluster-provider/apiexport"
3433
mccontroller "sigs.k8s.io/multicluster-runtime/pkg/controller"
3534
mcmanager "sigs.k8s.io/multicluster-runtime/pkg/manager"
@@ -75,7 +74,7 @@ type Reconciler struct {
7574
stateNamespace string
7675
agentName string
7776

78-
apiExport *kcpdevv1alpha1.APIExport
77+
apiExport *kcpapisv1alpha1.APIExport
7978

8079
// URL for which the current vwCluster instance has been created
8180
vwURL string
@@ -110,7 +109,7 @@ func Add(
110109
kcpCluster cluster.Cluster,
111110
kcpRestConfig *rest.Config,
112111
log *zap.SugaredLogger,
113-
apiExport *kcpdevv1alpha1.APIExport,
112+
apiExport *kcpapisv1alpha1.APIExport,
114113
prFilter labels.Selector,
115114
stateNamespace string,
116115
agentName string,
@@ -144,7 +143,7 @@ func Add(
144143
// Watch for changes to APIExport on the kcp side to start/restart the actual syncing controllers;
145144
// the cache is already restricted by a fieldSelector in the main.go to respect the RBAC restrictions,
146145
// so there is no need here to add an additional filter.
147-
WatchesRawSource(source.Kind(kcpCluster.GetCache(), &kcpdevv1alpha1.APIExport{}, controllerutil.EnqueueConst[*kcpdevv1alpha1.APIExport]("dummy"))).
146+
WatchesRawSource(source.Kind(kcpCluster.GetCache(), &kcpapisv1alpha1.APIExport{}, controllerutil.EnqueueConst[*kcpapisv1alpha1.APIExport]("dummy"))).
148147
// Watch for changes to the PublishedResources
149148
Watches(&syncagentv1alpha1.PublishedResource{}, controllerutil.EnqueueConst[ctrlruntimeclient.Object]("dummy"), builder.WithPredicates(predicate.ByLabels(prFilter))).
150149
Build(reconciler)
@@ -158,15 +157,15 @@ func (r *Reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (reconc
158157

159158
key := types.NamespacedName{Name: r.apiExport.Name}
160159

161-
apiExport := &kcpdevv1alpha1.APIExport{}
160+
apiExport := &kcpapisv1alpha1.APIExport{}
162161
if err := r.kcpCluster.GetClient().Get(ctx, key, apiExport); ctrlruntimeclient.IgnoreNotFound(err) != nil {
163162
return reconcile.Result{}, fmt.Errorf("failed to retrieve APIExport: %w", err)
164163
}
165164

166165
return reconcile.Result{}, r.reconcile(ctx, log, apiExport)
167166
}
168167

169-
func (r *Reconciler) reconcile(ctx context.Context, log *zap.SugaredLogger, apiExport *kcpdevv1alpha1.APIExport) error {
168+
func (r *Reconciler) reconcile(ctx context.Context, log *zap.SugaredLogger, apiExport *kcpapisv1alpha1.APIExport) error {
170169
// We're not yet making use of APIEndpointSlices, as we don't even fully
171170
// support a sharded kcp setup yet. Hence for now we're safe just using
172171
// this deprecated VW URL.
@@ -261,12 +260,10 @@ func (r *Reconciler) ensureManager(log *zap.SugaredLogger, vwURL string) error {
261260
// Make sure the vwManager can Engage() on the controller, even though we
262261
// start and stop them outside the control of the manager. This shim will
263262
// ensure Engage() calls are handed to the underlying sync controller as
264-
// as long as the controller is running. There is sadly no way to remove
265-
// a shim from the manager again, so the list of runnables in the manager
266-
// will just grow over time.
267-
manager.Add(&controllerShim{
268-
reconciler: r,
269-
})
263+
// as long as the controller is running.
264+
if err := manager.Add(&controllerShim{reconciler: r}); err != nil {
265+
return fmt.Errorf("failed to initialize cluster: %w", err)
266+
}
270267

271268
// use the app's root context as the base, not the reconciling context, which
272269
// might get cancelled after Reconcile() is done;

0 commit comments

Comments
 (0)