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

🌱 CAPD: fix multi error handling in RunContainer #9139

Merged

Conversation

chrischdi
Copy link
Member

@chrischdi chrischdi commented Aug 7, 2023

What this PR does / why we need it:

Follow-up after discussions at #9125 (comment)

Log would now look like e.g.:

[error starting container "clusterctl-upgrade-oh686r-control-plane-6hdqw": Error response from daemon: driver failed programming external connectivity on endpoint clusterctl-upgrade-oh686r-control-plane-6hdqw (637e7efe77a6abeb44ff037b39458562423c693c10f122156d32be2fc9081eda): Bind for 127.0.0.1:33369 failed: port is already allocated, error deleting container: Error response from daemon: driver failed to remove container]

Prior to the change it would have been:

error removing container after failed start: error starting container "clusterctl-upgrade-oh686r-control-plane-6hdqw": Error response from daemon: driver failed programming external connectivity on endpoint clusterctl-upgrade-oh686r-control-plane-6hdqw (637e7efe77a6abeb44ff037b39458562423c693c10f122156d32be2fc9081eda): Bind for 127.0.0.1:33369 failed: port is already allocated: Error response from daemon: failed to remove container

/assign sbueringer

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Part of #8824

/area provider/infrastructure-docker

@k8s-ci-robot k8s-ci-robot added area/provider/infrastructure-docker Issues or PRs related to the docker infrastructure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 7, 2023
@chrischdi chrischdi changed the title CAPD: fix multi error handling in RunContainer 🌱 CAPD: fix multi error handling in RunContainer Aug 7, 2023
Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 7, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: fa4c0f3b85ae2a2e7e89678c66395957439cb258

@killianmuldoon
Copy link
Contributor

Probably easy enough to cherry-pick these and just ensure they merge in the right order with the cherry-picks from this: #9125

@killianmuldoon
Copy link
Contributor

/cherry-pick release-1.5

@k8s-infra-cherrypick-robot

@killianmuldoon: once the present PR merges, I will cherry-pick it on top of release-1.5 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@killianmuldoon
Copy link
Contributor

/cherry-pick release-1.4

@k8s-infra-cherrypick-robot

@killianmuldoon: once the present PR merges, I will cherry-pick it on top of release-1.4 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

if innerErr := d.dockerClient.ContainerRemove(ctx, resp.ID, types.ContainerRemoveOptions{Force: true, RemoveVolumes: true}); innerErr != nil {
return errors.Wrapf(innerErr, "error removing container after failed start: %s", err)
if reterr := d.dockerClient.ContainerRemove(ctx, resp.ID, types.ContainerRemoveOptions{Force: true, RemoveVolumes: true}); reterr != nil {
return kerrors.NewAggregate([]error{reterr, errors.Wrapf(err, "error deleting container")})
Copy link
Member

@sbueringer sbueringer Aug 7, 2023

Choose a reason for hiding this comment

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

I think this mixes up the errors, sorry :D

The err from above should not be further wrapped, right?

(The difference compared to the example I provided is that you're reterr is the other one)

Copy link
Member

Choose a reason for hiding this comment

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

So this would work

return kerrors.NewAggregate([]error{err, errors.Wrapf(reterr, "error deleting container")})

@chrischdi chrischdi force-pushed the pr-fix-capd-multi-error branch from c72be6f to ecfbbc8 Compare August 7, 2023 18:42
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 7, 2023
@chrischdi
Copy link
Member Author

Updated, now it looks like this:

[error starting container "clusterctl-upgrade-oh686r-control-plane-6hdqw": Error response from daemon: driver failed programming external connectivity on endpoint clusterctl-upgrade-oh686r-control-plane-6hdqw (637e7efe77a6abeb44ff037b39458562423c693c10f122156d32be2fc9081eda): Bind for 127.0.0.1:33369 failed: port is already allocated, error deleting container: Error response from daemon: driver failed to remove container]

https://go.dev/play/p/qUSrjVkbHgV

@sbueringer
Copy link
Member

Perfect!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 8, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 116576593ed52c1f9aa7f2be8768dd3d6bf50f6d

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 8, 2023
@k8s-ci-robot k8s-ci-robot merged commit a847308 into kubernetes-sigs:main Aug 8, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.6 milestone Aug 8, 2023
@k8s-infra-cherrypick-robot

@killianmuldoon: #9139 failed to apply on top of branch "release-1.5":

Applying: CAPD: fix multi error handling in RunContainer
Using index info to reconstruct a base tree...
M	test/infrastructure/container/docker.go
Falling back to patching base and 3-way merge...
Auto-merging test/infrastructure/container/docker.go
CONFLICT (content): Merge conflict in test/infrastructure/container/docker.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 CAPD: fix multi error handling in RunContainer
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-infra-cherrypick-robot

@killianmuldoon: #9139 failed to apply on top of branch "release-1.4":

Applying: CAPD: fix multi error handling in RunContainer
Using index info to reconstruct a base tree...
M	test/infrastructure/container/docker.go
Falling back to patching base and 3-way merge...
Auto-merging test/infrastructure/container/docker.go
CONFLICT (content): Merge conflict in test/infrastructure/container/docker.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 CAPD: fix multi error handling in RunContainer
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sbueringer
Copy link
Member

Looks like we have to wait until the cherry-picks are merged and then cherry-pick again

@chrischdi
Copy link
Member Author

Looks like we have to wait until the cherry-picks are merged and then cherry-pick again

jep

@chrischdi chrischdi deleted the pr-fix-capd-multi-error branch August 8, 2023 16:03
@killianmuldoon
Copy link
Contributor

/cherry-pick release-1.4

@k8s-infra-cherrypick-robot

@killianmuldoon: new pull request created: #9242

In response to this:

/cherry-pick release-1.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sbueringer
Copy link
Member

Q: We also need a 1.5 cherry-pick, right?

@sbueringer
Copy link
Member

/cherry-pick release-1.5

@k8s-infra-cherrypick-robot

@sbueringer: new pull request created: #9243

In response to this:

/cherry-pick release-1.5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@chrischdi
Copy link
Member Author

chrischdi commented Aug 18, 2023

@k8s-infra-cherrypick-robot

@chrischdi: new pull request could not be created: failed to create pull request against kubernetes-sigs/cluster-api#release-1.4 from head k8s-infra-cherrypick-robot:cherry-pick-9139-to-release-1.4: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"No commits between kubernetes-sigs:release-1.4 and k8s-infra-cherrypick-robot:cherry-pick-9139-to-release-1.4"}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request"}

In response to this:

Also v1.4

/cherry-pick release-1.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@killianmuldoon
Copy link
Contributor

Also v1.4 due to:

Should be cherry-picked to both 1.5 and 1.4 now - looks like we're good

@chrischdi
Copy link
Member Author

ah, did only see the 1.5 comment above :D 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/infrastructure-docker Issues or PRs related to the docker infrastructure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants