Skip to content

hack/setup-dev-base.sh: Add Docker daemon and resource pre-flight validation#7281

Open
Krishiv-Mahajan wants to merge 5 commits intokarmada-io:masterfrom
Krishiv-Mahajan:docker_demon
Open

hack/setup-dev-base.sh: Add Docker daemon and resource pre-flight validation#7281
Krishiv-Mahajan wants to merge 5 commits intokarmada-io:masterfrom
Krishiv-Mahajan:docker_demon

Conversation

@Krishiv-Mahajan
Copy link
Copy Markdown
Contributor

@Krishiv-Mahajan Krishiv-Mahajan commented Mar 12, 2026

What type of PR is this?
/kind bug

What this PR does / why we need it:
The script only verified that the Docker binary existed via util::cmd_must_exist "docker" but did not validate that the Docker daemon was actually running or that sufficient resources were allocated. On macOS, Docker Desktop must be started manually — the CLI can exist without the daemon running. This caused the script to proceed through all setup steps and fail much later at util::create_cluster with a cryptic socket error, wasting the user's time.
This PR adds a pre-flight validation block that:

  • Verifies the Docker daemon is running — exits immediately with a clear, actionable, OS-aware error message if not
  • Checks Docker has sufficient resources (4 GB memory, 2 CPUs) — warns if below recommended levels without hard failing

Which issue(s) this PR fixes:
Fixes #7280
Part of #7269

Special notes for your reviewer:
The resource check is a warning only — it does not hard fail — to avoid blocking users who may have intentionally constrained their Docker Desktop resources.

Does this PR introduce a user-facing change?:
releasehack/local-up-karmada.sh: Added pre-flight Docker daemon and resource validation to surf

@karmada-bot karmada-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. labels Mar 12, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the setup-dev-base.sh script by introducing robust pre-flight validations for Docker. The primary goal is to improve the developer experience by catching common Docker-related setup issues early, such as a non-running daemon or insufficient resources, which previously led to cryptic errors much later in the setup process. These additions ensure a smoother and more informative initial setup for development environments.

Highlights

  • Docker Daemon Validation: Implemented a pre-flight check to verify if the Docker daemon is actively running. If not, the script now exits immediately with a clear, OS-aware error message, preventing later failures.
  • Docker Resource Checks: Added checks for Docker's allocated memory (recommended 4GB) and CPU count (recommended 2+). The script now issues warnings if these resources fall below recommended levels, without hard failing, to inform users about potential performance impacts.
Changelog
  • hack/setup-dev-base.sh
    • Added a check to ensure the Docker daemon is running, exiting with an error if it's not.
    • Included OS-specific guidance for starting Docker Desktop on macOS.
    • Implemented checks for Docker's total allocated memory and CPU count.
    • Added warning messages if Docker's memory is less than 4GB or CPU count is less than 2.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@karmada-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign liangyuanpeng for approval. For more information see the Code Review Process.

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

Details 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

@karmada-bot karmada-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 12, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the development setup script by adding pre-flight checks for the Docker daemon's status and resource allocation. This is a valuable improvement that will help developers identify environment issues early. The implementation is straightforward. I've added a couple of suggestions to improve the robustness of the resource checks against potential empty values, preventing script failures in edge cases.

@karmada-bot karmada-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 12, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 12, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.03%. Comparing base (3258024) to head (65b1ee7).
⚠️ Report is 3 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7281      +/-   ##
==========================================
+ Coverage   42.02%   42.03%   +0.01%     
==========================================
  Files         874      874              
  Lines       53547    53547              
==========================================
+ Hits        22502    22509       +7     
+ Misses      29353    29346       -7     
  Partials     1692     1692              
Flag Coverage Δ
unittests 42.03% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Krishiv-Mahajan Krishiv-Mahajan marked this pull request as ready for review March 13, 2026 11:37
Copilot AI review requested due to automatic review settings March 13, 2026 11:37
@karmada-bot karmada-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 13, 2026
@karmada-bot karmada-bot requested a review from chaosi-zju March 13, 2026 11:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Docker pre-flight checks to hack/setup-dev-base.sh so the script fails fast when Docker isn’t usable and can warn when Docker Desktop resources are under-provisioned, improving the local dev setup experience (notably on macOS).

Changes:

  • Verify Docker daemon connectivity early (with OS-aware guidance on failure).
  • Inspect Docker-reported memory/CPU and accumulate warnings when below recommended thresholds.
  • Print collected Docker resource warnings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Krishiv-Mahajan and others added 5 commits March 13, 2026 17:31
Signed-off-by: Krishiv-Mahajan <mahajankrishiv10@gmail.com>
Signed-off-by: Krishiv-Mahajan <mahajankrishiv10@gmail.com>
…hmetic errors

Signed-off-by: Krishiv-Mahajan <mahajankrishiv10@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Krishiv-Mahajan <mahajankrishiv10@gmail.com>
Signed-off-by: Krishiv-Mahajan <mahajankrishiv10@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hack/setup-dev-base.sh: Add macOS pre-flight validation for Docker daemon and resources

4 participants