From 3d5e02157851d140f7cddacbe5086f6e6c12e26c Mon Sep 17 00:00:00 2001 From: Mihnea Saracin Date: Wed, 20 Oct 2021 15:04:46 +0300 Subject: [PATCH] Add debian package for k8s-pod-recovery - Built the package - Built the iso - Verified if the package was installed correctly Story: 2009101 Task: 43697 Change-Id: Id10c87f9a24329b533864411075e096f56dbcd8b Signed-off-by: Mihnea Saracin --- debian_pkg_dirs | 1 + .../debian/deb_folder/changelog | 5 ++++ .../debian/deb_folder/control | 17 ++++++++++++ .../debian/deb_folder/copyright | 22 +++++++++++++++ .../debian/deb_folder/k8s-pod-recovery.dirs | 3 +++ .../deb_folder/k8s-pod-recovery.install | 2 ++ .../k8s-pod-recovery.lintian-overrides | 2 ++ .../deb_folder/k8s-pod-recovery.postinst | 21 +++++++++++++++ .../debian/deb_folder/k8s-pod-recovery.prerm | 13 +++++++++ .../k8s-pod-recovery/debian/deb_folder/rules | 27 +++++++++++++++++++ .../debian/deb_folder/source/format | 1 + kubernetes/k8s-pod-recovery/debian/dl_hook | 10 +++++++ .../k8s-pod-recovery/debian/meta_data.yaml | 7 +++++ 13 files changed, 131 insertions(+) create mode 100644 kubernetes/k8s-pod-recovery/debian/deb_folder/changelog create mode 100644 kubernetes/k8s-pod-recovery/debian/deb_folder/control create mode 100644 kubernetes/k8s-pod-recovery/debian/deb_folder/copyright create mode 100644 kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.dirs create mode 100644 kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.install create mode 100644 kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.lintian-overrides create mode 100644 kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.postinst create mode 100644 kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.prerm create mode 100755 kubernetes/k8s-pod-recovery/debian/deb_folder/rules create mode 100644 kubernetes/k8s-pod-recovery/debian/deb_folder/source/format create mode 100755 kubernetes/k8s-pod-recovery/debian/dl_hook create mode 100644 kubernetes/k8s-pod-recovery/debian/meta_data.yaml diff --git a/debian_pkg_dirs b/debian_pkg_dirs index 0fb58d3df..21c30938e 100644 --- a/debian_pkg_dirs +++ b/debian_pkg_dirs @@ -21,4 +21,5 @@ filesystem/drbd/drbd-tools filesystem/parted kubernetes/chartmuseum kubernetes/helm +kubernetes/k8s-pod-recovery storage-drivers/trident-installer diff --git a/kubernetes/k8s-pod-recovery/debian/deb_folder/changelog b/kubernetes/k8s-pod-recovery/debian/deb_folder/changelog new file mode 100644 index 000000000..4eb1eacbc --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +k8s-pod-recovery (1.0-1) unstable; urgency=medium + + * Initial release + + -- Mihnea Saracin Mon, 18 Oct 2021 12:51:12 +0000 diff --git a/kubernetes/k8s-pod-recovery/debian/deb_folder/control b/kubernetes/k8s-pod-recovery/debian/deb_folder/control new file mode 100644 index 000000000..a23aa985f --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/deb_folder/control @@ -0,0 +1,17 @@ +Source: k8s-pod-recovery +Section: admin +Priority: optional +Maintainer: StarlingX Developers +Build-Depends: debhelper-compat (= 13) +Standards-Version: 4.4.1 +Homepage: https://www.starlingx.io +Rules-Requires-Root: no + +Package: k8s-pod-recovery +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends}, + systemd +Description: Kubernetes Pod Recovery Service + This service will recover k8s pods that are in bad states + diff --git a/kubernetes/k8s-pod-recovery/debian/deb_folder/copyright b/kubernetes/k8s-pod-recovery/debian/deb_folder/copyright new file mode 100644 index 000000000..6db152982 --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/deb_folder/copyright @@ -0,0 +1,22 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: k8s-pod-recovery +Source: https://opendev.org/starlingx/integ/src/branch/master/kubernetes/k8s-pod-recovery + +Files: * +Copyright: (c) 2020-2021 Wind River Systems, Inc + (c) Others (See individual files for more details) +License: Apache-2 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. diff --git a/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.dirs b/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.dirs new file mode 100644 index 000000000..bc6d14a0c --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.dirs @@ -0,0 +1,3 @@ +etc/k8s-post-recovery.d +usr/local/sbin +lib/systemd/system diff --git a/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.install b/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.install new file mode 100644 index 000000000..5c28c5d65 --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.install @@ -0,0 +1,2 @@ +usr/local/sbin/k8s-pod-recovery +lib/systemd/system/k8s-pod-recovery.service diff --git a/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.lintian-overrides b/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.lintian-overrides new file mode 100644 index 000000000..184f14509 --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.lintian-overrides @@ -0,0 +1,2 @@ +file-in-usr-local +dir-in-usr-local diff --git a/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.postinst b/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.postinst new file mode 100644 index 000000000..cf42c002d --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.postinst @@ -0,0 +1,21 @@ +#!/bin/sh +# see: dh_installdeb(1) + +set -e + +if [ "${1}" = "configure" ] ; then + # 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 || : + else + # 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 || : + fi +fi + +#DEBHELPER# + +exit 0 diff --git a/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.prerm b/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.prerm new file mode 100644 index 000000000..c0b654124 --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/deb_folder/k8s-pod-recovery.prerm @@ -0,0 +1,13 @@ +#!/bin/sh +# see: dh_installdeb(1) + +set -e + +if [ "${1}" = "remove" ] || [ "${1}" = "upgrade" || [ "${1}" = "deconfigure" ]; 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 + +#DEBHELPER# + +exit 0 diff --git a/kubernetes/k8s-pod-recovery/debian/deb_folder/rules b/kubernetes/k8s-pod-recovery/debian/deb_folder/rules new file mode 100755 index 000000000..d4b4bbaa6 --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/deb_folder/rules @@ -0,0 +1,27 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + + +DEBIAN_DESTDIR := $(CURDIR)/debian/tmp + + +%: + dh $@ + +override_dh_auto_test: + echo + +override_dh_auto_install: + echo + +override_dh_install: + install -d ${DEBIAN_DESTDIR}/etc/k8s-post-recovery.d + install -d ${DEBIAN_DESTDIR}/usr/local/sbin + install -m 755 k8s-pod-recovery ${DEBIAN_DESTDIR}/usr/local/sbin/k8s-pod-recovery + install -p -D -m 644 k8s-pod-recovery.service ${DEBIAN_DESTDIR}/lib/systemd/system/k8s-pod-recovery.service + dh_install + +override_dh_usrlocal: + echo diff --git a/kubernetes/k8s-pod-recovery/debian/deb_folder/source/format b/kubernetes/k8s-pod-recovery/debian/deb_folder/source/format new file mode 100644 index 000000000..163aaf8d8 --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/kubernetes/k8s-pod-recovery/debian/dl_hook b/kubernetes/k8s-pod-recovery/debian/dl_hook new file mode 100755 index 000000000..13d8b2878 --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/dl_hook @@ -0,0 +1,10 @@ +#!/bin/bash + +set -x + +PKG_BUILD_NAME=$1 +mkdir ${PKG_BUILD_NAME} + +FILES_SRC=$MY_REPO/stx/integ/kubernetes/k8s-pod-recovery/centos/files/* + +cp ${FILES_SRC} ${PKG_BUILD_NAME} diff --git a/kubernetes/k8s-pod-recovery/debian/meta_data.yaml b/kubernetes/k8s-pod-recovery/debian/meta_data.yaml new file mode 100644 index 000000000..38384c094 --- /dev/null +++ b/kubernetes/k8s-pod-recovery/debian/meta_data.yaml @@ -0,0 +1,7 @@ +--- +debname: k8s-pod-recovery +debver: 1.0-1 +dl_hook: dl_hook +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true