Auto-increment chart versions

Enable auto-versioning of helm charts to ensure the FluxCD
helm controller recognizes chart changes for rook-ceph.

The structure of custom and upstream is following the template created
on the oid-auth-armada-app
(https://review.opendev.org/c/starlingx/oidc-auth-armada-app/+/909914).

Test Plan:
PASS: Build all packages generating an application tarball verifying
      all versions on the charts and application make sense.
PASS: Introduce temporary chart changes and ensure that the versions
      increment as expected (rook-ceph-1.7.11+STX.4.tgz and
      rook-ceph-cluster-1.7.11+STX.4.tgz charts inside
      rook-ceph-migration package).
PASS: Validate basic application lifecycle operations:
      upload/apply/remove/delete
PASS: Create a volume using PVC through cephfs and test read/write
      on the corresponding pools at SX plaforms.

Story: 2010929
Task: 50063

Change-Id: I8cae4c09da7686fbdc3279c3478f5ce30a47b76a
Signed-off-by: Luiz Felipe Kina <LuizFelipe.EiskeKina@windriver.com>
This commit is contained in:
Luiz Felipe Kina 2024-05-08 10:20:35 -03:00
parent 340492c793
commit 5a72dd467c
44 changed files with 142 additions and 28 deletions

View File

@ -1,3 +1,5 @@
migration-rook-ceph-helm
helm-charts/custom/migration-rook-ceph-provisioner-helm
helm-charts/upstream/migration-rook-ceph-helm
python3-k8sapp-migration-rook-ceph
stx-migration-rook-ceph-helm

View File

@ -0,0 +1,5 @@
migration-rook-ceph-provisioner-helm (1.1-0) unstable; urgency=medium
* Initial release.
-- Luiz Felipe Kina <LuizFelipe.EiskeKina@windriver.com> Tue, 14 May 2024 10:45:00 +0000

View File

@ -0,0 +1,16 @@
Source: migration-rook-ceph-provisioner-helm
Section: libs
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13),
helm,
Standards-Version: 4.5.1
Homepage: https://www.starlingx.io
Package: migration-rook-ceph-provisioner-helm
Section: libs
Architecture: any
Depends: ${misc:Depends}
Description: StarlingX Platform Migration Rook Ceph provisioner helm chart
This package contains integrations and audits for Migration Rook Ceph StarlingX app.

View File

@ -0,0 +1,42 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: migration-rook-ceph-provisioner-helm
Source: https://opendev.org/starlingx/platform-armada-app/
Files: *
Copyright: (c) 2024 Wind River Systems, Inc
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
.
https://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'.
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2024 Wind River Systems, Inc
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
.
https://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'.

View File

@ -0,0 +1,28 @@
#!/usr/bin/make -f
#export DH_VERBOSE = 1
export ROOT = debian/tmp
export APP_FOLDER = $(ROOT)/usr/lib/helm
export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
export PATCH_VERSION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
export CHART_BASE_VERSION = $(shell echo $(DEB_VERSION) | sed 's/-/./' | cut -d '.' -f 1-3)
export CHART_VERSION = $(CHART_BASE_VERSION)
%:
dh $@
override_dh_auto_build:
# Stage the chart for building
mkdir -p build
mv Makefile migration-rook-ceph-provisioner build
# Build the chart
cd build && make CHART_VERSION=$(CHART_VERSION) migration-rook-ceph-provisioner
override_dh_auto_install:
install -d -m 755 $(APP_FOLDER)
install -p -D -m 755 build/rook-ceph-provisioner*.tgz $(APP_FOLDER)
override_dh_auto_test:

View File

@ -0,0 +1,9 @@
---
debname: migration-rook-ceph-provisioner-helm
debver: 1.1-0
src_path: migration-rook-ceph-provisioner-helm
revision:
dist: $STX_DIST
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/rook-ceph/helm-charts/custom/migration-rook-ceph-provisioner-helm/migration-rook-ceph-provisioner-helm
BASE_SRCREV: 340492c793197d5a3ceb77cbe1087c3aaea2450a

View File

@ -30,12 +30,11 @@ lint-%: init-%
if [ -d $* ]; then helm lint $*; fi
build-%: lint-%
if [ -d $* ]; then helm package $*; fi
if [ -d $* ]; then helm package --version $(CHART_VERSION) $*; fi
clean:
@echo "Clean all build artifacts"
rm -f */templates/_partials.tpl */templates/_globals.tpl
rm -f *tgz */charts/*tgz
rm -rf */charts */tmpcharts
%:

View File

@ -11,5 +11,5 @@ Package: migration-rook-ceph-helm
Section: libs
Architecture: any
Depends: ${misc:Depends}
Description: StarlingX Rook-Ceph Helm Charts
This package contains helm charts for the Rook-Ceph application.
Description: StarlingX Migration Rook-Ceph Helm Charts
This package contains helm charts for the Migration Rook-Ceph application.

View File

@ -1,6 +1,11 @@
#!/usr/bin/make -f
export DH_VERBOSE = 1
export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
export PATCH_VERSION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
export CHART_BASE_VERSION = $(shell echo $(DEB_VERSION) | sed 's/-/./' | cut -d '.' -f 1-3)
export CHART_VERSION = $(CHART_BASE_VERSION)+STX.$(PATCH_VERSION)
export ROOT = debian/tmp
export APP_FOLDER = $(ROOT)/usr/lib/helm
@ -14,8 +19,9 @@ override_dh_auto_build:
cp -r cluster/charts/* migration-rook-ceph-helm
cp Makefile migration-rook-ceph-helm
cd migration-rook-ceph-helm && make rook-ceph
cd migration-rook-ceph-helm && make rook-ceph-cluster
# Create the tgz file
cd migration-rook-ceph-helm && make CHART_VERSION=$(CHART_VERSION) rook-ceph
cd migration-rook-ceph-helm && make CHART_VERSION=$(CHART_VERSION) rook-ceph-cluster
override_dh_auto_install:
# Install the app tar file.

View File

@ -9,5 +9,7 @@ src_files:
- migration-rook-ceph-helm/files/Makefile
revision:
dist: $STX_DIST
stx_patch: 3
GITREVCOUNT:
BASE_SRCREV: 10c623509a68acad945d4e0c06a86b3e8486ad5b
BASE_SRCREV: 340492c793197d5a3ceb77cbe1087c3aaea2450a
SRC_DIR: ${MY_REPO}/stx/rook-ceph/helm-charts/upstream/migration-rook-ceph-helm

View File

@ -1,7 +1,7 @@
#
# Copyright 2017 The Openstack-Helm Authors.
#
# Copyright (c) 2019-2024 Wind River Systems, Inc.
# Copyright (c) 2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -25,18 +25,16 @@ $(CHARTS):
init-%:
if [ -f $*/Makefile ]; then make -C $*; fi
if [ -f $*/requirements.yaml ]; then helm dep up $*; fi
lint-%: init-%
if [ -d $* ]; then helm lint $*; fi
build-%: lint-%
if [ -d $* ]; then helm package $*; fi
if [ -d $* ]; then helm package --version $(CHART_VERSION) $*; fi
clean:
@echo "Clean all build artifacts"
rm -f */templates/_partials.tpl */templates/_globals.tpl
rm -f *tgz */charts/*tgz */requirements.lock
rm -rf */charts */tmpcharts
%:

View File

@ -5,6 +5,7 @@ Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13),
helm,
migration-rook-ceph-helm,
migration-rook-ceph-provisioner-helm,
python3-k8sapp-migration-rook-ceph-wheels,
Standards-Version: 4.1.2
Homepage: https://www.starlingx.io

View File

@ -11,29 +11,36 @@ export REVISION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
export APP_NAME = rook-ceph-migration
export APP_VERSION = $(RELEASE)-$(REVISION)
export APP_TARBALL_FLUXCD = $(APP_NAME)-$(APP_VERSION).tgz
export APP_TARBALL = $(APP_NAME)-$(APP_VERSION).tgz
export HELM_REPO = stx-platform
export HELM_FOLDER = /usr/lib/helm
export STAGING = staging-fluxcd
export STAGING = staging
%:
dh $@
override_dh_auto_build:
# Create the TGZ file.
cd helm-charts && make rook-ceph-provisioner
# Setup staging
mkdir -p $(STAGING)
cp files/metadata.yaml $(STAGING)
cp -Rv fluxcd-manifests $(STAGING)
mkdir -p $(STAGING)/charts
cp helm-charts/*.tgz $(STAGING)/charts
cp $(HELM_FOLDER)/rook-ceph*.tgz $(STAGING)/charts
cp /usr/lib/helm/*.tgz $(STAGING)/charts
# Adjust the helmrelease yamls based on the chart versions
for c in $(STAGING)/charts/*; do \
chart=$$(basename $$c .tgz); \
chart_name=$${chart%-*}; \
chart_version=$${chart##*-}; \
echo "Found $$chart; name: $$chart_name, version: $$chart_version"; \
chart_manifest=$$(find $(STAGING)/fluxcd-manifests -name helmrelease.yaml -exec grep -q "chart:.*$$chart_name" {} \; -print); \
echo "Updating manifest: $$chart_manifest"; \
sed -i "s/REPLACE_HELM_CHART_VERSION/$$chart_version/g" $$chart_manifest; \
grep version $$chart_manifest; \
done
# Populate metadata
sed -i 's/APP_REPLACE_NAME/$(APP_NAME)/g' $(STAGING)/metadata.yaml
@ -47,7 +54,7 @@ override_dh_auto_build:
# Package it up
cd $(STAGING)
find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar -zcf $(APP_TARBALL_FLUXCD) -C $(STAGING)/ .
tar -zcf $(APP_TARBALL) -C $(STAGING)/ .
# Cleanup staging
rm -fr $(STAGING)
@ -56,7 +63,7 @@ override_dh_auto_install:
# Install the app tar file
install -d -m 755 $(APP_FOLDER)
install -d -m 755 $(INITRD_DIR)
install -p -D -m 755 $(APP_TARBALL_FLUXCD) $(APP_FOLDER)
install -p -D -m 755 $(APP_TARBALL) $(APP_FOLDER)
install -m 750 files/rook-mon-exit.sh $(INITRD_DIR)/rook-mon-exit
# Prevents dh_fixperms from changing the permissions defined in this file

View File

@ -15,7 +15,7 @@ spec:
chart:
spec:
chart: rook-ceph
version: 1.7.11
version: REPLACE_HELM_CHART_VERSION
sourceRef:
kind: HelmRepository
name: stx-platform

View File

@ -1,5 +0,0 @@
dependencies:
# - name: rook-ceph
#repository: http://localhost:8879
#version: 0.1.0
#alias: rook-operator