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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 capd: don't add host ports to exposed ports of containers #10657

Merged

Conversation

schrej
Copy link
Member

@schrej schrej commented May 21, 2024

This fixes an issue when running capd with podmans docker compatibility mode. And it's also incorrect in general.

What this PR does / why we need it:
CAPD currently adds the host ports that are part of a port mapping to the list of 'exposed ports' of the container. This is incorrect and leads to an error when using CAPD with podman, since capd sets the host port to 0 so an available port is automatically selected.

controller.go:324] "Reconciler error" err="failed to create load balancer: error creating container \"capi-quickstart-lb\": Error response from daemon: fill out specgen: port numbers must be between 1 and 65535 (inclusive), got 0" controller="dockercluster" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="DockerCluster"

There is no specific documentation around this that I could find. The closest is this: moby/moby#3039

This took way to long 馃槃

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

This fixes an issue when running capd with podmans docker compatibility mode. And it's also incorrect in general.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 21, 2024
@k8s-ci-robot k8s-ci-robot added do-not-merge/needs-area PR is missing an area label size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 21, 2024
@schrej
Copy link
Member Author

schrej commented May 21, 2024

/area provider/infrastructure-docker

@k8s-ci-robot k8s-ci-robot added area/provider/infrastructure-docker Issues or PRs related to the docker infrastructure provider and removed do-not-merge/needs-area PR is missing an area label labels May 21, 2024
@chrischdi
Copy link
Member

Can you please add the error when using CAPD with podman in the description?

This helps to verify in future to verify if the same issue occurs again.

@schrej
Copy link
Member Author

schrej commented May 22, 2024

done

@chrischdi
Copy link
Member

/test help

@k8s-ci-robot
Copy link
Contributor

@chrischdi: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-cluster-api-build-main
  • /test pull-cluster-api-e2e-blocking-main
  • /test pull-cluster-api-e2e-conformance-ci-latest-main
  • /test pull-cluster-api-e2e-conformance-main
  • /test pull-cluster-api-e2e-main
  • /test pull-cluster-api-e2e-mink8s-main
  • /test pull-cluster-api-e2e-upgrade-1-30-1-31-main
  • /test pull-cluster-api-test-main
  • /test pull-cluster-api-test-mink8s-main
  • /test pull-cluster-api-verify-main

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-apidiff-main

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-apidiff-main
  • pull-cluster-api-build-main
  • pull-cluster-api-e2e-blocking-main
  • pull-cluster-api-test-main
  • pull-cluster-api-verify-main

In response to this:

/test help

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-sigs/prow repository.

@chrischdi
Copy link
Member

/test pull-cluster-api-e2e-main

Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

/lgtm

I think this PR makes sense as is. Thanks @schrej !

Looks like podman is a bit more correct on its api / docker a bit more lazy :-)

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

LGTM label has been added.

Git tree hash: 8de191905bd15b8f244d03ed32c42bf27846ba14

@sbueringer
Copy link
Member

Thx!

Looks good to me and tests are green so

/approve

@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 May 23, 2024
@k8s-ci-robot k8s-ci-robot merged commit 8e8650c into kubernetes-sigs:main May 23, 2024
39 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.8 milestone May 23, 2024
@schrej schrej deleted the fix/capd-dont-expose-host-ports branch May 23, 2024 16:17
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.

None yet

4 participants