Skip to content

Conversation

@irakibul7
Copy link

@irakibul7 irakibul7 commented Aug 17, 2025

What

  • Update Kind installation to detect OS (Linux vs macOS) and CPU architecture.
  • On macOS (Darwin), download the appropriate Kind binary:
    • Intel (x86_64): kind-darwin-amd64
    • Apple Silicon (arm64): kind-darwin-arm64
  • On Linux, retain existing logic for:
    • x86_64: kind-linux-amd64
    • arm64/aarch64: kind-linux-arm64

Why

The previous script handled only Linux binaries. On macOS, the install failed because the Linux binary was fetched.

Scope

Only the Kind installation section was changed. Docker and kubectl installation flows remain unchanged.

Summary by CodeRabbit

  • New Features
    • Installer now auto-detects OS and CPU architecture.
    • Adds native support for Linux (amd64, arm64) and macOS (Intel, Apple Silicon).
  • Improvements
    • Uses platform-specific Kind binaries for more reliable installs.
    • Provides clear error messages for unsupported platforms.
    • Keeps post-install steps and success messaging consistent.

@coderabbitai
Copy link

coderabbitai bot commented Aug 17, 2025

Walkthrough

Introduces OS- and architecture-aware branching in kind-cluster/install.sh to download the correct Kind binary for Linux (amd64/arm64) and macOS (amd64/arm64). Unsupported OS/ARCH combinations now exit with an error. Post-download steps (chmod, move to /usr/local/bin, success messages) remain.

Changes

Cohort / File(s) Summary
OS/ARCH-aware Kind installer
kind-cluster/install.sh
Added uname-based OS/ARCH detection; mapped Linux/macOS to amd64/arm64-specific Kind binaries; added explicit unsupported OS/ARCH exits; retained installation steps (chmod +x, move to /usr/local/bin).

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant S as install.sh
    participant OS as OS/ARCH Detector
    participant GH as GitHub Kind Releases
    participant BIN as /usr/local/bin

    U->>S: Run install.sh
    S->>OS: Detect uname -s / uname -m
    OS-->>S: OS, ARCH
    alt Supported combo
        S->>GH: Download kind-{os}-{arch}
        GH-->>S: Binary
        S->>S: chmod +x kind
        S->>BIN: mv kind -> /usr/local/bin/kind
        S-->>U: Print success message
    else Unsupported
        S-->>U: Print unsupported OS/ARCH and exit
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I hopped through shells with nimble care,
Sniffed OS winds and ARCHy air.
For Linux, Mac—right burrow found,
The Kind I fetched now hops around.
If strange terrains, I thump and bail—
A cautious bun who will not fail.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
kind-cluster/install.sh (1)

65-71: kubectl download is hardcoded to Linux/amd64; breaks on Linux arm64 and macOS

This will install the wrong binary on arm64 Linux and will be incorrect for macOS. Reuse OS/ARCH detection to fetch the correct artifact. Also, drop -o/-g flags for broader portability (macOS doesn’t use group root by default).

-if ! command -v kubectl &>/dev/null; then
-  echo "📦 Installing kubectl (latest stable version)..."
-
-  curl -LO "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
-  sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
-  rm -f kubectl
-
-  echo "✅ kubectl installed successfully."
+if ! command -v kubectl &>/dev/null; then
+  echo "📦 Installing kubectl (latest stable version)..."
+  case "$OS" in
+    Linux)  K_OS="linux" ;;
+    Darwin) K_OS="darwin" ;;
+    *) echo "❌ Unsupported OS for kubectl: $OS"; exit 1 ;;
+  esac
+
+  case "$ARCH" in
+    x86_64)           K_ARCH="amd64" ;;
+    aarch64|arm64)    K_ARCH="arm64" ;;
+    *) echo "❌ Unsupported architecture for kubectl: $ARCH"; exit 1 ;;
+  esac
+
+  K_VERSION="$(curl -fsSL https://dl.k8s.io/release/stable.txt)"
+  curl -fLo kubectl "https://dl.k8s.io/release/${K_VERSION}/bin/${K_OS}/${K_ARCH}/kubectl"
+  sudo install -m 0755 kubectl /usr/local/bin/kubectl
+  rm -f kubectl
+  echo "✅ kubectl installed successfully."
🧹 Nitpick comments (5)
kind-cluster/install.sh (5)

32-50: Kind: OS/ARCH branching and URLs look correct for v0.29.0; add curl -f for HTTP error handling

The Linux/macOS matrices and artifact names are right. To fail fast on HTTP errors (e.g., 404), use curl -f so the script exits under set -e if a download URL is wrong or a network issue returns an HTTP error page.

Apply this minimal hardening:

-      curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.29.0/kind-linux-amd64
+      curl -fLo ./kind https://kind.sigs.k8s.io/dl/v0.29.0/kind-linux-amd64
@@
-      curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.29.0/kind-linux-arm64
+      curl -fLo ./kind https://kind.sigs.k8s.io/dl/v0.29.0/kind-linux-arm64
@@
-      curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.29.0/kind-darwin-amd64
+      curl -fLo ./kind https://kind.sigs.k8s.io/dl/v0.29.0/kind-darwin-amd64
@@
-      curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.29.0/kind-darwin-arm64
+      curl -fLo ./kind https://kind.sigs.k8s.io/dl/v0.29.0/kind-darwin-arm64

Optional: verify checksums to guard against partial/corrupt downloads. I can provide a snippet if you want to add that.


55-57: Prefer install over mv/chmod for correct mode and atomicity

install sets the mode and copies in one step; avoids an extra chmod and is more portable.

-  chmod +x ./kind
-  sudo mv ./kind /usr/local/bin/kind
+  sudo install -m 0755 ./kind /usr/local/bin/kind
+  rm -f ./kind

14-25: Docker install is Linux-specific; script will fail on macOS before reaching the Kind section

Homebrew/Apple silicon users won’t have apt-get, so this block will error on macOS despite the new macOS support for Kind. If the intent is “Kind on macOS” but “Docker only on Linux,” gate this block by OS.

-# ----------------------------
-# 1. Install Docker
-# ----------------------------
-if ! command -v docker &>/dev/null; then
+# ----------------------------
+# 1. Install Docker (Linux only)
+# ----------------------------
+if [ "$OS" = "Linux" ]; then
+  if ! command -v docker &>/dev/null; then
   echo "📦 Installing Docker..."
   sudo apt-get update -y
   sudo apt-get install -y docker.io
@@
   echo "✅ Docker installed and user added to docker group."
-else
-  echo "✅ Docker is already installed."
-fi
+  else
+    echo "✅ Docker is already installed."
+  fi
+else
+  echo "⏭️ Skipping Docker installation on $OS. Install Docker via Docker Desktop or your OS package manager."
+fi

80-85: Version summary can abort the script under set -e if a tool is missing

If Docker is intentionally skipped on macOS (or kubectl/kind not installed), these lines will exit the script due to set -e. Consider guarding with command -v to keep the summary informative and non-fatal.

-docker --version
-kind --version
-kubectl version --client --output=yaml
+command -v docker   >/dev/null 2>&1 && docker --version   || echo "ℹ️ Docker not found in PATH"
+command -v kind     >/dev/null 2>&1 && kind --version     || echo "ℹ️ kind not found in PATH"
+command -v kubectl  >/dev/null 2>&1 && kubectl version --client --output=yaml || echo "ℹ️ kubectl not found in PATH"

32-50: Optional: reduce duplication via small helpers for OS/ARCH mapping

Not required, but you can map uname values once to normalized values (e.g., AMD64 vs arm64) and reuse for both Kind and kubectl URLs.

If you’d like, I can propose a small normalize_arch() and normalize_os() shell snippet to DRY this up.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 76a0375 and def5825.

📒 Files selected for processing (1)
  • kind-cluster/install.sh (2 hunks)
🔇 Additional comments (1)
kind-cluster/install.sh (1)

8-10: Good baseline: explicit OS/ARCH detection added

Using uname to derive OS and CPU architecture is correct and enables the new branching logic later in the script.

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.

1 participant