From b6f4bb349b93e4eee9e6eaa71cf007cd6de79c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= Date: Mon, 6 May 2019 17:54:46 +0200 Subject: [PATCH] kubeadm: upload the `ClusterConfiguration` during the upgrade During the upgrade process, `kubeadm` will take the current `ClusterConfiguration`, update the `KubernetesVersion` to the latest version, and call to `UploadConfiguration`. This change makes sure that when the mutation happens, not only the `ClusterStatus` is mutated, but the `ClusterConfiguration` object inside the `kubeadm-config` ConfigMap as well; it will contain the new `KubernetesVersion`. --- cmd/kubeadm/app/phases/uploadconfig/uploadconfig.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/kubeadm/app/phases/uploadconfig/uploadconfig.go b/cmd/kubeadm/app/phases/uploadconfig/uploadconfig.go index 88be8255584..17a66159509 100644 --- a/cmd/kubeadm/app/phases/uploadconfig/uploadconfig.go +++ b/cmd/kubeadm/app/phases/uploadconfig/uploadconfig.go @@ -101,6 +101,10 @@ func UploadConfiguration(cfg *kubeadmapi.InitConfiguration, client clientset.Int kubeadmconstants.ClusterStatusConfigMapKey: string(clusterStatusYaml), }, }, func(cm *v1.ConfigMap) error { + // Upgrade will call to UploadConfiguration with a modified KubernetesVersion reflecting the new + // Kubernetes version. In that case, the mutation path will take place. + cm.Data[kubeadmconstants.ClusterConfigurationConfigMapKey] = string(clusterConfigurationYaml) + // Mutate the ClusterStatus now return mutateClusterStatus(cm, func(cs *kubeadmapi.ClusterStatus) error { // Handle a nil APIEndpoints map. Should only happen if someone manually // interacted with the ConfigMap.