k3s/cmd/kubeadm/app/util
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
..
apiclient move pkg/kubelet/apis/well_known_labels.go to staging/src/k8s.io/api/core/v1/ 2019-02-05 13:39:07 -05:00
audit add BUILD 2018-10-30 16:23:52 +08:00
certs Merge pull request #73198 from mourya007/library 2019-01-29 01:20:42 -08:00
config kubeadm: Replace MigrateOldConfigFromFile 2019-02-14 11:52:33 +02:00
dryrun error-imports-cleanups 2019-01-03 13:25:18 +01:00
etcd kubeadm: reduce the usage of InitConfiguration 2019-01-28 12:21:01 +02:00
kubeconfig kubeadm: use T.Run API in app/util 2018-12-29 18:27:38 +02:00
pkiutil Re-Organize the pkutil library 2019-01-26 14:56:36 +05:30
pubkeypin add BUILD 2018-10-30 16:23:52 +08:00
runtime kubeadm: Detect CRIs automatically 2019-01-21 16:12:04 +02:00
staticpod kubeadm: set priority class name to `system-cluster-critical` for all master components 2019-02-12 17:50:36 +01:00
system Update docker support for k8s 2019-01-30 03:25:05 -05:00
BUILD move test utilites out of /test 2018-12-04 19:27:17 +08:00
arguments.go simplify logic for func BuildArgumentListFromMap 2018-11-01 23:15:48 +08:00
arguments_test.go kubeadm: use T.Run API in app/util 2018-12-29 18:27:38 +02:00
cgroupdriver.go kubeadm: add a preflight check for Docker and cgroup driver 2019-02-08 19:31:22 +02:00
cgroupdriver_test.go kubeadm: conditionally set the kubelet cgroup driver for Docker 2018-05-30 20:29:21 +03:00
chroot_test.go kubeadm: chroot to new --rootfs arg 2018-08-08 18:10:39 +10:00
chroot_unix.go [kubeadm/app/]switch to github.com/pkg/errors 2018-10-30 16:23:24 +08:00
chroot_windows.go [kubeadm/app/]switch to github.com/pkg/errors 2018-10-30 16:23:24 +08:00
copy.go Adding etcd upgrade to kubeadm upgrade apply 2017-11-18 18:47:50 -05:00
endpoint.go kubeadm: reduce the usage of InitConfiguration 2019-01-28 12:21:01 +02:00
endpoint_test.go kubeadm: reduce the usage of InitConfiguration 2019-01-28 12:21:01 +02:00
error.go error-imports-cleanups 2019-01-03 13:25:18 +01:00
error_test.go kubeadm: use T.Run API in app/util 2018-12-29 18:27:38 +02:00
marshal.go error-imports-cleanups 2019-01-03 13:25:18 +01:00
marshal_test.go Automated bump from v1alpha3 references to v1beta1 2018-10-04 12:03:38 +02:00
template.go [kubeadm/app/util]switch to github.com/pkg/errors 2018-10-26 15:17:21 +08:00
template_test.go kubeadm: use T.Run API in app/util 2018-12-29 18:27:38 +02:00
version.go error-imports-cleanups 2019-01-03 13:25:18 +01:00
version_test.go kubeadm: use T.Run API in app/util 2018-12-29 18:27:38 +02:00