852ec5ed53
At startup, there might be pods that are left in unknown states. The k8s-pod-recovery service takes care of recovering these unknown pods in specific namespaces. To fix this for custom apps that are not part of starlingx, we modify the service to look into the /etc/k8s-post-recovery.d directory for conf files. Any app that needs to be recovered by this service will have to create a conf file e.g the app-1 will create /etc/k8s-post-recovery.d/APP_1.conf which will contain the following: namespace=app-1-namespace Closes-Bug: 1917781 Signed-off-by: Mihnea Saracin <Mihnea.Saracin@windriver.com> Change-Id: I8febdb685d506cff3c34946163612cafdab3e3a8
56 lines
1.6 KiB
RPMSpec
56 lines
1.6 KiB
RPMSpec
Name: k8s-pod-recovery
|
|
Version: 1.0
|
|
Release: 0%{?_tis_dist}.%{tis_patch_ver}
|
|
Summary: Kubernetes Pod Recovery Service
|
|
License: Apache-2.0
|
|
Group: base
|
|
Packager: Wind River <info@windriver.com>
|
|
URL: unknown
|
|
Source0: k8s-pod-recovery
|
|
Source1: k8s-pod-recovery.service
|
|
|
|
Requires: /bin/bash
|
|
Requires: systemd
|
|
|
|
%description
|
|
%{summary}
|
|
|
|
%define local_dir /usr/local
|
|
%define local_sbindir %{local_dir}/sbin
|
|
%define k8s_recovery_conf_dir /etc/k8s-post-recovery.d
|
|
|
|
%prep
|
|
|
|
%install
|
|
install -d %{buildroot}%{k8s_recovery_conf_dir}
|
|
install -d %{buildroot}%{local_sbindir}
|
|
install -m 755 %{SOURCE0} %{buildroot}%{local_sbindir}/k8s-pod-recovery
|
|
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/k8s-pod-recovery.service
|
|
|
|
%post
|
|
if [ $1 -eq 1 ]; then
|
|
# Package install: enable and start it
|
|
/usr/bin/systemctl enable k8s-pod-recovery.service > /dev/null 2>&1 || :
|
|
/usr/bin/systemctl start k8s-pod-recovery.service > /dev/null 2>&1 || :
|
|
else
|
|
# Package upgrade: reenable in case [Install] changes and restart to pick up
|
|
# new actions
|
|
if /usr/bin/systemctl --quiet is-enabled k8s-pod-recovery.service ; then
|
|
/usr/bin/systemctl reenable k8s-pod-recovery.service > /dev/null 2>&1 || :
|
|
/usr/bin/systemctl restart k8s-pod-recovery.service > /dev/null 2>&1 || :
|
|
fi
|
|
fi
|
|
|
|
%preun
|
|
if [ $1 -eq 0 ]; then
|
|
/usr/bin/systemctl stop k8s-pod-recovery.service > /dev/null 2>&1 || :
|
|
/usr/bin/systemctl disable k8s-pod-recovery.service > /dev/null 2>&1 || :
|
|
fi
|
|
|
|
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
%{local_sbindir}/k8s-pod-recovery
|
|
%{_unitdir}/k8s-pod-recovery.service
|
|
%{k8s_recovery_conf_dir}
|