mirror of https://github.com/k3s-io/k3s
![]() MigrateOldConfigFromFile is a function, whose purpose is to migrate one config into another. It is working OK for now, but it has some issues: - It is incredibly inefficient. It can reload and re-parse a single config file for up to 3 times. - Because of the reloads, it has to take a file containing the configuration (not a byte slice as most of the rest config functions). However, it returns the migrated config in a byte slice (rather asymmetric from the input method). - Due to the above points it's difficult to implement a proper interface for deprecated kubeadm config versions. To fix the issues of MigrateOldConfigFromFile, the following is done: - Re-implement the function by removing the calls to file loading package public APIs and replacing them with newly extracted package private APIs that do the job with pre-provided input data in the form of map[GroupVersionKind][]byte. - Take a byte slice of the input configuration as an argument. This makes the function input symmetric to its output. Also, it's now renamed to MigrateOldConfig to represent the change from config file path as an input to byte slice. - As a bonus (actually forgotten from a previous change) BytesToInternalConfig is renamed to the more descriptive BytesToInitConfiguration. Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com> |
||
---|---|---|
.. | ||
app | ||
test | ||
.import-restrictions | ||
BUILD | ||
OWNERS | ||
kubeadm.go |