Skip to content

Cherry-pick #47099: Fix Fleet startup crash on read-only filesystem without S3 bucket - #47166

Merged
nulmete merged 1 commit into
rc-minor-fleet-v4.87.0from
nulmete/org-logo-readonly-fs-cp-4870
Jun 9, 2026
Merged

Cherry-pick #47099: Fix Fleet startup crash on read-only filesystem without S3 bucket#47166
nulmete merged 1 commit into
rc-minor-fleet-v4.87.0from
nulmete/org-logo-readonly-fs-cp-4870

Conversation

@nulmete

@nulmete nulmete commented Jun 9, 2026

Copy link
Copy Markdown
Member

Cherry-pick of #47099 into the rc-minor-fleet-v4.87.0 RC branch.

Will follow-up with another cherry-pick for the migration re-ordering (since we want to include this in 4.86.2 patch, and there are several migrations before this one and the last in 4.86.1).

…7099)

**Related issue:** Resolves #47090

Fleet crashes into `CrashLoopBackOff` on startup when deployed on
Kubernetes with `readOnlyRootFilesystem: true` and **no** S3 software
installers bucket configured:

```
Failed to start: initializing filesystem org logo store: mkdir /tmp/org-logos: read-only file system
```

I realised I was calling `initFatal` when failing to create a directory
on the filesystem which doesn't match the pattern of `logging` +
`creating a "failing" store` (one that is initialized but fails all
operations) as we do for e.g. software title icons (see
NewFailingSoftwareTitleIconStore).

Per this slack conversation:
https://fleetdm.slack.com/archives/C084F4MKYSJ/p1780931127976389, we
decided to fall back to a database-backed storage:

<img width="737" height="114" alt="Screenshot 2026-06-08 at 3 16 28 PM"
src="https://github.com/user-attachments/assets/2a6ff75f-b382-40ba-81d9-3be3cfbd648a"
/>


# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/`.

## Testing

- [x] Added/updated automated tests
- [x] QA'd all new/changed functionality manually

Commented out this line to force filesystem usage:

<img width="615" height="71" alt="Screenshot 2026-06-08 at 1 18 53 PM"
src="https://github.com/user-attachments/assets/85043c88-5c8c-48a0-8145-098fba9513bd"
/>


#### Before

Server crashes

<img width="1278" height="124" alt="Screenshot 2026-06-08 at 1 18 17 PM"
src="https://github.com/user-attachments/assets/7b788a24-131a-47a3-8580-fcd9fda8b449"
/>


#### After

Server starts and logo upload works

- Without --dev_license



https://github.com/user-attachments/assets/58c5ebf9-cf52-4ba0-ac98-9675e7eef92c



- With --dev_license




https://github.com/user-attachments/assets/117bb812-31bd-4849-927c-93cafd1a71d7








<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

* **New Features**
- Organization logos now support database storage as the fallback option
when S3 software installers bucket is not configured, replacing local
filesystem storage for improved reliability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@nulmete
nulmete marked this pull request as ready for review June 9, 2026 12:41
@nulmete
nulmete requested a review from a team as a code owner June 9, 2026 12:41
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.83333% with 14 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (rc-minor-fleet-v4.87.0@d1f6ab0). Learn more about missing BASE report.

Files with missing lines Patch % Lines
server/datastore/mysql/org_logo_store.go 70.96% 5 Missing and 4 partials ⚠️
...ations/tables/20260608173427_CreateOrgLogoTable.go 69.23% 3 Missing and 1 partial ⚠️
cmd/fleet/serve.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##             rc-minor-fleet-v4.87.0   #47166   +/-   ##
=========================================================
  Coverage                          ?   67.17%           
=========================================================
  Files                             ?     2910           
  Lines                             ?   226171           
  Branches                          ?    11828           
=========================================================
  Hits                              ?   151924           
  Misses                            ?    60508           
  Partials                          ?    13739           
Flag Coverage Δ
backend 68.80% <70.83%> (?)

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

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nulmete
nulmete merged commit 9258565 into rc-minor-fleet-v4.87.0 Jun 9, 2026
34 checks passed
@nulmete
nulmete deleted the nulmete/org-logo-readonly-fs-cp-4870 branch June 9, 2026 13:21
nulmete added a commit that referenced this pull request Jun 9, 2026
Cherry-pick of #47168 into the `rc-minor-fleet-v4.87.0` RC branch.

Follows the cherry-pick of #47099 (#47166, already merged here). This
re-timestamps the `CreateOrgLogoTable` migration `20260608173427` →
`20260527215818` so it sorts immediately after
`AddHostCertificatesOriginDeletedAtIndex`(required so the same migration
can also ship in the 4.86.2 patch without breaking the 4.86.2 → 4.87.0
upgrade path).

Note: `schema.sql` conflicted (main regenerated it against main's
migration set, which differs from this RC branch) because
[20260608202705_AddVulnPerfIndexes.go](https://github.com/fleetdm/fleet/blob/main/server/datastore/mysql/migrations/tables/20260608202705_AddVulnPerfIndexes.go)
and
[20260608210432_CleanupSoftwareLastOpenedAtSentinels.go](https://github.com/fleetdm/fleet/blob/main/server/datastore/mysql/migrations/tables/20260608210432_CleanupSoftwareLastOpenedAtSentinels.go)
are not part of the RC branch yet (looks like the PRs that introduced
them on main have not been cherry-picked yet).
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.

2 participants