// If we're dry-running; we should create a faked client that answers some GETs in order to be able to do the full init flow and just logs the rest of requests
// runAddonsCmdFunc creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
// This call returns the ready-to-use configuration based on the configuration file that might or might not exist and the default cfg populated by flags
// runCmdFunc creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
// runCmdControlPlane creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
// runCmdPhase creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
// This call returns the ready-to-use configuration based on the configuration file that might or might not exist and the default cfg populated by flags
fmt.Printf("[upgrade/config] In order to upgrade, a ConfigMap called %q in the %s namespace must exist.\n",constants.MasterConfigurationConfigMap,metav1.NamespaceSystem)
fmt.Printf("[upgrade/config] In order to upgrade, a ConfigMap called %q in the %s namespace must exist.\n",constants.InitConfigurationConfigMap,metav1.NamespaceSystem)
fmt.Println("[upgrade/config] Without this information, 'kubeadm upgrade' won't know how to configure your upgraded cluster.")
fmt.Printf("\t- OPTION 2: Run 'kubeadm config upload from-file' and specify the same config file you passed to 'kubeadm init' when you created your master.\n")
fmt.Printf("\t- OPTION 3: Pass a config file to 'kubeadm upgrade' using the --config flag.\n")
fmt.Println("")
err=fmt.Errorf("the ConfigMap %q in the %s namespace used for getting configuration information was not found",constants.MasterConfigurationConfigMap,metav1.NamespaceSystem)
err=fmt.Errorf("the ConfigMap %q in the %s namespace used for getting configuration information was not found",constants.InitConfigurationConfigMap,metav1.NamespaceSystem)
// InitConfigurationConfigMapKey specifies in what ConfigMap key the master configuration should be stored
InitConfigurationConfigMapKey="InitConfiguration"
// KubeletBaseConfigurationConfigMapPrefix specifies in what ConfigMap in the kube-system namespace the initial remote configuration of kubelet should be stored
t.Errorf("getKubeConfigSpecs for %s Organizations is %v, expected %v",assertion.kubeConfigFile,spec.ClientCertAuth.Organizations,assertion.organizations)
}
// Asserts MasterConfiguration values injected into spec
// Asserts InitConfiguration values injected into spec
fmt.Printf("[uploadconfig] storing the configuration used in ConfigMap %q in the %q Namespace\n",kubeadmconstants.MasterConfigurationConfigMap,metav1.NamespaceSystem)
fmt.Printf("[uploadconfig] storing the configuration used in ConfigMap %q in the %q Namespace\n",kubeadmconstants.InitConfigurationConfigMap,metav1.NamespaceSystem)
// We don't want to mutate the cfg itself, so create a copy of it using .DeepCopy of it first
// FetchConfigFromFileOrCluster fetches configuration required for upgrading your cluster from a file (which has precedence) or a ConfigMap in the cluster
// Return the apierror directly so the caller of this function can know what type of error occurred and act based on that
return[]byte{},err
}elseiferr!=nil{
return[]byte{},fmt.Errorf("an unexpected error happened when trying to get the ConfigMap %q in the %s namespace: %v",constants.MasterConfigurationConfigMap,metav1.NamespaceSystem,err)
return[]byte{},fmt.Errorf("an unexpected error happened when trying to get the ConfigMap %q in the %s namespace: %v",constants.InitConfigurationConfigMap,metav1.NamespaceSystem,err)
}
// TODO: Load the kube-proxy and kubelet ComponentConfig ConfigMaps here as different YAML documents and append to the byte slice
fmt.Fprintf(w,"[%s] FYI: You can look at this config file with 'kubectl -n %s get cm %s -oyaml'\n",logPrefix,metav1.NamespaceSystem,constants.MasterConfigurationConfigMap)
fmt.Fprintf(w,"[%s] FYI: You can look at this config file with 'kubectl -n %s get cm %s -oyaml'\n",logPrefix,metav1.NamespaceSystem,constants.InitConfigurationConfigMap)