%define debug_package %{nil}

Name:           nestos-kubernetes-deployer
Version:        0.2.2
Release:        4
Summary:        A platform to deploy and operate k8s clusters
License:        Apache-2.0
URL:            https://gitee.com/openeuler/nestos-kubernetes-deployer
Source0:        %{name}-%{version}.tar.gz

Patch0001:	0001-bugfix-for-upgrading-os.patch

BuildRequires:  make
BuildRequires:  glibc
BuildRequires:  golang >= 1.17

%description
This is a deployment tool of kubernetes cluster O&M platform based on NestOS. 
The goal is to provide services such as deployment, update and configuration management of the infrastructure outside of the kubernetes cluster.

%prep
%autosetup -Sgit -n %{name}-%{version} -p1

%package -n        nkd
Summary:           nkd
Requires:          opentofu
Requires:          kubernetes-client
Provides:          nkd = %{version}-%{release}
%description -n    nkd
Deployment tool.

%package -n        nkd-housekeeper
Summary:           nkd housekeeper
Provides:          nkd-housekeeper = %{version}-%{release}
%description -n    nkd-housekeeper
Upgrade the OS or k8s version module.

%build
# nkd
GO111MODULE=on go build -mod=vendor -tags release --ldflags="-w -s" -o nkd nkd.go
# housekeeper
cd housekeeper
make housekeeper-daemon
cd -

%install
# nkd
install -D -m 0555 nkd %{buildroot}%{_bindir}/nkd

# housekeeper
install -D -m 0555 housekeeper/bin/housekeeper-daemon %{buildroot}%{_bindir}/housekeeper-daemon
install -D -m 0644 housekeeper/daemon/files/housekeeper-daemon.service %{buildroot}/usr/lib/systemd/system/housekeeper-daemon.service

%files
%doc README.md README.en.md
%license LICENSE

%files -n nkd
%{_bindir}/nkd

%files -n nkd-housekeeper
%{_bindir}/housekeeper-daemon
/usr/lib/systemd/system/housekeeper-daemon.service

%changelog
* Mon May 13 2024 liukuo <liukuo@kylinos.cn> - 0.2.2-4
- Type: bugfix
- ID:NA
- SUG:NA
- DESC: Modify bugs for upgrading the operating system

* Tue Apr 16 2024 lijian <lijian2@kylinos.cn> - 0.2.2-3
- Delete require nkd in nkd-housekeeper

* Tue Apr 16 2024 lijian <lijian2@kylinos.cn> - 0.2.2-2
- Add README.md README.en.md LICENSE
- Add new require kubernetes-client

* Thu Mar 21 2024 lijian <lijian2@kylinos.cn> - 0.2.2-1
- Upgrade to 0.2.2

* Thu Mar 21 2024 lijian <lijian2@kylinos.cn> - 0.2.1-2
- Add require opentofu

* Fri Feb 23 2024 lijian <lijian2@kylinos.cn> - 0.2.1-1
- Bugfix for v0.2.0

* Tue Jan 02 2024 liukuo <liukuo@kylinos.cn> - 0.2.0-1
- Support for the libvirt platform, as well as integrated certificate and configuration management modules

* Tue Sep 12 2023 liukuo <liukuo@kylinos.cn> - 0.1.0-1
- First release of the nestos-kubernetes-deployer rpm package
