Description
The project uses context.TODO() extensively because no proper context is implemented in some scope methods. This is an accepted solution for a simplified use of contexts in testing code and we can keep this unchanged, but it should be fixed in any non-test files as this context configuration is essentially a placeholder that will never time out.
A quick search shows that this should be addressed in the following files:
cloud/scope/machine.go
cloud/scope/cluster.go
cloud/scope/managedcluster.go
cloud/scope/managedcontrolplane.go
cloud/scope/managedmachinepool.go
I may have missed other occurrences of this syntax
One possible solution is to pass contexts as a scope method parameter:
func (s *ClusterScope) PatchObject(ctx context.Context) error {
...
}
This solution is aligned with other CAPI projects, i.e. CAPZ
Description
The project uses
context.TODO()extensively because no proper context is implemented in some scope methods. This is an accepted solution for a simplified use of contexts in testing code and we can keep this unchanged, but it should be fixed in any non-test files as this context configuration is essentially a placeholder that will never time out.A quick search shows that this should be addressed in the following files:
cloud/scope/machine.gocloud/scope/cluster.gocloud/scope/managedcluster.gocloud/scope/managedcontrolplane.gocloud/scope/managedmachinepool.goI may have missed other occurrences of this syntax
One possible solution is to pass contexts as a scope method parameter:
This solution is aligned with other CAPI projects, i.e. CAPZ