File tree Expand file tree Collapse file tree 2 files changed +23
-35
lines changed
pkg/controllers/namespacesync Expand file tree Collapse file tree 2 files changed +23
-35
lines changed Original file line number Diff line number Diff line change @@ -135,29 +135,23 @@ func (r *Reconciler) Reconcile(
135135
136136 // TODO Consider running in parallel.
137137 for i := range sccs {
138- // Check for context cancellation to prevent goroutine leaks
139- select {
140- case <- ctx .Done ():
141- return ctrl.Result {}, ctx .Err ()
142- default :
143- scc := & sccs [i ]
144-
145- err := copyClusterClassAndTemplates (
146- ctx ,
147- r .Client ,
148- r .UnstructuredCachingClient ,
149- scc ,
138+ scc := & sccs [i ]
139+
140+ err := copyClusterClassAndTemplates (
141+ ctx ,
142+ r .Client ,
143+ r .UnstructuredCachingClient ,
144+ scc ,
145+ namespace ,
146+ )
147+ if err != nil {
148+ // TODO Record an Event.
149+ return ctrl.Result {}, fmt .Errorf (
150+ "failed to copy source ClusterClass %s or its referenced Templates to namespace %s: %w" ,
151+ client .ObjectKeyFromObject (scc ),
150152 namespace ,
153+ err ,
151154 )
152- if err != nil {
153- // TODO Record an Event.
154- return ctrl.Result {}, fmt .Errorf (
155- "failed to copy source ClusterClass %s or its referenced Templates to namespace %s: %w" ,
156- client .ObjectKeyFromObject (scc ),
157- namespace ,
158- err ,
159- )
160- }
161155 }
162156 }
163157
Original file line number Diff line number Diff line change @@ -79,21 +79,15 @@ func walkReferences(
7979 }
8080
8181 for mdIdx := range cc .Spec .Workers .MachineDeployments {
82- // Check for context cancellation to prevent goroutine leaks
83- select {
84- case <- ctx .Done ():
85- return ctx .Err ()
86- default :
87- md := & cc .Spec .Workers .MachineDeployments [mdIdx ]
88- if md .Template .Infrastructure .Ref != nil {
89- if err := fn (ctx , md .Template .Infrastructure .Ref ); err != nil {
90- return err
91- }
82+ md := & cc .Spec .Workers .MachineDeployments [mdIdx ]
83+ if md .Template .Infrastructure .Ref != nil {
84+ if err := fn (ctx , md .Template .Infrastructure .Ref ); err != nil {
85+ return err
9286 }
93- if md . Template . Bootstrap . Ref != nil {
94- if err := fn ( ctx , md .Template .Bootstrap .Ref ); err != nil {
95- return err
96- }
87+ }
88+ if md .Template .Bootstrap .Ref != nil {
89+ if err := fn ( ctx , md . Template . Bootstrap . Ref ); err != nil {
90+ return err
9791 }
9892 }
9993 }
You can’t perform that action at this time.
0 commit comments