Skip to content

Commit

Permalink
Merge pull request #3511 from jiaqiluo/fix-node-drain
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaqiluo committed Mar 1, 2024
2 parents e8aea49 + 2d51c6f commit 9a498c6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,15 @@ func parseNodeDrainInput(clusterFile string, rkeConfig *v3.RancherKubernetesEngi
nodeDrainInput.GracePeriod = DefaultNodeDrainGracePeriod
update = true
} else {
// TODO: ghodssyaml.Marshal is losing the user provided value for GracePeriod, investigate why, till then assign the provided value explicitly
// add back user's value because ghodssyaml.Marshal drops the value due to the same field has different names in YAML tag and JSON tag
nodeDrainInput.GracePeriod = int(providedGracePeriod)
}

// add back user's value because ghodssyaml.Marshal drops the value due to the same field has different names in YAML tag and JSON tag
if val, ok := nodeDrainInputMap["delete_local_data"].(bool); ok {
nodeDrainInput.DeleteLocalData = val
}

if update {
rkeConfig.UpgradeStrategy.DrainInput = &nodeDrainInput
}
Expand Down

0 comments on commit 9a498c6

Please sign in to comment.