k3s/cmd/kubeadm
Rostislav M. Georgiev f73ac0da3e kubeadm: Replace MigrateOldConfigFromFile
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>
2019-02-14 11:52:33 +02:00
..
app kubeadm: Replace MigrateOldConfigFromFile 2019-02-14 11:52:33 +02:00
test kubeadm: Refactor InitConfiguration init APIs 2019-02-11 14:45:34 +02:00
.import-restrictions Remove unnecessary prefixes from various .import-restrictions files 2019-02-11 16:47:28 -05:00
BUILD Move from glog to klog 2018-11-10 07:50:31 -05:00
OWNERS Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
kubeadm.go Move from glog to klog 2018-11-10 07:50:31 -05:00