-
Notifications
You must be signed in to change notification settings - Fork 32
CLOUDP-362015 - Fix IBM Power/Z (ppc64le/s390x) e2e test reliability #654
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
Open
nammn
wants to merge
4
commits into
master
Choose a base branch
from
fix-ibm-docker-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,42 +2,73 @@ | |
|
|
||
| set -Eeou pipefail | ||
|
|
||
| echo "Cleaning DNF cache..." | ||
| sudo dnf clean all && sudo rm -r /var/cache/dnf | ||
|
|
||
| echo "Installing/upgrading crun..." | ||
| sudo dnf upgrade -y crun --disableplugin=subscription-manager || \ | ||
| sudo dnf install -y crun --disableplugin=subscription-manager || \ | ||
| sudo yum upgrade -y crun --disableplugin=subscription-manager || \ | ||
| sudo yum install -y crun --disableplugin=subscription-manager | ||
|
|
||
| if ! crun --version &>/dev/null; then | ||
| echo "❌ crun installation failed" | ||
| exit 1 | ||
| echo "Setting up IBM container runtime (rootful podman for minikube)" | ||
|
|
||
| # Install crun if not present (OCI runtime for cgroup v2) | ||
| if ! command -v crun &>/dev/null; then | ||
| echo "Installing crun..." | ||
| sudo dnf install -y crun --disableplugin=subscription-manager 2>/dev/null || \ | ||
| sudo yum install -y crun --disableplugin=subscription-manager 2>/dev/null || \ | ||
| echo "Warning: Could not install crun" | ||
| else | ||
| echo "crun already installed: $(crun --version | head -1)" | ||
| fi | ||
|
|
||
| current_version=$(crun --version | head -n1) | ||
| echo "✅ Using crun: ${current_version}" | ||
| # Clean up stale container state (safe for shared CI machines) | ||
| cleanup_stale_state() { | ||
| echo "Cleaning up stale container state..." | ||
|
|
||
| # Clean up any existing conflicting configurations | ||
| echo "Cleaning up existing container configurations..." | ||
| rm -f ~/.config/containers/containers.conf 2>/dev/null || true | ||
| sudo rm -f /root/.config/containers/containers.conf 2>/dev/null || true | ||
| sudo rm -f /etc/containers/containers.conf 2>/dev/null || true | ||
| # Skip if minikube is running | ||
| if command -v minikube &>/dev/null && minikube status &>/dev/null 2>&1; then | ||
| echo " Minikube running - skipping cleanup" | ||
| return 0 | ||
| fi | ||
|
|
||
| crun_path=$(which crun) | ||
| echo "Using crun path: ${crun_path}" | ||
| # Kill orphaned root conmon processes (PPID=1 means orphaned) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all of this should be handled by https://jira.mongodb.org/browse/DEVPROD-25447 |
||
| for pid in $(sudo pgrep conmon 2>/dev/null); do | ||
| ppid=$(ps -o ppid= -p "${pid}" 2>/dev/null | tr -d ' ') | ||
| if [[ "${ppid}" == "1" ]]; then | ||
| echo " Killing orphaned conmon ${pid}" | ||
| sudo kill -9 "${pid}" 2>/dev/null || true | ||
| fi | ||
| done | ||
|
|
||
| config="[containers] | ||
| cgroup_manager = \"cgroupfs\" | ||
| # Clean stale lock files (safe since minikube isn't running) | ||
| sudo find /run/crun -name "*.lock" -delete 2>/dev/null || true | ||
|
|
||
| [engine] | ||
| runtime = \"crun\"" | ||
| # Prune exited containers and dangling volumes | ||
| sudo podman container prune -f 2>/dev/null || true | ||
| sudo podman volume prune -f 2>/dev/null || true | ||
| } | ||
|
|
||
| mkdir -p ~/.config/containers | ||
| echo "${config}" > ~/.config/containers/containers.conf | ||
| cleanup_stale_state | ||
|
|
||
| sudo mkdir -p /root/.config/containers | ||
| echo "${config}" | sudo tee /root/.config/containers/containers.conf >/dev/null | ||
| # Test sudo podman (used by minikube in rootful mode) | ||
| echo "Testing sudo podman..." | ||
| if ! sudo podman run --rm docker.io/library/alpine:latest echo "sudo podman works" 2>/dev/null; then | ||
| echo "Sudo podman not working, resetting..." | ||
| sudo podman system reset --force 2>/dev/null || true | ||
| sleep 1 | ||
|
|
||
| if sudo podman run --rm docker.io/library/alpine:latest echo "sudo podman works" 2>/dev/null; then | ||
| echo "Sudo podman working after reset" | ||
| else | ||
| echo "Warning: Sudo podman still not working" | ||
| fi | ||
| else | ||
| echo "Sudo podman working" | ||
| fi | ||
|
|
||
| # Configure root-level podman | ||
| sudo mkdir -p /etc/containers | ||
| sudo tee /etc/containers/containers.conf > /dev/null << 'EOF' | ||
| [containers] | ||
| cgroup_manager = "systemd" | ||
|
|
||
| [engine] | ||
| runtime = "crun" | ||
| EOF | ||
|
|
||
| echo "✅ Configured crun" | ||
| echo "Container runtime setup complete" | ||
| echo " crun: $(crun --version 2>/dev/null | head -1 || echo 'not found')" | ||
| echo " podman: $(sudo podman --version)" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| source scripts/dev/set_env_context.sh | ||
| source scripts/funcs/install | ||
|
|
||
|
|
||
| set -Eeou pipefail | ||
|
|
||
| set_limits() { | ||
|
|
@@ -48,10 +49,10 @@ setup_local_registry_and_custom_image() { | |
| if [[ "${ARCH}" == "ppc64le" ]]; then | ||
| echo ">>> Setting up local registry and custom kicbase image for ppc64le..." | ||
|
|
||
| # Check if local registry is running (with fallback for namespace issues) | ||
| # Check if local registry is running (use 127.0.0.1 to avoid IPv6 fallback delay) | ||
| registry_running=false | ||
| if curl -s http://localhost:5000/v2/_catalog >/dev/null 2>&1; then | ||
| echo "Registry detected via HTTP check (podman ps failed)" | ||
| if curl -s --max-time 5 http://127.0.0.1:5000/v2/_catalog >/dev/null 2>&1; then | ||
| echo "Registry detected via HTTP check" | ||
| registry_running=true | ||
| fi | ||
|
|
||
|
|
@@ -61,15 +62,15 @@ setup_local_registry_and_custom_image() { | |
| # Clean up any existing registry first | ||
| sudo podman rm -f registry 2>/dev/null || true | ||
|
|
||
| if ! sudo podman run -d -p 5000:5000 --name registry --restart=always docker.io/library/registry:2; then | ||
| if ! sudo podman run -d -p 127.0.0.1:5000:5000 --name registry --restart=always docker.io/library/registry:2; then | ||
| echo "❌ Failed to start local registry - trying alternative approach" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Wait for registry to be ready | ||
| echo "Waiting for registry to be ready..." | ||
| for _ in {1..30}; do | ||
| if curl -s http://localhost:5000/v2/_catalog >/dev/null 2>&1; then | ||
| if curl -s --max-time 5 http://127.0.0.1:5000/v2/_catalog >/dev/null 2>&1; then | ||
| break | ||
| fi | ||
| sleep 1 | ||
|
|
@@ -78,31 +79,18 @@ setup_local_registry_and_custom_image() { | |
| echo "✅ Local registry already running" | ||
| fi | ||
|
|
||
| # Configure podman to trust local registry (both user and root level for minikube) | ||
| # Configure podman to trust local registry (rootful only since minikube uses sudo podman) | ||
| echo "Configuring registries.conf to trust local registry..." | ||
|
|
||
| # User-level config | ||
| mkdir -p ~/.config/containers | ||
| cat > ~/.config/containers/registries.conf << 'EOF' | ||
| [[registry]] | ||
| location = "localhost:5000" | ||
| insecure = true | ||
| EOF | ||
|
|
||
| # Root-level config (since minikube uses sudo podman) | ||
| sudo mkdir -p /root/.config/containers | ||
| sudo tee /root/.config/containers/registries.conf << 'EOF' >/dev/null | ||
| [[registry]] | ||
| location = "localhost:5000" | ||
| insecure = true | ||
| EOF | ||
| echo "✅ Registry configuration created" | ||
|
|
||
| echo "✅ Registry configuration created for both user and root" | ||
| custom_image_tag="localhost:5000/kicbase:v0.0.47" | ||
|
|
||
| # Determine image tag | ||
| custom_image_tag="localhost:5000/kicbase:v0.0.47" | ||
| if curl -s http://localhost:5000/v2/kicbase/tags/list | grep -q "v0.0.47"; then | ||
| custom_image_tag="localhost:5000/kicbase:v0.0.48" | ||
| if curl -s --max-time 5 http://127.0.0.1:5000/v2/kicbase/tags/list | grep -q "v0.0.48"; then | ||
| echo "Custom kicbase image already exists in local registry" | ||
| return 0 | ||
| fi | ||
|
|
@@ -113,7 +101,7 @@ EOF | |
| # Build custom kicbase image | ||
| mkdir -p "${PROJECT_DIR:-.}/scripts/minikube/kicbase" | ||
| cat > "${PROJECT_DIR:-.}/scripts/minikube/kicbase/Dockerfile" << 'EOF' | ||
| FROM gcr.io/k8s-minikube/kicbase:v0.0.47 | ||
| FROM gcr.io/k8s-minikube/kicbase:v0.0.48 | ||
| RUN if [ "$(uname -m)" = "ppc64le" ]; then \ | ||
| CRICTL_VERSION="v1.28.0" && \ | ||
| curl -L "https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-ppc64le.tar.gz" \ | ||
|
|
@@ -129,6 +117,21 @@ EOF | |
| echo "Failed to build custom image" | ||
| return 1 | ||
| } | ||
|
|
||
| # Use 127.0.0.1 to avoid IPv6 issues with podman on ppc64le, we might bind to ipv6 and it might not work | ||
| if ! curl -s --max-time 5 http://127.0.0.1:5000/v2/_catalog >/dev/null 2>&1; then | ||
| echo "Registry not responding, restarting..." | ||
| sudo podman rm -f registry 2>/dev/null || true | ||
| sudo podman run -d -p 127.0.0.1:5000:5000 --name registry --restart=always docker.io/library/registry:2 | ||
| for _ in {1..15}; do | ||
| if curl -s --max-time 5 http://127.0.0.1:5000/v2/_catalog >/dev/null 2>&1; then | ||
| echo "Registry restarted successfully" | ||
| break | ||
| fi | ||
| sleep 1 | ||
| done | ||
| fi | ||
|
|
||
| sudo podman push "${custom_image_tag}" --tls-verify=false || { | ||
| echo "Failed to push to registry" | ||
| return 1 | ||
|
|
@@ -139,9 +142,19 @@ EOF | |
| return 0 | ||
| } | ||
|
|
||
| # Start minikube with podman driver | ||
| # Start minikube with podman driver (rootful mode for reliable networking) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minikube requires root podman for changing networking and iptables |
||
| start_minikube_cluster() { | ||
| echo ">>> Starting minikube cluster with podman driver..." | ||
| echo ">>> Starting minikube cluster with podman driver (rootful mode)..." | ||
|
|
||
| if "${PROJECT_DIR:-.}/bin/minikube" status &>/dev/null; then | ||
| echo "✅ Minikube is already running - verifying health..." | ||
| if "${PROJECT_DIR:-.}/bin/minikube" kubectl -- get nodes &>/dev/null; then | ||
| echo "✅ Minikube cluster is healthy - skipping setup" | ||
| return 0 | ||
| else | ||
| echo "⚠️ Minikube running but unhealthy - will recreate" | ||
| fi | ||
| fi | ||
|
|
||
| # Clean up any existing minikube state to avoid cached configuration issues | ||
| echo "Cleaning up any existing minikube state..." | ||
|
|
@@ -153,19 +166,23 @@ start_minikube_cluster() { | |
| echo "Ensuring clean minikube state..." | ||
| "${PROJECT_DIR:-.}/bin/minikube" delete 2>/dev/null || true | ||
|
|
||
| local start_args=("--driver=podman") | ||
| # Clean up stale podman volumes | ||
| echo "Cleaning up stale podman volumes..." | ||
| sudo podman volume rm -f minikube 2>/dev/null || true | ||
| sudo podman network rm -f minikube 2>/dev/null || true | ||
|
|
||
| # Use rootful podman - rootless has iptables/CNI issues on ppc64le and s390x | ||
| local start_args=("--driver=podman" "--container-runtime=containerd" "--rootless=false") | ||
| start_args+=("--cpus=4" "--memory=8g") | ||
| start_args+=("--cni=bridge") | ||
|
|
||
| if [[ "${ARCH}" == "ppc64le" ]]; then | ||
| echo "Using custom kicbase image for ppc64le with crictl..." | ||
|
|
||
| start_args+=("--base-image=localhost:5000/kicbase:v0.0.47") | ||
| start_args+=("--base-image=localhost:5000/kicbase:v0.0.48") | ||
| start_args+=("--insecure-registry=localhost:5000") | ||
| fi | ||
|
|
||
| # Use default bridge CNI to avoid Docker Hub rate limiting issues | ||
| # start_args+=("--cni=bridge") | ||
|
|
||
| echo "Starting minikube with args: ${start_args[*]}" | ||
| if "${PROJECT_DIR:-.}/bin/minikube" start "${start_args[@]}"; then | ||
| echo "✅ Minikube started successfully" | ||
|
|
@@ -194,14 +211,6 @@ else | |
| exit 1 | ||
| fi | ||
|
|
||
| if [[ "${ARCH}" == "ppc64le" ]]; then | ||
| echo "" | ||
| echo ">>> Note: crictl will be patched into the minikube container after startup" | ||
| else | ||
| echo "" | ||
| echo ">>> Using standard kicbase image (crictl included for x86_64/aarch64/s390x)" | ||
| fi | ||
|
|
||
| # Start the minikube cluster | ||
| start_minikube_cluster | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.