KubeOS: fix proxy requeue and update image label

Signed-off-by: Yuhang Wei <weiyuhang3@huawei.com>
This commit is contained in:
Yuhang Wei 2023-09-05 22:06:42 +08:00
parent 1d36b74685
commit db4b835145
3 changed files with 78 additions and 2 deletions

View File

@ -0,0 +1,28 @@
From 9a92903712509e32b9ea84f97e35c50b2152389d Mon Sep 17 00:00:00 2001
From: Yuhang Wei <weiyuhang3@huawei.com>
Date: Tue, 5 Sep 2023 12:38:18 +0800
Subject: [PATCH 1/3] KubeOS: fix proxy upgrade requeue bug
fix the bug that proxy doesnt forget ratelimit after updating config
Signed-off-by: Yuhang Wei <weiyuhang3@huawei.com>
---
cmd/proxy/controllers/os_controller.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmd/proxy/controllers/os_controller.go b/cmd/proxy/controllers/os_controller.go
index d7da343..1153419 100644
--- a/cmd/proxy/controllers/os_controller.go
+++ b/cmd/proxy/controllers/os_controller.go
@@ -101,7 +101,7 @@ func (r *OSReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Re
if err = r.Update(ctx, osInstance); err != nil {
return values.RequeueNow, err
}
- return values.RequeueNow, nil
+ return values.Requeue, nil
}
if err := r.setConfig(ctx, osInstance, values.SysConfigName); err != nil {
return values.RequeueNow, err
--
2.34.1

View File

@ -0,0 +1,40 @@
From 5fce81aeda6498425772d3af2bfa858ba8923140 Mon Sep 17 00:00:00 2001
From: Yuhang Wei <weiyuhang3@huawei.com>
Date: Tue, 5 Sep 2023 17:01:41 +0800
Subject: [PATCH 2/3] KubeOS: fix label changed after upgrade
When upgrading, the label of the new root partition are changed to the original disk information
Signed-off-by: Yuhang Wei <weiyuhang3@huawei.com>
---
cmd/agent/server/utils.go | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/cmd/agent/server/utils.go b/cmd/agent/server/utils.go
index d2d0946..b4a19ff 100644
--- a/cmd/agent/server/utils.go
+++ b/cmd/agent/server/utils.go
@@ -75,6 +75,9 @@ func deleteNewline(out string) string {
}
func install(imagePath string, side string, next string) error {
+ if err := modifyImageLabel(imagePath, side, next); err != nil {
+ return err
+ }
if err := runCommand("dd", "if="+imagePath, "of="+side, "bs=8M"); err != nil {
return err
}
@@ -370,3 +373,10 @@ func getOCIImageDigest(containerRuntime string, imageName string) (string, error
}
return imageDigests, nil
}
+
+func modifyImageLabel(imagePath, side, next string) error {
+ if err := runCommand("e2label", imagePath, "ROOT-"+next); err != nil {
+ return err
+ }
+ return nil
+}
--
2.34.1

View File

@ -2,7 +2,7 @@
Name: KubeOS
Version: 1.0.4
Release: 3
Release: 4
Summary: O&M platform used to update the whole OS as an entirety
License: Mulan PSL v2
Source0: https://gitee.com/openeuler/KubeOS/repository/archive/v%{version}.tar.gz
@ -28,6 +28,8 @@ Patch19: 0019-KubeOS-add-unit-tests.patch
Patch20: 0020-KubeOS-modify-code-for-clean-code.patch
Patch21: 0021-KubeOS-delete-raw-and-docker-image-upgrade.patch
Patch22: 0022-KubeOS-delete-scripts-except-admin-container.patch
Patch23: 0023-KubeOS-fix-proxy-upgrade-requeue-bug.patch
Patch24: 0024-KubeOS-fix-label-changed-after-upgrade.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: make
@ -104,6 +106,12 @@ install -p -m 0600 ./scripts/admin-container/set-ssh-pub-key.service %{buildroot
rm -rfv %{buildroot}
%changelog
* Tue Sep 05 2023 Yuhang Wei<weiyuhang3@huawei.com> - 1.0.4-4
- Type:requirement
- CVE:NA
- SUG:restart
- DESC:fix proxy requeue and update image label
* Thu Aug 24 2023 Yuhang Wei<weiyuhang3@huawei.com> - 1.0.4-3
- Type:requirement
- CVE:NA
@ -194,7 +202,7 @@ rm -rfv %{buildroot}
- SUG:restart
- DESC:fix bugs of checks in generate.sh and change module path
* Fri Oct 30 2021 liyuanrong<liyuanrong1@huawei.com> - 1.0.1-2
* Sat Oct 30 2021 liyuanrong<liyuanrong1@huawei.com> - 1.0.1-2
- Type:requirement
- CVE:NA
- SUG:restart