Skip to content

Commit f89ab90

Browse files
committed
Make linter happy
Signed-off-by: Dr. Stefan Schimanski <[email protected]>
1 parent 4aed708 commit f89ab90

File tree

7 files changed

+20
-15
lines changed

7 files changed

+20
-15
lines changed

pkg/builder/controller.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,7 @@ func (blder *Builder) do(r reconcile.Reconciler) error {
256256
}
257257

258258
// Set the Watch
259-
if err := blder.doWatch(); err != nil {
260-
return err
261-
}
262-
263-
return nil
259+
return blder.doWatch()
264260
}
265261

266262
func (blder *Builder) project(obj client.Object, proj objectProjection) (client.Object, error) {

pkg/builder/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ var _ = Describe("application", func() {
666666
Name: dep.Name,
667667
Kind: "Deployment",
668668
APIVersion: "apps/v1",
669-
Controller: pointer.Bool(true),
669+
Controller: ptr.To(true),
670670
UID: dep.UID,
671671
},
672672
},

pkg/controller/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/go-logr/logr"
2525
"k8s.io/client-go/util/workqueue"
2626
"k8s.io/klog/v2"
27-
"k8s.io/utils/pointer"
27+
"k8s.io/utils/ptr"
2828

2929
"sigs.k8s.io/controller-runtime/pkg/handler"
3030
"sigs.k8s.io/controller-runtime/pkg/internal/controller"
@@ -164,7 +164,7 @@ func NewUnmanaged(name string, mgr manager.Manager, options Options) (Controller
164164
if options.WatchProviderClusters == nil {
165165
options.WatchProviderClusters = mgr.GetControllerOptions().WatchProviderClusters
166166
if options.WatchProviderClusters == nil { // should never happen
167-
options.WatchProviderClusters = pointer.Bool(false)
167+
options.WatchProviderClusters = ptr.To(false)
168168
}
169169
}
170170

pkg/handler/enqueue_owner.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,14 @@ func (e *enqueueRequestForOwner) getOwnersReferences(object metav1.Object) []met
208208
}
209209

210210
func (e *enqueueRequestForOwner) DeepCopyFor(c cluster.Cluster) DeepCopyableEventHandler {
211-
copy := &enqueueRequestForOwner{
211+
cpy := &enqueueRequestForOwner{
212212
cluster: c,
213213
ownerType: e.ownerType,
214214
isController: e.isController,
215215
mapper: c.GetRESTMapper(),
216216
}
217-
if err := copy.parseOwnerTypeGroupKind(c.GetScheme()); err != nil {
217+
if err := cpy.parseOwnerTypeGroupKind(c.GetScheme()); err != nil {
218218
panic(err)
219219
}
220-
return copy
220+
return cpy
221221
}

pkg/internal/controller/controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,6 @@ func (c *Controller) Disengage(ctx context.Context, cluster cluster.Cluster) err
234234

235235
func (c *Controller) startClusterAwareWatchLocked(cldesc *clusterDescription, watchDesc *deepcopyableWatchDescription) error {
236236
watch := &deepcopyableWatchDescription{src: watchDesc.src.DeepCopyFor(cldesc.Cluster), handler: watchDesc.handler.DeepCopyFor(cldesc.Cluster), predicates: watchDesc.predicates}
237-
if watch == nil {
238-
return nil
239-
}
240237
c.LogConstructor(nil).Info("Starting Cluster-Aware EventSource", "cluster", cldesc.Name(), "source", watch.src)
241238
if err := watch.src.Start(cldesc.ctx, watch.handler, c.Queue, watch.predicates...); err != nil {
242239
return err

pkg/internal/source/kind.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,27 @@ import (
1717
"sigs.k8s.io/controller-runtime/pkg/predicate"
1818
)
1919

20+
// Source is a source of events (eh.g. Create, Update, Delete operations on Kubernetes Objects, Webhook callbacks, etc)
21+
// which should be processed by event.EventHandlers to enqueue reconcile.Requests.
22+
//
23+
// * Use Kind for events originating in the cluster (e.g. Pod Create, Pod Update, Deployment Update).
24+
//
25+
// * Use Channel for events originating outside the cluster (eh.g. GitHub Webhook callback, Polling external urls).
26+
//
27+
// Users may build their own Source implementations.
2028
type Source interface {
2129
Start(context.Context, handler.EventHandler, workqueue.RateLimitingInterface, ...predicate.Predicate) error
2230
}
2331

32+
// SyncingSource is a source that needs syncing prior to being usable. The controller
33+
// will call its WaitForSync prior to starting workers.
2434
type SyncingSource interface {
2535
Source
2636
WaitForSync(ctx context.Context) error
2737
}
2838

39+
// DeepCopyableSyncingSource is a source that can be deep copied for a specific cluster.
40+
// It is used in setups with a cluster provider set in the manager.
2941
type DeepCopyableSyncingSource interface {
3042
SyncingSource
3143
DeepCopyFor(cluster cluster.Cluster) DeepCopyableSyncingSource

pkg/reconcile/reconcile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (r Request) String() string {
6262
if r.ClusterName == "" {
6363
return r.NamespacedName.String()
6464
}
65-
return "cluster://" + string(r.ClusterName) + string(types.Separator) + r.NamespacedName.String()
65+
return "cluster://" + r.ClusterName + string(types.Separator) + r.NamespacedName.String()
6666
}
6767

6868
/*

0 commit comments

Comments
 (0)