rubik: upgrade rubik version to v2.0.0

Signed-off-by: vegbir <yangjiaqi16@huawei.com>
This commit is contained in:
vegbir 2023-05-24 14:34:54 +08:00
parent ab7c074a3b
commit e48d5ef7f5
11 changed files with 12 additions and 143 deletions

View File

@ -1 +1 @@
1.0.0-5
2.0.0-1

View File

@ -41,4 +41,4 @@ echo -e "\n"
docker images | grep -E "REPOSITORY|${BINARY_NAME}"
# Modify rubik-daemonset.yaml file, set rubik image name
sed -i "s/rubik_image_name_and_tag/${IMG_NAME_AND_TAG}/g" "${YAML_FILE}"
sed -i "/image:/s/:.*/: ${IMG_NAME_AND_TAG}/" "${YAML_FILE}"

View File

@ -1 +1 @@
8e373d25ff4a5b76c9dc1735a40098254f49e1c6
37e6484adbbb01802e969ccf640e5232d974b2fb

0
patch/.gitkeep Normal file
View File

View File

@ -1,47 +0,0 @@
From d8e0e3d724f2fc85886cf087eea3cc89f8aa6630 Mon Sep 17 00:00:00 2001
From: xiadanni <xiadanni1@huawei.com>
Date: Mon, 27 Dec 2021 16:52:03 +0800
Subject: [PATCH] rubik: enable GO111MODULE and Optimized compilation
instruction
Signed-off-by: xiadanni <xiadanni1@huawei.com>
---
Makefile | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 4285721..8d943cc 100644
--- a/Makefile
+++ b/Makefile
@@ -21,21 +21,25 @@ RELEASE :=$(if $(shell awk -F"-" '{print $$2}' < $(VERSION_FILE)),$(shell awk -F
BUILD_TIME := $(shell date "+%Y-%m-%d")
GIT_COMMIT := $(if $(shell git rev-parse --short HEAD),$(shell git rev-parse --short HEAD),$(shell cat ./git-commit | head -c 7))
+export GO111MODULE=on
+
DEBUG_FLAGS := -gcflags="all=-N -l"
LD_FLAGS := -ldflags '-buildid=none -tmpdir=$(TMP_DIR) \
-X isula.org/rubik/pkg/version.GitCommit=$(GIT_COMMIT) \
-X isula.org/rubik/pkg/version.BuildTime=$(BUILD_TIME) \
-X isula.org/rubik/pkg/version.Version=$(VERSION) \
-X isula.org/rubik/pkg/version.Release=$(RELEASE) \
- -extldflags=-ftrapv \
- -extldflags=-Wl,-z,relro,-z,now -linkmode=external -extldflags=-static'
+ -buildmode=pie \
+ -extldflags=-ftrapv -extldflags=-zrelro -extldflags=-znow \
+ -linkmode=external \
+ -extldflags "-static-pie -Wl,-z,now"'
GO_BUILD=CGO_ENABLED=1 \
CGO_CFLAGS="-fstack-protector-strong -fPIE" \
CGO_CPPFLAGS="-fstack-protector-strong -fPIE" \
CGO_LDFLAGS_ALLOW='-Wl,-z,relro,-z,now' \
CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" \
- go build -buildmode=pie
+ go build -mod=vendor
all: release
--
2.30.2

View File

@ -1,21 +0,0 @@
From 8f5aac08a11a60c7fe21437c86c01df1367a0ba2 Mon Sep 17 00:00:00 2001
From: hanchao <hanchao47@huawei.com>
Date: Tue, 15 Nov 2022 00:12:14 +0800
Subject: [PATCH] rubik: fix Dockerfile build failed
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index 51f0e4c..78c7702 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,3 +1,3 @@
FROM scratch
-COPY ./rubik /rubik
+COPY ./build/rubik /rubik
ENTRYPOINT ["/rubik"]
--
2.30.2

View File

@ -1,66 +0,0 @@
From 1817eb44c25980c5ced63965838fe428c8860540 Mon Sep 17 00:00:00 2001
From: yangjiaqi <yangjiaqi16@huawei.com>
Date: Wed, 16 Nov 2022 20:34:20 +0800
Subject: [PATCH] set the burst value for the pod to enable the container burst
---
pkg/quota/quota_burst.go | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/pkg/quota/quota_burst.go b/pkg/quota/quota_burst.go
index 641e514..2d13cec 100644
--- a/pkg/quota/quota_burst.go
+++ b/pkg/quota/quota_burst.go
@@ -27,7 +27,6 @@ import (
"isula.org/rubik/pkg/typedef"
)
-
// SetPodsQuotaBurst sync pod's burst quota when autoconfig is set
func SetPodsQuotaBurst(podInfos map[string]*typedef.PodInfo) {
for _, pi := range podInfos {
@@ -62,6 +61,7 @@ func setPodQuotaBurst(podInfo *typedef.PodInfo) {
if podInfo.QuotaBurst == constant.InvalidBurst {
return
}
+ // 1. Try to write container burst value
burst := big.NewInt(podInfo.QuotaBurst).String()
for _, c := range podInfo.Containers {
err := setCtrQuotaBurst([]byte(burst), c)
@@ -69,20 +69,27 @@ func setPodQuotaBurst(podInfo *typedef.PodInfo) {
log.Errorf("set container quota burst failed: %v", err)
}
}
+ // 2. Try to write pod burst value
+ const subsys = "cpu"
+ podPath := filepath.Join(podInfo.CgroupRoot, subsys, podInfo.CgroupPath)
+ podBurst := big.NewInt(int64(len(podInfo.Containers)) * podInfo.QuotaBurst).String()
+ setQuotaBurst([]byte(podBurst), podPath)
}
func setCtrQuotaBurst(burst []byte, c *typedef.ContainerInfo) error {
- const (
- fname = "cpu.cfs_burst_us"
- subsys = "cpu"
- )
+ const subsys = "cpu"
cgpath := c.CgroupPath(subsys)
- fpath := filepath.Join(cgpath, fname)
+ return setQuotaBurst(burst, cgpath)
+}
+func setQuotaBurst(burst []byte, cgpath string) error {
+ const burst_file_name = "cpu.cfs_burst_us"
+ fpath := filepath.Join(cgpath, burst_file_name)
+ // check whether cgroup support cpu burst
if _, err := os.Stat(fpath); err != nil && os.IsNotExist(err) {
return errors.Errorf("quota-burst path=%v missing", fpath)
}
-
+ // try to write cfs_burst_us
if err := ioutil.WriteFile(fpath, burst, constant.DefaultFileMode); err != nil {
return errors.Errorf("quota-burst path=%v setting failed: %v", fpath, err)
}
--
2.30.0

View File

@ -1,6 +1,6 @@
Name: rubik
Version: 1.0.0
Release: 5
Version: 2.0.0
Release: 1
Summary: Hybrid Deployment for Cloud Native
License: Mulan PSL V2
URL: https://gitee.com/openeuler/rubik
@ -13,7 +13,7 @@ Source5: series.conf
Source6: patch.tar.gz
Source7: build_rubik_image.sh
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: golang >= 1.13
BuildRequires: golang >= 1.17
%description
This is hybrid deployment component for cloud native, it should be running in kubernetes environment.
@ -56,6 +56,12 @@ install -Dp ./build_rubik_image.sh %{buildroot}%{_sharedstatedir}/%{name}/build_
rm -rf %{buildroot}
%changelog
* Wed May 24 2023 vegbir <yangjiaqi16@huawei.com> - 2.0.0-1
- Type:bugfix
- CVE:NA
- SUG:restart
- DESC:upgrade rubik version to v2.0.0
* Tue Nov 29 2022 CooperLi <a710905118@163.com> - 1.0.0-5
- Type:bugfix
- CVE:NA

View File

@ -1,4 +1 @@
patch/0001-rubik-enable-GO111MODULE-and-Optimized-compilation-i.patch
patch/0002-rubik-fix-Dockerfile-build-failed.patch
patch/0003-set-the-burst-value-for-the-pod-to-enable-the-contai.patch
#end of file

Binary file not shown.

BIN
v2.0.0.tar.gz Normal file

Binary file not shown.