@@ -74,27 +74,27 @@ func (r *GCPClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
7474
7575 clusterToInfraFn := util .ClusterToInfrastructureMapFunc (ctx , infrav1 .GroupVersion .WithKind ("GCPCluster" ), mgr .GetClient (), & infrav1.GCPCluster {})
7676 if err = c .Watch (
77- source .Kind (mgr .GetCache (), & clusterv1.Cluster {}) ,
78- handler .EnqueueRequestsFromMapFunc (func (mapCtx context.Context , o client.Object ) []reconcile.Request {
79- requests := clusterToInfraFn (mapCtx , o )
80- if requests == nil {
81- return nil
82- }
77+ source .Kind [client. Object ] (mgr .GetCache (), & clusterv1.Cluster {},
78+ handler .EnqueueRequestsFromMapFunc (func (mapCtx context.Context , o client.Object ) []reconcile.Request {
79+ requests := clusterToInfraFn (mapCtx , o )
80+ if requests == nil {
81+ return nil
82+ }
8383
84- gcpCluster := & infrav1.GCPCluster {}
85- if err := r .Get (ctx , requests [0 ].NamespacedName , gcpCluster ); err != nil {
86- log .V (4 ).Error (err , "Failed to get GCP cluster" )
87- return nil
88- }
84+ gcpCluster := & infrav1.GCPCluster {}
85+ if err := r .Get (ctx , requests [0 ].NamespacedName , gcpCluster ); err != nil {
86+ log .V (4 ).Error (err , "Failed to get GCP cluster" )
87+ return nil
88+ }
8989
90- if annotations .IsExternallyManaged (gcpCluster ) {
91- log .V (4 ).Info ("GCPCluster is externally managed, skipping mapping." )
92- return nil
93- }
94- return requests
95- }),
96- predicates .ClusterUnpaused (log ),
97- ); err != nil {
90+ if annotations .IsExternallyManaged (gcpCluster ) {
91+ log .V (4 ).Info ("GCPCluster is externally managed, skipping mapping." )
92+ return nil
93+ }
94+ return requests
95+ }),
96+ predicates .ClusterUnpaused (log ),
97+ ) ); err != nil {
9898 return errors .Wrap (err , "failed adding a watch for ready clusters" )
9999 }
100100
0 commit comments