Skip to content

pass context.Context into potentially blocking operations #3966

Open
@landism

Description

@landism

I work on software that is calling Provider.Create to create a kind cluster. Sometimes this hangs for unclear reasons. e.g., logs show it's been running for 20 minutes and the goroutine is stuck on an exec.Command().Run for a docker run --detach.

What would you like to be added:
I'd like to be able to pass a context.Context to Provider.Create (and really any other public kind api that might block) and have that propagate to any potentially blocking operations so that I can set a timeout on the context, cancel it, and get an error, rather than just blocking forever. (Luckily, for local commands, kind already attaches output to the errors, which will help even more when debugging).

Roughly, I want to make use of #1364 when calling kind as a library.

I am happy to make a PR with this change, but am looking to get confirmation that it'd be welcome before putting in the work.

Why is this needed:
To allow code calling kind as a library to cancel operations (which also makes it easier to debug when operations hang indefinitely)

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions