Skip to content

client: allow daemon to run as non-root with init-created dirs#121

Merged
krockpot merged 2 commits intopinterest:masterfrom
krockpot:daemon-non-root-k8s-sidecar
Mar 13, 2026
Merged

client: allow daemon to run as non-root with init-created dirs#121
krockpot merged 2 commits intopinterest:masterfrom
krockpot:daemon-non-root-k8s-sidecar

Conversation

@krockpot
Copy link
Contributor

Allow the Knox client daemon to run as non-root when used as a K8s sidecar with an init container that creates /var/lib/knox and sets permissions.

  • chmodIfNeeded: only chmod when current perms differ from desired, avoiding "operation not permitted" when the init container already set correct permissions
  • ensureDirExists: succeed when path already exists (e.g. created by init) so MkdirAll permission failure does not crash the sidecar
  • Table-driven tests for both helpers

Made with Cursor

Jeremy Talis added 2 commits March 13, 2026 17:34
- chmodIfNeeded: only chmod when current perms differ from desired, avoiding
  'operation not permitted' when init container already set correct permissions
- ensureDirExists: succeed when path already exists (e.g. created by init)
  so MkdirAll permission failure does not crash the sidecar
- Add table-driven tests for both helpers

Made-with: Cursor
…ts in daemon.go

Keep chmodIfNeeded/ensureDirExists and use master's error style (%w, lowercase).

Made-with: Cursor
@krockpot krockpot requested review from csstaub and xia0pin9 March 13, 2026 17:51
@krockpot krockpot merged commit 7da90d8 into pinterest:master Mar 13, 2026
1 check passed
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