1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-01 23:33:39 +00:00

Merge pull request #3511 from jiaqiluo/fix-node-drain

This commit is contained in:
Jiaqi Luo 2024-03-01 15:04:30 -07:00 committed by GitHub
commit 9a498c6fe5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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