Fix/yurthub uninstall idempotency#2514
Conversation
When the NodeAutonomy condition status changes, LastTransitionTime was never updated due to a copy-paste bug where LastHeartbeatTime was set twice instead of setting LastTransitionTime on the second line. This caused stale transition timestamps in the node condition, breaking observability, alerting, and debugging for edge node autonomy state changes. Signed-off-by: Aman-Cool <aman017102007@gmail.com>
|
@vie-serendipity @zyjhtangtang ,Tiny edge-case fix: uninstall was exiting early if the config dir was already gone, silently leaving stale cache behind—this makes uninstall truly clean and idempotent. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2514 +/- ##
==========================================
+ Coverage 44.09% 44.27% +0.17%
==========================================
Files 399 399
Lines 26554 26593 +39
==========================================
+ Hits 11710 11775 +65
+ Misses 13782 13752 -30
- Partials 1062 1066 +4
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:
|
|
@Aman-Cool Please focus on the blocking issues in the code detection. |
Add tests to improve coverage for kubelet.go and yurthub.go: - Add TestUndoWriteYurthubKubeletConfig_FileNotExists/FileExists to cover the undo cleanup path in kubelet.go - Add yurthub_test.go with tests for UnInstall cleanup logic: - TestGetYurthubYaml, TestGetYurthubConf, TestGetYurthubCacheDir - TestNewYurthubOperator - TestYurthubYamlCleanup_FileNotExists/FileExists - TestYurthubConfDirCleanup_DirNotExists/DirExists - TestCacheDirCleanup
1812483 to
5e4bfdf
Compare
|
|
@zyjhtangtang ,CI is green now. Thanks for the feedback. |
|
@zyjhtangtang Hi, just a gentle follow-up. I’ve addressed the coverage issues and CI is green now. |



Summary
Fixes a broken idempotency bug in
UnInstall()where an early return skips YurtHub process shutdown and cache cleanup when the config directory is missing.Problem
If
/var/lib/yurthubdoes not exist (common after partial or interrupted uninstalls),UnInstall()returns success early and leaves/etc/kubernetes/cache/intact. On reinstall, YurtHub reuses stale cached data.Fix
Remove the early return.
Skip config deletion if missing, but always wait for YurtHub to exit and clean the cache directory.
Impact
Small, safe change (~5 lines) with no behavior regression.