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

Conversation

SataQiu
Copy link
Member

@SataQiu SataQiu commented Nov 14, 2019

What type of PR is this?
/kind bug
/kind feature

What this PR does / why we need it:
kubeadm: reset raises warnings if it cannot delete folders

Which issue(s) this PR fixes:

Fixes kubernetes/kubeadm#1914

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

kubeadm: reset raises warnings if it cannot delete folders

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubeadm sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 14, 2019
@@ -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)
fmt.Printf("[reset] WARNING: Failed to delete contents of %q directory: [%v]\n", dir, err)
Copy link
Member Author

Choose a reason for hiding this comment

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

Reasons for using fmt.Printf kubernetes/kubeadm#1913

Copy link
Member

Choose a reason for hiding this comment

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

Should it be klog.V(1).Warningf? [1]

Copy link
Member Author

Choose a reason for hiding this comment

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

Not quite sure! But does klog support klog.V(1).Warningf?
I didn't find that usage from the code base (only klog.Warningf could be found).
I believe the necessary warnings should be displayed by default. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

In klog, log levels exist and are applicable only to the "info" severity. :)

Copy link
Member

Choose a reason for hiding this comment

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

the discussion in kubernetes/kubeadm#1913
is not clear yet. if users don't want klog output they can always pipe it to /dev/null as its printed to stderr.

let's keep the klog.Warningf for now and change all of those in a single PR once we decide after the discussion in kubernetes/kubeadm#1913

other than this LGTM

@SataQiu
Copy link
Member Author

SataQiu commented Nov 14, 2019

/test pull-kubernetes-node-e2e-containerd

Copy link
Member

@yagonobre yagonobre left a comment

Choose a reason for hiding this comment

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

Thanks @SataQiu
/priority important-longterm

@@ -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)
fmt.Printf("[reset] WARNING: Failed to delete contents of %q directory: [%v]\n", 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.

Should it be klog.V(1).Warningf? [1]

phases.CleanDir(dir)
klog.V(1).Infof("[reset] Deleting contents of %s", dir)
if err := phases.CleanDir(dir); err != nil {
fmt.Printf("[reset] WARNING: Failed to delete contents of %q directory: [%v]\n", 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.

[1]

@k8s-ci-robot k8s-ci-robot added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Nov 14, 2019
@SataQiu
Copy link
Member Author

SataQiu commented Nov 14, 2019

/test pull-kubernetes-node-e2e-containerd

@@ -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\n", 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.

btw \n are not needed for klog entries, they are on separate lines always.

@SataQiu
Copy link
Member Author

SataQiu commented Nov 16, 2019

/test pull-kubernetes-node-e2e-containerd

@@ -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

Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
let's wait for code freeze to lift.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 19, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: neolit123, SataQiu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 19, 2019
@k8s-ci-robot k8s-ci-robot merged commit f01a4d0 into kubernetes:master Nov 23, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubeadm cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubeadm reset does not warn if it cannot delete folders
4 participants