mirror of
https://github.com/rancher/rke.git
synced 2025-09-04 00:14:49 +00:00
fix the bug where the value of delete_local_data is dropped by the ghodssyaml.Marshal function due to the same field has different names in YAML tag and JSON tag
This commit is contained in:
@@ -687,10 +687,15 @@ func parseNodeDrainInput(clusterFile string, rkeConfig *v3.RancherKubernetesEngi
|
|||||||
nodeDrainInput.GracePeriod = DefaultNodeDrainGracePeriod
|
nodeDrainInput.GracePeriod = DefaultNodeDrainGracePeriod
|
||||||
update = true
|
update = true
|
||||||
} else {
|
} 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)
|
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 {
|
if update {
|
||||||
rkeConfig.UpgradeStrategy.DrainInput = &nodeDrainInput
|
rkeConfig.UpgradeStrategy.DrainInput = &nodeDrainInput
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user