k3s/cmd
Rostislav M. Georgiev 51197e4393 kubeadm: Refactor InitConfiguration init APIs
Currently ConfigFileAndDefaultsToInternalConfig and
FetchConfigFromFileOrCluster are used to default and load InitConfiguration
from file or cluster. These two APIs do a couple of completely separate things
depending on how they were invoked. In the case of

ConfigFileAndDefaultsToInternalConfig, an InitConfiguration could be either
defaulted with external override parameters, or loaded from file.
With FetchConfigFromFileOrCluster an InitConfiguration is either loaded from
file or from the config map in the cluster.

The two share both some functionality, but not enough code. They are also quite
difficult to use and sometimes even error prone.

To solve the issues, the following steps were taken:

- Introduce DefaultedInitConfiguration which returns defaulted version agnostic
  InitConfiguration. The function takes InitConfiguration for overriding the
  defaults.

- Introduce LoadInitConfigurationFromFile, which loads, converts, validates and
  defaults an InitConfiguration from file.

- Introduce FetchInitConfigurationFromCluster that fetches InitConfiguration
  from the config map.

- Reduce, when possible, the usage of ConfigFileAndDefaultsToInternalConfig by
  replacing it with DefaultedInitConfiguration or LoadInitConfigurationFromFile
  invocations.

- Replace all usages of FetchConfigFromFileOrCluster with calls to
  LoadInitConfigurationFromFile or FetchInitConfigurationFromCluster.

- Delete FetchConfigFromFileOrCluster as it's no longer used.

- Rename ConfigFileAndDefaultsToInternalConfig to
  LoadOrDefaultInitConfiguration in order to better describe what the function
  is actually doing.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-02-11 14:45:34 +02:00
..
clicheck Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
cloud-controller-manager Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
controller-manager Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
gendocs
genkubedocs GCP: Remove the deprecated google-json-key support 2018-10-02 16:53:28 -07:00
genman
genswaggertypedocs Move from glog to klog 2018-11-10 07:50:31 -05:00
genutils
genyaml
hyperkube Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
importverifier Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
kube-apiserver Merge pull request #73540 from rlenferink/patch-5 2019-02-08 09:05:56 -08:00
kube-controller-manager Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
kube-proxy Use ioutil.TempDir for temporary dir creating 2019-02-07 12:27:19 -05:00
kube-scheduler Fix function comment to consistent with its name 2019-02-11 10:51:35 +08:00
kubeadm kubeadm: Refactor InitConfiguration init APIs 2019-02-11 14:45:34 +02:00
kubectl Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
kubelet Merge pull request #73540 from rlenferink/patch-5 2019-02-08 09:05:56 -08:00
kubemark Merge pull request #73854 from RajatVaryani/master 2019-02-08 22:00:24 -08:00
linkcheck
BUILD
OWNERS Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00