Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubeadm: reset raises warnings if it cannot delete folders #85265

Merged
merged 1 commit into from Nov 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/kubeadm/app/cmd/phases/reset/cleanupnode.go
Expand Up @@ -128,7 +128,7 @@ func resetConfigDir(configPathDir, pkiPathDir string) {
fmt.Printf("[reset] Deleting contents of config directories: %v\n", dirsToClean)
for _, dir := range dirsToClean {
if err := CleanDir(dir); err != nil {
klog.Warningf("[reset] Failed to remove directory: %q [%v]\n", dir, err)
klog.Warningf("[reset] Failed to delete contents of %q directory: %v", dir, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we are changing this log message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because CleanDir doesn't remove the folder, it removes the contents of the folder.
Ref: https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/cmd/phases/reset/cleanupnode.go#L150

}
}

Expand Down
6 changes: 4 additions & 2 deletions cmd/kubeadm/app/cmd/reset.go
Expand Up @@ -215,8 +215,10 @@ func NewCmdReset(in io.Reader, out io.Writer, resetOptions *resetOptions) *cobra
func cleanDirs(data *resetData) {
fmt.Printf("[reset] Deleting contents of stateful directories: %v\n", data.dirsToClean)
for _, dir := range data.dirsToClean {
klog.V(1).Infof("[reset] Deleting content of %s", dir)
phases.CleanDir(dir)
klog.V(1).Infof("[reset] Deleting contents of %s", dir)
if err := phases.CleanDir(dir); err != nil {
klog.Warningf("[reset] Failed to delete contents of %q directory: %v", dir, err)
}
}
}

Expand Down