代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/kubernetes 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 3dbf97d91090e73b7e3acaea003725d8fedf49ff Mon Sep 17 00:00:00 2001
From: Shida Qiu <shidaqiu2018@gmail.com>
Date: Fri, 2 Feb 2024 20:34:30 +0800
Subject: [PATCH] Revert "kubeadm: fix a bug where the uploaded kubelet
configuration in kube-system/kubelet-config ConfigMap does not respect user
patch"
---
cmd/kubeadm/app/cmd/phases/init/uploadconfig.go | 14 +++++++-------
cmd/kubeadm/app/phases/kubelet/config.go | 16 ++++------------
cmd/kubeadm/app/phases/kubelet/config_test.go | 2 +-
cmd/kubeadm/app/phases/upgrade/postupgrade.go | 2 +-
4 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/cmd/kubeadm/app/cmd/phases/init/uploadconfig.go b/cmd/kubeadm/app/cmd/phases/init/uploadconfig.go
index 88be945750f62..c9338f189908c 100644
--- a/cmd/kubeadm/app/cmd/phases/init/uploadconfig.go
+++ b/cmd/kubeadm/app/cmd/phases/init/uploadconfig.go
@@ -104,7 +104,7 @@ func getUploadConfigPhaseFlags() []string {
// runUploadKubeadmConfig uploads the kubeadm configuration to a ConfigMap
func runUploadKubeadmConfig(c workflow.RunData) error {
- cfg, client, _, err := getUploadConfigData(c)
+ cfg, client, err := getUploadConfigData(c)
if err != nil {
return err
}
@@ -118,13 +118,13 @@ func runUploadKubeadmConfig(c workflow.RunData) error {
// runUploadKubeletConfig uploads the kubelet configuration to a ConfigMap
func runUploadKubeletConfig(c workflow.RunData) error {
- cfg, client, patchesDir, err := getUploadConfigData(c)
+ cfg, client, err := getUploadConfigData(c)
if err != nil {
return err
}
klog.V(1).Infoln("[upload-config] Uploading the kubelet component config to a ConfigMap")
- if err = kubeletphase.CreateConfigMap(&cfg.ClusterConfiguration, patchesDir, client); err != nil {
+ if err = kubeletphase.CreateConfigMap(&cfg.ClusterConfiguration, client); err != nil {
return errors.Wrap(err, "error creating kubelet configuration ConfigMap")
}
@@ -135,15 +135,15 @@ func runUploadKubeletConfig(c workflow.RunData) error {
return nil
}
-func getUploadConfigData(c workflow.RunData) (*kubeadmapi.InitConfiguration, clientset.Interface, string, error) {
+func getUploadConfigData(c workflow.RunData) (*kubeadmapi.InitConfiguration, clientset.Interface, error) {
data, ok := c.(InitData)
if !ok {
- return nil, nil, "", errors.New("upload-config phase invoked with an invalid data struct")
+ return nil, nil, errors.New("upload-config phase invoked with an invalid data struct")
}
cfg := data.Cfg()
client, err := data.Client()
if err != nil {
- return nil, nil, "", err
+ return nil, nil, err
}
- return cfg, client, data.PatchesDir(), err
+ return cfg, client, err
}
diff --git a/cmd/kubeadm/app/phases/kubelet/config.go b/cmd/kubeadm/app/phases/kubelet/config.go
index 2adc8d8631eb3..3236edb58b679 100644
--- a/cmd/kubeadm/app/phases/kubelet/config.go
+++ b/cmd/kubeadm/app/phases/kubelet/config.go
@@ -68,7 +68,10 @@ func WriteConfigToDisk(cfg *kubeadmapi.ClusterConfiguration, kubeletDir, patches
// CreateConfigMap creates a ConfigMap with the generic kubelet configuration.
// Used at "kubeadm init" and "kubeadm upgrade" time
-func CreateConfigMap(cfg *kubeadmapi.ClusterConfiguration, patchesDir string, client clientset.Interface) error {
+func CreateConfigMap(cfg *kubeadmapi.ClusterConfiguration, client clientset.Interface) error {
+ configMapName := kubeadmconstants.KubeletBaseConfigurationConfigMap
+ fmt.Printf("[kubelet] Creating a ConfigMap %q in namespace %s with the configuration for the kubelets in the cluster\n", configMapName, metav1.NamespaceSystem)
+
kubeletCfg, ok := cfg.ComponentConfigs[componentconfigs.KubeletGroup]
if !ok {
return errors.New("no kubelet component config found in the active component config set")
@@ -79,17 +82,6 @@ func CreateConfigMap(cfg *kubeadmapi.ClusterConfiguration, patchesDir string, cl
return err
}
- // Apply patches to the KubeletConfiguration
- if len(patchesDir) != 0 {
- kubeletBytes, err = applyKubeletConfigPatches(kubeletBytes, patchesDir, os.Stdout)
- if err != nil {
- return errors.Wrap(err, "could not apply patches to the KubeletConfiguration")
- }
- }
-
- configMapName := kubeadmconstants.KubeletBaseConfigurationConfigMap
- fmt.Printf("[kubelet] Creating a ConfigMap %q in namespace %s with the configuration for the kubelets in the cluster\n", configMapName, metav1.NamespaceSystem)
-
configMap := &v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: configMapName,
diff --git a/cmd/kubeadm/app/phases/kubelet/config_test.go b/cmd/kubeadm/app/phases/kubelet/config_test.go
index 5399d66a84610..f1add0f831276 100644
--- a/cmd/kubeadm/app/phases/kubelet/config_test.go
+++ b/cmd/kubeadm/app/phases/kubelet/config_test.go
@@ -58,7 +58,7 @@ func TestCreateConfigMap(t *testing.T) {
t.Fatalf("unexpected failure when defaulting InitConfiguration: %v", err)
}
- if err := CreateConfigMap(&internalcfg.ClusterConfiguration, "", client); err != nil {
+ if err := CreateConfigMap(&internalcfg.ClusterConfiguration, client); err != nil {
t.Errorf("CreateConfigMap: unexpected error %v", err)
}
}
diff --git a/cmd/kubeadm/app/phases/upgrade/postupgrade.go b/cmd/kubeadm/app/phases/upgrade/postupgrade.go
index 336efbf2174fb..c394eab681908 100644
--- a/cmd/kubeadm/app/phases/upgrade/postupgrade.go
+++ b/cmd/kubeadm/app/phases/upgrade/postupgrade.go
@@ -61,7 +61,7 @@ func PerformPostUpgradeTasks(client clientset.Interface, cfg *kubeadmapi.InitCon
}
// Create the new, version-branched kubelet ComponentConfig ConfigMap
- if err := kubeletphase.CreateConfigMap(&cfg.ClusterConfiguration, patchesDir, client); err != nil {
+ if err := kubeletphase.CreateConfigMap(&cfg.ClusterConfiguration, client); err != nil {
errs = append(errs, errors.Wrap(err, "error creating kubelet configuration ConfigMap"))
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。