Skip to content

fix(local-setup): support podman rootless networking for local kind clusters - #1

Merged
silvi-t merged 1 commit into
silvi-t:local-setup-fixfrom
Boomatang:local-setup-fix_patch
Jun 29, 2026
Merged

fix(local-setup): support podman rootless networking for local kind clusters#1
silvi-t merged 1 commit into
silvi-t:local-setup-fixfrom
Boomatang:local-setup-fix_patch

Conversation

@Boomatang

Copy link
Copy Markdown

Summary

  • Wraps pytest with podman unshare --rootless-netns when running under rootless podman, so tests can reach kind cluster LoadBalancer IPs
  • Replaces unreliable process detection (pgrep, broken kill [c]loud-... pattern) with PID file tracking for cloud-provider-kind on Linux
  • Adds --enable-lb-port-mapping flag to cloud-provider-kind on both platforms
  • Adds platform-specific diagnostic messages when the podman socket is not found

Details

podman unshare --rootless-netns

When podman runs in rootless mode, containers operate inside an isolated user and network namespace. The host process (pytest) cannot directly reach IP addresses assigned inside that namespace, such as the LoadBalancer IPs that cloud-provider-kind provisions for kind clusters.

podman unshare --rootless-netns executes the given command inside podman's rootless network namespace, granting the process visibility into the container network. This allows pytest to connect to services exposed via LoadBalancer without requiring root privileges or manual network configuration.

Docker users and macOS podman users are unaffected: the ROOTLESS_NETNS variable evaluates to empty when podman is not detected or is not running in rootless mode, so the pytest command runs unchanged.

cloud-provider-kind lifecycle

The previous pgrep -x check and the kill [c]loud-provider-kind stop pattern were unreliable. The start target now unconditionally kills any prior instance (via PID file on Linux, sudo pkill on macOS) before launching a fresh process, avoiding stale-process issues during make local-setup re-runs.

Not tested on macOS

These changes have been developed and tested on Linux with rootless podman. macOS behavior has not been verified. In particular, the PID file (/tmp/cloud-provider-kind.pid) is only written on Linux because the macOS path uses sudo, which makes capturing the background PID of the actual cloud-provider-kind process unreliable. macOS continues to use sudo pkill -f for cleanup. If issues arise on macOS, follow-up changes to the PID file handling may be needed.

@crstrn13 crstrn13 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Very neat solution, spent a ton of time trying to make it work on my end, but your approach is very neat.

Comment thread make/dependencies.mk Outdated
fi; \
echo "Starting cloud-provider-kind..."; \
if [ "$$(uname)" = "Darwin" ]; then \
sudo env $$DOCKER_HOST_ENV cloud-provider-kind --enable-lb-port-mapping > /tmp/cloud-provider-kind.log 2>&1 & \

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

On macOS with Docker, --enable-lb-port-mapping breaks connectivity to LoadBalancer services. Can you remove this flag from the macOS path? The IPs are directly routable on Mac without port mapping. Just keep it for the Linux path.

Allow access to the podman network from the host machine for the test.
Ensure cloud-provider-kind is started and stopped correctly.

Signed-off-by: Jim Fitzpatrick <jfitzpat@redhat.com>
@Boomatang
Boomatang force-pushed the local-setup-fix_patch branch from 76c2a9c to d95cf5e Compare June 25, 2026 17:33

@silvi-t silvi-t left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM, works on macOS with podman/docker.

@silvi-t
silvi-t merged commit 3e3f6cb into silvi-t:local-setup-fix Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants