Round Upstream Patch

(cherry picked from commit a1fa136fe42b7206d31ef0c120802ea48d8f1884)
This commit is contained in:
zhangxingrong 2024-07-09 10:28:42 +08:00 committed by openeuler-sync-bot
parent 48a0cf8fb0
commit dd5a8f6d27
3 changed files with 150 additions and 1 deletions

View File

@ -0,0 +1,21 @@
From 60a564c9204c67fbdead9d2e183e7ae1802e2dfb Mon Sep 17 00:00:00 2001
From: Richa Banker <richabanker@google.com>
Date: Thu, 11 Jan 2024 21:13:43 -0800
Subject: [PATCH] Add processStartTime in metrics/slis
---
.../src/k8s.io/component-base/metrics/prometheus/slis/metrics.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/staging/src/k8s.io/component-base/metrics/prometheus/slis/metrics.go b/staging/src/k8s.io/component-base/metrics/prometheus/slis/metrics.go
index 3d464d12d75e2..39cd2ba288587 100644
--- a/staging/src/k8s.io/component-base/metrics/prometheus/slis/metrics.go
+++ b/staging/src/k8s.io/component-base/metrics/prometheus/slis/metrics.go
@@ -57,6 +57,7 @@ var (
func Register(registry k8smetrics.KubeRegistry) {
registry.Register(healthcheck)
registry.Register(healthchecksTotal)
+ _ = k8smetrics.RegisterProcessStartTime(registry.Register)
}
func ResetHealthMetrics() {

View File

@ -0,0 +1,123 @@
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"))
}

View File

@ -3,7 +3,7 @@
Name: kubernetes
Version: 1.29.1
Release: 6
Release: 7
Summary: Container cluster management
License: ASL 2.0
URL: https://k8s.io/kubernetes
@ -27,6 +27,8 @@ Source15: kubernetes.conf
Patch0001: 0001-fix-compile-options.patch
Patch0002: 0002-kubelet-support-exec-and-attach-websocket-protocol.patch
Patch0003: 0003-Add-envFrom-to-serviceaccount-admission-plugin.patch
Patch0004: 0004-Add-processStartTime-in-metrics-slis.patch
Patch0005: 0005-fix-a-bug-where-the-uploaded-kubelet-configuration-in-kube-system-kubelet-config-ConfigMap-does-not-respect-user.patch
%ifarch riscv64
Patch1000: 1000-Add-riscv64-support-for-v1.29.1-kubernetes.patch
%endif
@ -271,6 +273,9 @@ getent passwd kube >/dev/null || useradd -r -g kube -d / -s /sbin/nologin \
%systemd_postun kubelet kube-proxy
%changelog
* Tue Jul 9 2024 zhangxingrong-<zhangxingrong@uniontech.cn> - 1.29.1-7
- DESC:Round Upstream Patchs
* Wed Jul 03 2024 heruoqing <ruoqing@iscas.ac.cn> - 1.29.1-6
- DESC: reapply riscv64 patch