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

Can not set DeleteEmptyDirData to true, even with delete_local_data: true in node_drain_input #3412

Closed
leqduyvp opened this issue Oct 16, 2023 · 3 comments
Assignees
Milestone

Comments

@leqduyvp
Copy link

leqduyvp commented Oct 16, 2023

RKE version: 1.3.23

Steps to Reproduce:
Set the upgrade_strategy as below:

upgrade_strategy:
  max_unavailable_worker: 1
  max_unavailable_controlplane: 1
  drain: true
  node_drain_input:
    force: false
    ignore_daemonsets: true
    delete_local_data: true

Results:
Log of drain command param
Parameters provided to drain command: "Force: false, IgnoreAllDaemonSets: true, DeleteEmptyDirData: false, Timeout: 2m0s, GracePeriodSeconds: -1"


It's weird that if I add grace_period and timeout config as below, DeleteEmptyDirData is set to true as expected:

upgrade_strategy:
  max_unavailable_worker: 1
  max_unavailable_controlplane: 1
  drain: true
  node_drain_input:
    force: false
    ignore_daemonsets: true
    delete_local_data: true
    grace_period: -1
    timeout: 1200

Results:
Log of drain command param
Parameters provided to drain command: "Force: false, IgnoreAllDaemonSets: true, DeleteEmptyDirData: true, Timeout: 20m0s, GracePeriodSeconds: -1"

@jiaqiluo
Copy link
Member

jiaqiluo commented Feb 22, 2024

Cause

In the declaration of the type NodeDrainInput (here), the name of the same field is different in the YAML format v.s. JSON format:

  • ignore_daemonsets v.s. ignoreDaemonSets
  • delete_local_data v.s. deleteLocalData
  • grace_period v.s gracePeriod

In the function parseNodeDrainInput, RKE uses ghodssyaml.Unmarshal and ghodssyaml.Marshal to covert the user's config into the NodeDrainInput object. those two functions internally use json.Marshal and json.Unmarshal to do the convention. However because the names of the same field are different, those values are dropped in the final output. This is also why there is inline comment about ghodssyaml.Marshal is losing the user-provided value for GracePeriod.

@jiaqiluo
Copy link
Member

jiaqiluo commented Mar 2, 2024

this issue can be validated in RKE v1.5.7-rc3

For validating the fix, please check the testing section in the PR

@zube zube bot removed the [zube]: Review label Mar 2, 2024
@jiaqiluo jiaqiluo added this to the v1.5.7 milestone Mar 26, 2024
@Josh-Diamond Josh-Diamond self-assigned this Mar 26, 2024
@Josh-Diamond
Copy link

Ticket #3412 - Test Results - ✅

Verified with RKE v1.5.7-rc3 and k8s v1.27.11-rancher1-1 => v1.28.7-rancher1-1:

  1. Using RKE v1.5.7-rc3, provision a k8s v1.27.11-rancher1-1 cluster with the following configurations set in the cluster.yml for the upgrade_strategy:
upgrade_strategy:
  max_unavailable_worker: 1
  max_unavailable_controlplane: 1
  drain: true
  node_drain_input:
    force: false
    ignore_daemonsets: true
    delete_local_data: true
  1. Once cluster is active, upgrade the k8s version to v1.28.7-rancher1-1
  2. Verified - the following log is seen when upgrading the cluster; as expected
INFO[0051] [controlplane] Processing controlplane hosts for upgrade 1 at a time
INFO[0051] [controlplane] Parameters provided to drain command: "Force: false, IgnoreAllDaemonSets: true, DeleteEmptyDirData: true, Timeout: 2m0s, GracePeriodSeconds: -1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants