diff --git a/0001-rpminstaller-add-support-for-openEuler.patch b/0001-rpminstaller-add-support-for-openEuler.patch new file mode 100644 index 0000000000000000000000000000000000000000..ab8e708ae244a0a0b3dc530dcefad34be21e824e --- /dev/null +++ b/0001-rpminstaller-add-support-for-openEuler.patch @@ -0,0 +1,85 @@ +From 8278a8637da3f4572c2310ecf1e137f802bcdbc4 Mon Sep 17 00:00:00 2001 +From: CooperLi +Date: Tue, 31 Aug 2021 20:51:09 +0800 +Subject: [PATCH] rpminstaller:add support for openEuler + +keadm will install epel-release when edge node want to join cluster, +openEuler does not provide epel-release, it's better to support keadm +join on openEuler ^.^ + +openEuler is an innovative platform nurtured by community collaboration. +It aims to build a unified and open OS that supports multiple processor architectures, +and to advance the hardware/software application ecosystem. + +Signed-off-by: CooperLi +--- + keadm/cmd/keadm/app/cmd/util/rpminstaller.go | 32 ++++++++++++++++++-- + 1 file changed, 29 insertions(+), 3 deletions(-) + +diff --git a/keadm/cmd/keadm/app/cmd/util/rpminstaller.go b/keadm/cmd/keadm/app/cmd/util/rpminstaller.go +index 24a55042..0e8fa4b8 100644 +--- a/keadm/cmd/keadm/app/cmd/util/rpminstaller.go ++++ b/keadm/cmd/keadm/app/cmd/util/rpminstaller.go +@@ -18,12 +18,17 @@ package util + + import ( + "fmt" ++ "strings" + + "github.com/blang/semver" + + types "github.com/kubeedge/kubeedge/keadm/cmd/keadm/app/cmd/common" + ) + ++const ( ++ openEulerVendorName = "openEuler" ++) ++ + // RpmOS struct objects shall have information of the tools version to be installed + // on Hosts having RpmOS OS. + // It implements OSTypeInstaller interface +@@ -51,13 +56,24 @@ func (r *RpmOS) InstallMQTT() error { + return nil + } + +- // install MQTT +- for _, command := range []string{ ++ commands := []string{ + "yum -y install epel-release", + "yum -y install mosquitto", + "systemctl start mosquitto", + "systemctl enable mosquitto", +- } { ++ } ++ ++ vendorName, err := getOSVendorName() ++ if err != nil { ++ fmt.Printf("Get OS vendor name failed: %v\n", err) ++ } ++ // epel-release package does not included in openEuler ++ if vendorName == openEulerVendorName { ++ commands = commands[1:] ++ } ++ ++ // install MQTT ++ for _, command := range commands { + cmd := NewCommand(command) + if err := cmd.Exec(); err != nil { + return err +@@ -116,3 +132,13 @@ func (r *RpmOS) IsKubeEdgeProcessRunning(proc string) (bool, error) { + func (r *RpmOS) IsProcessRunning(proc string) (bool, error) { + return isKubeEdgeProcessRunning(proc) + } ++ ++func getOSVendorName() (string, error) { ++ cmd := NewCommand("cat /etc/os-release | grep -E \"^NAME=\" | awk -F'=' '{print $2}'") ++ if err := cmd.Exec(); err != nil { ++ return "", err ++ } ++ vendor := strings.Trim(cmd.GetStdOut(), "\"") ++ ++ return vendor, nil ++} +-- +2.27.0 + diff --git a/kubeedge.spec b/kubeedge.spec new file mode 100644 index 0000000000000000000000000000000000000000..a0702c674e1ec9335ed5ecd2af29ea5e3697a010 --- /dev/null +++ b/kubeedge.spec @@ -0,0 +1,167 @@ +%ifarch x86_64 +%global gohostarch amd64 +%endif +%ifarch aarch64 +%global gohostarch arm64 +%endif + +%define debug_package %{nil} + +Name: kubeedge +Version: 1.8.0 +Release: 1 +Summary: Kubernetes Native Edge Computing Framework +License: Apache-2.0 +URL: https://github.com/kubeedge/kubeedge +Source0: https://github.com/kubeedge/kubeedge/archive/refs/tags/v%{version}.tar.gz +BuildRequires: golang glibc-static make tar systemd git +Requires: mosquitto + +Patch0001: 0001-rpminstaller-add-support-for-openEuler.patch + +%description +KubeEdge is an open source system for extending native containerized application +orchestration capabilities to hosts at Edge. It is built upon kubernetes and provides +fundamental infrastructure support for network, app, deployment and metadata +synchronization between cloud and edge. + +%package keadm +Summary: Keadm is used to install the cloud and edge components of KubeEdge. +Provides: keadm = %{version} + +%description keadm +Keadm is used to install the cloud and edge components of KubeEdge. +It is not responsible for installing K8s and runtime. + +%package cloudcore +Summary: KubeEdge Cloud Agent (CloudCore) +Provides: cloudcore = %{version} +Provides: admission = %{version} +Provides: csidriver = %{version} + +%description cloudcore +KubeEdge is built upon Kubernetes and extends native containerized application +orchestration and device management to hosts at the Edge. It consists of cloud +part and edge part, provides core infrastructure support for networking, +application deployment and metadata synchronization between cloud and edge. +This package contains the cloudcore binary for the cloud node. + +%package edgecore +Summary: KubeEdge Lightweight Edge Agent (EdgeCore) +Provides: edgecore = %{version} + +%description edgecore +KubeEdge is built upon Kubernetes and extends native containerized application +orchestration and device management to hosts at the Edge. It consists of cloud +part and edge part, provides core infrastructure support for networking, +application deployment and metadata synchronization between cloud and edge. +This package contains the edgecore binary for the edge node. + +%package edgesite +Summary: A GRPC agent/server +Provides: edgesite-agent = %{version} +Provides: edgesite-server = %{version} + +%description edgesite +edgesite-agent is a gRPC agent. Connects to the proxy and then allows traffic to be forwarded to it. +edgesite-server is a gRPC proxy server, receives requests from the API server and forwards to the agent. + +%prep +%autosetup -Sgit -n %{name}-%{version} -p1 + +%build +# add git tag since tarball did not contain any git info +git tag -a v%{version} -m "%{version}" +# setup GOPATH +export GOPATH=%{_builddir} +%global workspace $GOPATH/src/github.com/%{name}/%{name} +mkdir -p $GOPATH/src/github.com/%{name} +ln -sf $PWD $GOPATH/src/github.com/%{name}/%{name} +# start to build +cd %{workspace} +# set go flags +export GOLDFLAGS="-buildid=none -buildmode=pie -extldflags=-ftrapv -extldflags=-zrelro -extldflags=-znow -linkmode=external -extldflags=-static" +# build binaries +make all +# build csidriver +# TODO: delete after PR3154 is merged in new release(not included in v1.8.0) +go build -v -o _output/local/bin/csidriver -ldflags="${GOLDFLAGS}" github.com/kubeedge/kubeedge/cloud/cmd/csidriver + +%install +export GOPATH=%{_builddir} +cd %{workspace} +# create directories +install -dm0750 %{buildroot}%{_sysconfdir}/kubeedge +install -dm0750 %{buildroot}%{_sysconfdir}/kubeedge/config +install -dm0750 %{buildroot}%{_sysconfdir}/kubeedge/tools +# install binaries +install -Dpm0550 ./_output/local/bin/keadm %{buildroot}%{_prefix}/local/bin/keadm +install -Dpm0550 ./_output/local/bin/cloudcore %{buildroot}%{_prefix}/local/bin/cloudcore +install -Dpm0550 ./_output/local/bin/edgecore %{buildroot}%{_prefix}/local/bin/edgecore +install -Dpm0550 ./_output/local/bin/admission %{buildroot}%{_prefix}/local/bin/admission +install -Dpm0550 ./_output/local/bin/csidriver %{buildroot}%{_prefix}/local/bin/csidriver +install -Dpm0550 ./_output/local/bin/edgesite-agent %{buildroot}%{_prefix}/local/bin/edgesite-agent +install -Dpm0550 ./_output/local/bin/edgesite-server %{buildroot}%{_prefix}/local/bin/edgesite-server +# generate default configs for both cloudcore and edgecore +./_output/local/bin/cloudcore --defaultconfig > cloudcore.example.yaml +./_output/local/bin/edgecore --defaultconfig > edgecore.example.yaml +install -Dpm0640 ./cloudcore.example.yaml %{buildroot}%{_sysconfdir}/kubeedge/config/cloudcore.example.yaml +install -Dpm0640 ./edgecore.example.yaml %{buildroot}%{_sysconfdir}/kubeedge/config/edgecore.example.yaml +# service file for systemd +install -Dpm0640 ./build/tools/cloudcore.service %{buildroot}%{_unitdir}/cloudcore.service +install -Dpm0640 ./build/tools/edgecore.service %{buildroot}%{_unitdir}/edgecore.service +# install service file in /etc/kubeedge/ as well so that no need to download from internet when they use keadm +install -Dpm0640 ./build/tools/cloudcore.service %{buildroot}%{_sysconfdir}/kubeedge/cloudcore.service +install -Dpm0640 ./build/tools/edgecore.service %{buildroot}%{_sysconfdir}/kubeedge/edgecore.service +# crd yamls for kubernetes +cd ./build && find ./crds -type f -exec install -Dm0644 {} %{buildroot}%{_sysconfdir}/kubeedge/{} \; && cd - +# tool for certificate generation +install -Dpm0550 ./build/tools/certgen.sh %{buildroot}%{_sysconfdir}/kubeedge/tools/certgen.sh +# construct tarball used for keadm +%global tarball_name %{name}-v%{version}-linux-%{gohostarch} +install -Dpm0550 ./_output/local/bin/cloudcore %{tarball_name}/cloud/cloudcore/cloudcore +install -Dpm0550 ./_output/local/bin/admission %{tarball_name}/cloud/admission/admission +install -Dpm0550 ./_output/local/bin/csidriver %{tarball_name}/cloud/csidriver/csidriver +install -Dpm0550 ./_output/local/bin/edgecore %{tarball_name}/edge/edgecore +# like cp -r, but have filemode control here +cd ./build && find ./crds -type f -exec install -Dpm0644 {} ../%{tarball_name}/{} \; && cd - +echo "v%{version}" > %{tarball_name}/version +tar zcf %{tarball_name}.tar.gz %{tarball_name} +# checksum for tarball +sha512sum %{tarball_name}.tar.gz | awk '{print $1}' > checksum_%{tarball_name}.tar.gz.txt +# install tarball +install -Dpm0550 %{tarball_name}.tar.gz %{buildroot}%{_sysconfdir}/kubeedge/%{tarball_name}.tar.gz +install -Dpm0550 checksum_%{tarball_name}.tar.gz.txt %{buildroot}%{_sysconfdir}/kubeedge/checksum_%{tarball_name}.tar.gz.txt + +%files keadm +%license LICENSE +%{_prefix}/local/bin/keadm +%{_sysconfdir}/kubeedge/cloudcore.service +%{_sysconfdir}/kubeedge/edgecore.service +%{_sysconfdir}/kubeedge/%{tarball_name}.tar.gz +%{_sysconfdir}/kubeedge/checksum_%{tarball_name}.tar.gz.txt + +%files cloudcore +%license LICENSE +%{_prefix}/local/bin/cloudcore +%{_prefix}/local/bin/admission +%{_prefix}/local/bin/csidriver +%{_unitdir}/cloudcore.service +%{_sysconfdir}/kubeedge/crds +%{_sysconfdir}/kubeedge/tools/certgen.sh +%config(noreplace) %{_sysconfdir}/kubeedge/config/cloudcore.example.yaml + +%files edgecore +%license LICENSE +%{_prefix}/local/bin/edgecore +%{_unitdir}/edgecore.service +%config(noreplace) %{_sysconfdir}/kubeedge/config/edgecore.example.yaml + +%files edgesite +%license LICENSE +%{_prefix}/local/bin/edgesite-agent +%{_prefix}/local/bin/edgesite-server + +%changelog +* Thu Sep 18 2021 Poorunga<2744323@qq.com> - 1.8.0-1 +- Package init diff --git a/v1.8.0.tar.gz b/v1.8.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..7d168ac3f742e10dc8e1b7a5ededb583b90c137b Binary files /dev/null and b/v1.8.0.tar.gz differ