Repository navigation
Avoid restarting the Tilt hub for unchanged kind kubeconfigs - #1056
Merged
Merged
Conversation
Collaborator
|
@mjudeikis-bot review |
mjudeikis
reviewed
Nov 12, 2026
mjudeikis
left a comment
Contributor
There was a problem hiding this comment.
No issues found.
The change matches the PR description. A no-op refresh no longer calls chmod when the mode is already 0600. Changed contents still go through the atomic mkstemp/fsync/os.replace path. Wrong modes, including setuid, are still repaired.
Checked
- Read beyond the diff: all of
hack/scripts/write-kind-kubeconfig.pyand both callers, Makefile:1253 (kind-up-style target) and Makefile:2755 (existing-cluster branch). Also the Makefile test target at line 1239. - Correctness:
stat.S_IMODEkeeps the special bits, so 04600 != 0600 and triggers a chmod. Symlinks are excluded by the existingis_symlink()guard, sopath.stat()never follows one. The changed-content path is unchanged, andmkstempcreates the file at 0600. Nothing wrong found. - Concurrency: the stat-then-chmod gap is a TOCTOU, but the only effect is an extra repair chmod, which is harmless. Not applicable beyond that.
- Tenancy/kcp, provider contract, API/codegen, portal: not applicable. This is a dev-only Python script with no Go, API, manifest or portal change.
- Security: the kubeconfig stays private, and permission repair is preserved and tested for 0644 and 04600. No credentials are logged.
- Tests:
test_unchanged_private_config_emits_no_watch_eventwould fail on the old code, because chmod to the same mode emits IN_ATTRIB.test_unchanged_content_still_repairs_permissionscovers the repair path. Both are Linux-specific, and the inotify test is correctly skipped elsewhere. - Ran:
python3 -I hack/scripts/write-kind-kubeconfig.test.pygave 6 tests OK.make test-dev-browsergave 20 tests OK. - Did not run: Go
make build/vet/lintandverify-*targets, because no Go, API, chart or portal file changed. No e2e suite, because the change is dev tooling covered by the unit tests above. The real-Tilt inode/event claim in the PR body was not reproduced here.
cwilhit
force-pushed
the
codex/preview-kubeconfig-noop
branch
from
November 12, 2026 00:33
7c9ed7d to
35c816e
Compare
e2e-infrastructure-up refreshed an existing cluster's kubeconfig with a shell redirect: not atomic, always a write event, and left at the umask mode. Use write-kind-kubeconfig.py there too. The no-event regression test only ran on Linux, while make tilt runs on macOS. Add a test on every platform that an unchanged refresh keeps the inode, ctime and mtime. Name the inotify mask bits and report errno when watch setup fails. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cwilhit
marked this pull request as ready for review
November 12, 2026 03:30
cwilhit
added a commit
that referenced
this pull request
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repeated kind bootstrap calls change kubeconfig metadata even when its contents and permissions already match. Tilt observes the chmod event and restarts the embedded hub while provider registration is running, producing transient OpenAPI and connection failures.
Skip chmod when the file is already private. Keep atomic replacement for changed contents and permission repair, including special mode bits.
e2e-infrastructure-upnow refreshes an existing cluster's kubeconfig with the same writer instead ofkind get kubeconfig > …, so that file is also written atomically, kept at 0600 and left alone when unchanged. A new writer test checks on every platform, including macOS, that an unchanged refresh keeps the inode, ctime and mtime; the inotify test stays Linux-only.Validation:
make test-dev-browser(6 writer tests, 20 browser setup tests); a real owned-kind no-op refresh emitted zero filesystem events and preserved inode, mtime and ctime. After the follow-up commit, the 7 writer tests pass on macOS (inotify test skipped) and on Linux in apython:3.13-slimcontainer, and the new metadata test fails when the unconditional chmod is restored.