Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Context handling in clusterctl #8733

Closed
sbueringer opened this issue May 24, 2023 · 6 comments · Fixed by #8939
Closed

Improve Context handling in clusterctl #8733

sbueringer opened this issue May 24, 2023 · 6 comments · Fixed by #8939
Labels
area/clusterctl Issues or PRs related to clusterctl kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@sbueringer
Copy link
Member

What would you like to be added (User Story)?

Today we have plenty of places in clusterctl where we use context.TODO(). This issue is about incrementally improving clusterctl to pass through Context top-down.

Related:

  • The recent CR bump PR (⚠️ Bump to CR v0.15.0 #8007) introduced the new wait utils from apimachinery which means it's now even easier to pass through context into code that is run inside of the wait utils.

Detailed Description

Anything else you would like to add?

No response

Label(s) to be applied

/kind cleanup
/area clusterctl

One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels.

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. area/clusterctl Issues or PRs related to clusterctl labels May 24, 2023
@sbueringer
Copy link
Member Author

/triage accepted

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 24, 2023
@aniruddha2000
Copy link
Contributor

Hello @sbueringer, I would like to work on this but, could you give some more context about this issue, are you talking about everywhere we use context.TODO() in clusterctl scope like this or specific to client operations? It will be helpful if you give a bit more context on this.

@sbueringer
Copy link
Member Author

sbueringer commented May 30, 2023

The scope of the issue is currently intentionally very open. I didn't do further research on which areas of clusterctl we should focus and what the impact on our public interfaces is. But yeah overall we should probably replace all occurences of context.TODO(). I would definitely recommend to open separate PRs to focus each of them on certain code paths or packages though.

@ykakarap @fabriziopandini @Jont828 Any opinions from your side?

@ykakarap
Copy link
Contributor

Sounds like a good idea. I would recommend starting with some simple wins like evaluating any root level context that are being using and seeing if we can replace them with the right context (context.Background (?) or whatever is reelvant).

Refactoring some of the other code to pass through context from top-down might get a little tricky and we should evaluate them on a case by case basis as refactoring some of these functions would mean some of the exported clusterctl interfaces would be impacted.

@ykakarap
Copy link
Contributor

Given our current clusterctl compatibility guarantee it is technically okay for us to make the changes to the interface but it would be a nice to have if we can find a way to keep the impact small.

@Fedosin
Copy link
Contributor

Fedosin commented Jun 29, 2023

Since we use a lot of clusterctl functions in Cluster API operator, it would be beneficial for us to support "context" here. I'm going to implement a fix later today to instrument all required functions with "context".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clusterctl Issues or PRs related to clusterctl kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants