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

Introduce new errors for unsupported driver behaviors #1188

Merged
merged 3 commits into from
Aug 5, 2022

Conversation

jedevc
Copy link
Collaborator

@jedevc jedevc commented Jun 28, 2022

Around discussion in #1186, a few issues with buildx drivers came up. These scenarios are unsupported, but the user isn't warned, for example:

  • The kubernetes endpoint cli arg will be overwritten internally, so the user's specification is ignored
  • Appending a new node to a builder with a different driver than the original is unsupported (and atm will overwrite the previous builder's driver)
  • Creating builders with the same name as context builders gives a warning, but appending and deleting doesn't.

This PR should resolve the above issues, and provide a more helpful local debugging experience.

@jedevc jedevc requested a review from crazy-max June 28, 2022 09:29
commands/create.go Outdated Show resolved Hide resolved
commands/create.go Outdated Show resolved Hide resolved
commands/create.go Outdated Show resolved Hide resolved
@jedevc
Copy link
Collaborator Author

jedevc commented Jul 27, 2022

Have added another check, to error on attempting to edit nodes with --node, while including --driver-opt (which are otherwise silently discarded).

@jedevc jedevc added this to the v0.9.0 milestone Aug 1, 2022
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, PTAL @tonistiigi

Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the node update, if we are allowing flags then I don't see a reason why we would error on driveropt/config.

For the mixed drivers, looks like an oversight as well. Although this one is harder to fix. I don't see a specific reason why this should not be allowed. All the driver instances are passed separately to the build function. They do not need to be of the same type there.

@jedevc
Copy link
Collaborator Author

jedevc commented Aug 2, 2022

For the node update, if we are allowing flags then I don't see a reason why we would error on driveropt/config.

I think at the very least we should warn here - we allow the --driver-opt flag on a node update, but it will be silently discarded. The flag has to be accepted here since it's the same create subcommand that we use to create drivers in the first place.

Will update the PR to do this.

For the mixed drivers, looks like an oversight as well. Although this one is harder to fix. I don't see a specific reason why this should not be allowed. All the driver instances are passed separately to the build function. They do not need to be of the same type there.

True. However, the way we store the drivers in config makes this harder to do - the driver is attached to the NodeGroup, so to do this we'd need to push down the driver config into each individual Node, not quite sure what implications that would have, but seems like an interesting possibility 👀

Signed-off-by: Justin Chadwell <me@jedevc.com>
This patch reorders+refactors the runCreate function to ensure that we
can detect and notify the user in the scenario that the user attempts to
combine multiple drivers in a single builder, which is an unsupported
scenario.

Previously, we would just overwrite the previous builder with the new
driver, potentially invalidating the already existing nodes.

Signed-off-by: Justin Chadwell <me@jedevc.com>
@jedevc jedevc force-pushed the driver-opt-warnings branch 2 times, most recently from 99a0764 to 2653478 Compare August 4, 2022 16:58
store/nodegroup.go Outdated Show resolved Hide resolved
Previously, editing nodes to contain a new set of driver options or
config files was unsupported, and silently dropping them. In this patch,
we update with these, as well as add a new warning message that any new
options may not taken into account until the builder restarts (which
may apply to the flags, platforms and endpoints as well).

Signed-off-by: Justin Chadwell <me@jedevc.com>
@tonistiigi tonistiigi merged commit 7b660c4 into docker:master Aug 5, 2022
@jedevc jedevc deleted the driver-opt-warnings branch August 8, 2022 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants