Fix issue with fleet's docker image in k8s environments - #44373
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
There was a problem hiding this comment.
Pull request overview
This PR addresses Fleet server startup failures in containerized/Kubernetes environments caused by init-time side effects from the github.com/AbGuthrie/goquery/v2 dependency being transitively linked into the Fleet server binary via the fleetctl package.
Changes:
- Isolates the
goqueryimplementation into agoquerycmdsubpackage sogoquery’s init-time side effects are only linked into thefleetctlbinary. - Adds a runner registration hook (
SetGoqueryRunner) sofleetctl goqueryremains available without importinggoqueryin the sharedfleetctlpackage. - Adds a user-visible changes entry describing the fix.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/fleetctl/main.go | Registers the goquery runner in the fleetctl binary entrypoint to keep goquery out of other binaries. |
| cmd/fleetctl/fleetctl/goquerycmd/goquery.go | New isolated implementation of the fleetctl goquery REPL and Fleet-backed client adapter. |
| cmd/fleetctl/fleetctl/goquery.go | Removes direct goquery imports; introduces SetGoqueryRunner and a nil-checking dispatcher. |
| changes/44298-fix-goquery-dependency-side-effects | Records the user-visible fix for the container startup issue. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Caution Review failedAn error occurred during the review process. Please try again later. WalkthroughThe PR refactors the ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #44373 +/- ##
==========================================
- Coverage 66.79% 66.79% -0.01%
==========================================
Files 2631 2632 +1
Lines 211455 211466 +11
Branches 9543 9543
==========================================
+ Hits 141240 141245 +5
- Misses 57378 57385 +7
+ Partials 12837 12836 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Resolves #44298 - [X] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. ## Testing - [X] QA'd all new/changed functionality manually 1. Running the docker image pushed by this PR with the user 3333 doesn't fail anymore: ```sh docker run --platform linux/amd64 -it --user 3333:3333 fleetdm/fleet@sha256:1a06bcae25e13e37f871378c7c156f5a2cdf67bc3c3e3bcdc95b6afc0c6decbb [...] ts=2026-04-29T13:25:56Z level=warn msg="could not connect to db" err="dial tcp [::1]:3306: connect: connection refused" sleep_interval=0s [...] ``` 4.84.0 fails with: ```sh docker run --platform linux/amd64 -it --user 3333:3333 fleetdm/fleet:v4.84.0@sha256:51b56ad59a840b28e074ff9b06d6d5b232b0ca2f0d999bb164820da69c7cbe15 Failed to fetch user info for home directory: user: unknown userid 33332026/04/29 13:28:08 71 <nil> ``` 2. `strings ./build/fleet | rg github.com/AbGuthrie/goquery/v2` returns nothing in this branch and returns plenty of matches in `main`. 3. Smoke tested `fleetctl goquery` functionality. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Resolved Docker image startup failures in Kubernetes environments caused by a dependency side effect. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- **Adding vpp users table** - **Adding ManagedAppleID to HostMDM tables to pull when installing vpp apps to a BYOD user enrolled device** - **Adding user create vpp apis** - **Updating install application to support user enrolled devices** - **Handling already installed gracefully** - **Adding provision user logic** - **Adding logic to associate assets on install** - **Add license managemnt logic** - **Adding self service ui** - **Adding setup experience support** - **Adding setup experience flow** - **Fix issue with fleet's docker image in k8s environments (#44373)** - **Changing how the appleid is captured to use idp mdm users** <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Account-based User Enrollment (iOS/iPadOS) supports VPP and in‑house .ipa installs, including self‑service installs. * Enrollment now applies the selected Setup experience automatically for user‑enrolled hosts. * Installs and license associations are scoped to account user associations (user‑scoped installs). * **Bug Fixes** * Improved error messaging for license/association failures (including per‑user device cap cases). * Mobile UI: self‑service now shows user‑enrolled iOS/iPadOS apps. * “Already installed” install results are treated as acknowledged successes. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/fleetdm/fleet/pull/45202) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Resolves #44298
changes/,orbit/changes/oree/fleetd-chrome/changes.Testing
4.84.0 fails with:
strings ./build/fleet | rg github.com/AbGuthrie/goquery/v2returns nothing in this branch and returns plenty of matches inmain.fleetctl goqueryfunctionality.Summary by CodeRabbit