Standardize app configs

Fixed versioning and adjusted some build files
to bring them as close to a standard as possible.

- Removed centos files, however stx_ceph_manager
  docker image tag is still master-centos-stable-latest
- Added debian_pkg_dirs and debian_iso_image.inc
  (stx-rook-ceph-helm not added into the debian iso)

- Added version tracking via GITREVCOUNT
- Fixed mismatch in plugin name, set to python3-k8sapp-<app>
- Standardized plugin debian files (rules, *.install)
- Plugin wheels saved to /plugin instead of /plugin/<app>

- Removed some Armada hooks and files which were preventing
  the app from uploading on the debian system

Note: app name is not in line with the stx-APP-helm template

Test Plan:
PASS - Build-pkgs
PASS - app tarball contains wheel file
PASS - wheel versioning updated properly
PASS - app upload

Story: 2010542
Task: 47250

Depends-On: https://review.opendev.org/c/starlingx/rook-ceph/+/842363

Signed-off-by: Leonardo Fagundes Luz Serrano <Leonardo.FagundesLuzSerrano@windriver.com>
Change-Id: I5aedaa509914dad45cab667d33253cb3926c8053
This commit is contained in:
Leonardo Fagundes Luz Serrano 2023-02-01 18:12:24 +00:00
parent 69e5e88486
commit dfba3a27df
48 changed files with 67 additions and 350 deletions

@ -34,10 +34,10 @@
- starlingx/update
- starlingx/utilities
files:
- python-k8sapp-rook/*
- python3-k8sapp-rook/*
vars:
tox_envlist: py27
tox_extra_args: -c python-k8sapp-rook/k8sapp_rook/tox.ini
tox_extra_args: -c python3-k8sapp-rook/k8sapp_rook/tox.ini
- job:
name: k8sapp-rook-ceph-tox-py39
@ -51,11 +51,11 @@
- starlingx/update
- starlingx/utilities
files:
- python-k8sapp-rook/*
- python3-k8sapp-rook/*
vars:
python_version: 3.9
tox_envlist: py39
tox_extra_args: -c python-k8sapp-rook/k8sapp_rook/tox.ini
tox_extra_args: -c python3-k8sapp-rook/k8sapp_rook/tox.ini
- job:
@ -65,10 +65,10 @@
Run flake8 test for k8sapp_rook_ceph
nodeset: ubuntu-focal
files:
- python-k8sapp-rook/*
- python3-k8sapp-rook/*
vars:
tox_envlist: flake8
tox_extra_args: -c python-k8sapp-rook/k8sapp_rook/tox.ini
tox_extra_args: -c python3-k8sapp-rook/k8sapp_rook/tox.ini
- job:
name: k8sapp-rook-ceph-tox-pylint
@ -82,10 +82,10 @@
- starlingx/update
- starlingx/utilities
files:
- python-k8sapp-rook/*
- python3-k8sapp-rook/*
vars:
tox_envlist: pylint
tox_extra_args: -c python-k8sapp-rook/k8sapp_rook/tox.ini
tox_extra_args: -c python3-k8sapp-rook/k8sapp_rook/tox.ini
- job:
name: k8sapp-rook-ceph-tox-bandit
@ -94,10 +94,10 @@
Run bandit test for k8sapp_rook_ceph
nodeset: ubuntu-focal
files:
- python-k8sapp-rook/*
- python3-k8sapp-rook/*
vars:
tox_envlist: bandit
tox_extra_args: -c python-k8sapp-rook/k8sapp_rook/tox.ini
tox_extra_args: -c python3-k8sapp-rook/k8sapp_rook/tox.ini
- job:
name: stx-rook-ceph-apps-upload-git-mirror

@ -1,11 +1,11 @@
StarlingX Rook-Ceph-Armada-App Style Commandments
StarlingX Rook-Ceph-App Style Commandments
================================================
- Step 1: Read the OpenStack style commandments
https://docs.openstack.org/hacking/latest/
- Step 2: Read on
Rook-Ceph-Armada-App Specific Commandments
Rook-Ceph-App Specific Commandments
-----------------------------------------
None so far

@ -1 +0,0 @@
flock

@ -1 +0,0 @@
stx-rook-ceph

@ -1,2 +0,0 @@
stx-rook-ceph
python-k8sapp-rook

2
debian_iso_image.inc Normal file

@ -0,0 +1,2 @@
#stx-rook-ceph
#stx-rook-ceph (not being added to the iso)

2
debian_pkg_dirs Normal file

@ -0,0 +1,2 @@
python3-k8sapp-rook
stx-rook-ceph

@ -1,5 +0,0 @@
SRC_DIR="k8sapp_rook"
OPT_DEP_LIST="$STX_BASE/rook-ceph/stx-rook-ceph"
TIS_BASE_SRCREV=10c623509a68acad945d4e0c06a86b3e8486ad5b
TIS_PATCH_VER=GITREVCOUNT

@ -1,57 +0,0 @@
%global app_name rook-ceph-apps
%global pypi_name k8sapp-rook
%global sname k8sapp_rook
Name: python-%{pypi_name}
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
Summary: StarlingX sysinv extensions: Rook Ceph K8S app
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python-setuptools
BuildRequires: python-pbr
BuildRequires: python2-pip
BuildRequires: python2-wheel
%description
StarlingX sysinv extensions: Rook Ceph K8S app
%prep
%setup
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%build
export PBR_VERSION=%{version}
%{__python2} setup.py build
%py2_build_wheel
%install
export PBR_VERSION=%{version}.%{tis_patch_ver}
export SKIP_PIP_INSTALL=1
%{__python2} setup.py install --skip-build --root %{buildroot}
mkdir -p ${RPM_BUILD_ROOT}/plugins/%{app_name}
install -m 644 dist/*.whl ${RPM_BUILD_ROOT}/plugins/%{app_name}/
%files
%{python2_sitelib}/%{sname}
%{python2_sitelib}/%{sname}-*.egg-info
%package wheels
Summary: %{name} wheels
%description wheels
Contains python wheels for %{name}
%files wheels
/plugins/*
%changelog
* Tue Jun 2 2020 Martin Chen <haochuan.z.chen@intel.com>
- Initial version

@ -1,2 +0,0 @@
usr/lib/python3/dist-packages/k8sapp_rook-1.0.0.egg-info/*
usr/lib/python3/dist-packages/k8sapp_rook/*

@ -1,26 +0,0 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export APP_NAME=rook-ceph-apps
export PBR_VERSION=1.0.0
export PYBUILD_NAME=k8sapp-rook
export SKIP_PIP_INSTALL=1
export ROOT=debian/tmp
%:
dh $@ --with=python3 --buildsystem=pybuild
override_dh_auto_install:
python3 setup.py install --install-layout=deb --root $(ROOT)
python3 setup.py bdist_wheel \
--universal \
-d $(ROOT)/plugins/$(APP_NAME)
override_dh_python3:
dh_python3 --shebang=/usr/bin/python3
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
# (tbogue) FIXME
PYTHONDIR=$(CURDIR) stestr run || true
endif

@ -1,7 +0,0 @@
---
debname: python3-k8sapp-rook
debver: 1.0-1
src_path: k8sapp_rook
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

@ -16,13 +16,11 @@ Section: libs
Architecture: any
Depends: ${misc:Depends}, ${python3:Depends}
Description: StarlingX Sysinv Rook Ceph Extensions
This package contains sysinv plugins for the Rook Ceph armada
K8S app.
Sysinv plugins for the Rook Ceph K8S app.
Package: python3-k8sapp-rook-wheels
Section: libs
Architecture: any
Depends: ${misc:Depends}, ${python3:Depends}, python3-wheel
Description: StarlingX Sysinv Rook Ceph Extension Wheels
This package contains python wheels for the Rook Ceph platform armada
K8S app plugins.
Python wheels for the Rook Ceph K8S app plugins.

@ -0,0 +1 @@
usr/lib/python3/dist-packages/k8sapp_*

@ -0,0 +1,33 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export APP_NAME = rook-ceph-apps
export PYBUILD_NAME = k8sapp-rook
export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
export MAJOR = $(shell echo $(DEB_VERSION) | cut -f 1 -d '-')
export MINOR_PATCH = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
export PBR_VERSION = $(MAJOR).$(MINOR_PATCH)
export ROOT = $(CURDIR)/debian/tmp
export SKIP_PIP_INSTALL = 1
%:
dh $@ --with=python3 --buildsystem=pybuild
override_dh_auto_install:
env | sort
python3 setup.py install \
--install-layout=deb \
--root $(ROOT)
python3 setup.py bdist_wheel \
--universal \
-d $(ROOT)/plugins
override_dh_python3:
dh_python3 --shebang=/usr/bin/python3
override_dh_auto_test:
PYTHONDIR=$(CURDIR) stestr run

@ -0,0 +1,9 @@
---
debname: python3-k8sapp-rook
debver: 1.0-1
src_path: k8sapp_rook
revision:
dist: $STX_DIST
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/rook-ceph
BASE_SRCREV: 10c623509a68acad945d4e0c06a86b3e8486ad5b

@ -39,11 +39,8 @@ systemconfig.helm_plugins.rook_ceph_apps =
002_rook-ceph = k8sapp_rook.helm.rook_ceph:RookCephHelm
003_rook-ceph-provisioner = k8sapp_rook.helm.rook_ceph_provisioner:RookCephProvisionerHelm
systemconfig.armada.manifest_ops =
rook-ceph-apps = k8sapp_rook.armada.manifest_rook_ceph:RookCephArmadaManifestOperator
systemconfig.app_lifecycle =
rook-ceph-apps = k8sapp_rook.lifecycle.lifecycle_rook_ceph:RookCephAppLifecycleOperator
[wheel]
[bdist_wheel]
universal = 1

@ -1,8 +0,0 @@
SRC_DIR="stx-rook-ceph"
COPY_LIST="files/* $PKG_BASE/$SRC_DIR/fluxcd-manifests/*"
EXCLUDE_LIST_FROM_TAR=".stestr"
OPT_DEP_LIST="$STX_BASE/rook-ceph/python-k8sapp-rook"
TIS_BASE_SRCREV=10c623509a68acad945d4e0c06a86b3e8486ad5b
TIS_PATCH_VER=GITREVCOUNT

@ -1,119 +0,0 @@
# Application tunables (maps to metadata)
%global app_name rook-ceph-apps
%global helm_repo stx-platform
# Install location
%global app_folder /usr/local/share/applications/helm
# Build variables
%global helm_folder /usr/lib/helm
#%global toolkit_version 0.1.0
%global rook_version 1.9.6
Summary: StarlingX K8S application: Rook Ceph
Name: stx-rook-ceph
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Intel
URL: unknown
Source0: %{name}-%{version}.tar.gz
Source1: rook-mon-exit.sh
BuildArch: noarch
BuildRequires: helm
BuildRequires: openstack-helm-infra
BuildRequires: chartmuseum
BuildRequires: python-k8sapp-rook
BuildRequires: python-k8sapp-rook-wheels
%description
The StarlingX K8S application for Rook Ceph
%package fluxcd
Summary: StarlingX K8s application for Rook Ceph FluxCD
Group: base
License: Apache-2.0
%description fluxcd
StarlingX K8s application for Rook Ceph FluxCD
%prep
%setup
%build
# Host a server for the charts
chartmuseum --debug --port=8879 --context-path='/charts' --storage="local" --storage-local-rootdir="./helm-charts" &
sleep 2
helm repo add local http://localhost:8879/charts
# Make the charts. These produce a tgz file
cd helm-charts
make rook-operator
make rook-ceph
make rook-ceph-provisioner
cd -
# Terminate helm server (the last backgrounded task)
kill %1
# Create a chart tarball compliant with sysinv kube-app.py
%define app_staging %{_builddir}/staging
%define app_tarball_armada %{app_name}-%{version}-%{tis_patch_ver}.tgz
%define app_tarball_fluxcd %{app_name}-fluxcd-%{version}-%{tis_patch_ver}.tgz
# Setup staging
mkdir -p %{app_staging}
cp files/metadata.yaml %{app_staging}
cp manifests/manifest.yaml %{app_staging}
mkdir -p %{app_staging}/charts
cp helm-charts/*.tgz %{app_staging}/charts
cd %{app_staging}
# Populate metadata
sed -i 's/@APP_NAME@/%{app_name}/g' %{app_staging}/metadata.yaml
sed -i 's/@APP_VERSION@/%{version}-%{tis_patch_ver}/g' %{app_staging}/metadata.yaml
sed -i 's/@HELM_REPO@/%{helm_repo}/g' %{app_staging}/metadata.yaml
# Copy the plugins: installed in the buildroot
mkdir -p %{app_staging}/plugins
cp /plugins/%{app_name}/*.whl %{app_staging}/plugins
# package Armada
find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar -zcf %{_builddir}/%{app_tarball_armada} -C %{app_staging}/ .
# package FluxCD
rm -f %{app_staging}/manifest.yaml
cd -
cp -R fluxcd-manifests %{app_staging}/
cd %{app_staging}
find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar -zcf %{_builddir}/%{app_tarball_fluxcd} -C %{app_staging}/ .
cd -
# Cleanup staging
rm -fr %{app_staging}
%install
install -d -m 755 %{buildroot}/%{app_folder}
install -d -m 755 %{buildroot}%{_initrddir}
install -p -D -m 755 %{_builddir}/%{app_tarball_armada} %{buildroot}/%{app_folder}
install -m 750 %{SOURCE1} %{buildroot}%{_initrddir}/rook-mon-exit
install -p -D -m 755 %{_builddir}/%{app_tarball_fluxcd} %{buildroot}/%{app_folder}
%files
%defattr(-,root,root,-)
%{app_folder}/%{app_tarball_armada}
%{_initrddir}/rook-mon-exit
%files fluxcd
%defattr(-,root,root,-)
%{app_folder}/%{app_tarball_fluxcd}

@ -56,7 +56,7 @@ override_dh_auto_build:
# Copy the plugins: installed in the buildroot
mkdir -p $(STAGING_FLUXCD)/plugins
cp /plugins/$(APP_NAME)/*.whl $(STAGING_FLUXCD)/plugins
cp /plugins/*.whl $(STAGING_FLUXCD)/plugins
# Package it up
cd $(STAGING_FLUXCD)

@ -6,4 +6,6 @@ src_files:
- files
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/rook-ceph
BASE_SRCREV: 10c623509a68acad945d4e0c06a86b3e8486ad5b

@ -1,99 +0,0 @@
---
schema: armada/Chart/v1
metadata:
schema: metadata/Document/v1
name: kube-system-rook-operator
data:
chart_name: rook-operator
release: rook-operator
namespace: kube-system
wait:
resources:
- type: pod
labels:
app: rook-ceph-operator
timeout: 1800
install:
no_hooks: false
upgrade:
no_hooks: false
source:
type: tar
location: http://172.17.0.1:8080/helm_charts/stx-platform/rook-operator-0.1.0.tgz
subpath: rook-operator
reference: master
dependencies: []
---
schema: armada/Chart/v1
metadata:
schema: metadata/Document/v1
name: kube-system-rook-ceph
data:
chart_name: rook-ceph
release: rook-ceph
namespace: kube-system
wait:
resources:
- type: pod
labels:
app: rook-ceph-mgr
- type: pod
labels:
app: rook-ceph-mon
- type: pod
labels:
app: rook-ceph-osd
timeout: 1800
install:
no_hooks: false
upgrade:
no_hooks: false
source:
type: tar
location: http://172.17.0.1:8080/helm_charts/stx-platform/rook-ceph-0.1.0.tgz
subpath: rook-ceph
reference: master
dependencies: []
---
schema: armada/Chart/v1
metadata:
schema: metadata/Document/v1
name: kube-system-rook-ceph-provisioner
data:
chart_name: rook-ceph-provisioner
release: rook-ceph-provisioner
namespace: kube-system
wait:
resources:
- type: job
labels:
release: stx-rook-ceph-provisioner
install:
no_hooks: false
source:
type: tar
location: http://172.17.0.1:8080/helm_charts/stx-platform/rook-ceph-provisioner-0.1.0.tgz
subpath: rook-ceph-provisioner
reference: master
dependencies: []
---
schema: armada/ChartGroup/v1
metadata:
schema: metadata/Document/v1
name: starlingx-rook-charts
data:
description: StarlingX Rook Ceph Charts
sequenced: true
chart_group:
- kube-system-rook-operator
- kube-system-rook-ceph
- kube-system-rook-ceph-provisioner
---
schema: armada/Manifest/v1
metadata:
schema: metadata/Document/v1
name: rook-ceph-manifest
data:
release_prefix: stx
chart_groups:
- starlingx-rook-charts