diff --git a/debian_pkg_dirs b/debian_pkg_dirs index 89cf9b4..209ea20 100644 --- a/debian_pkg_dirs +++ b/debian_pkg_dirs @@ -1,2 +1,3 @@ +helm-charts/custom/snmp-helm python3-k8sapp-snmp stx-snmp-helm diff --git a/helm-charts/custom/snmp-helm/debian/deb_folder/changelog b/helm-charts/custom/snmp-helm/debian/deb_folder/changelog new file mode 100644 index 0000000..9235335 --- /dev/null +++ b/helm-charts/custom/snmp-helm/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +snmp-helm (1.0-0) unstable; urgency=medium + + * Initial release. + + -- Joshua Reed Fri, 16 Feb 2024 20:07:42 +0000 diff --git a/helm-charts/custom/snmp-helm/debian/deb_folder/control b/helm-charts/custom/snmp-helm/debian/deb_folder/control new file mode 100644 index 0000000..aea6177 --- /dev/null +++ b/helm-charts/custom/snmp-helm/debian/deb_folder/control @@ -0,0 +1,15 @@ +Source: snmp-helm +Section: libs +Priority: optional +Maintainer: StarlingX Developers +Build-Depends: debhelper-compat (= 13), + helm, +Standards-Version: 4.5.1 +Homepage: https://www.starlingx.io + +Package: snmp-helm +Section: libs +Architecture: any +Depends: ${misc:Depends} +Description: StarlingX Platform Ceph pool auditor helm chart + This package contains a helm chart to audit the replication factor of Ceph pools. diff --git a/helm-charts/custom/snmp-helm/debian/deb_folder/copyright b/helm-charts/custom/snmp-helm/debian/deb_folder/copyright new file mode 100644 index 0000000..31dbe0c --- /dev/null +++ b/helm-charts/custom/snmp-helm/debian/deb_folder/copyright @@ -0,0 +1,41 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: snmp-helm +Source: https://opendev.org/starlingx/snmp-armada-app/ + +Files: * +Copyright: (c) 2019-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'. diff --git a/helm-charts/custom/snmp-helm/debian/deb_folder/rules b/helm-charts/custom/snmp-helm/debian/deb_folder/rules new file mode 100755 index 0000000..c88258b --- /dev/null +++ b/helm-charts/custom/snmp-helm/debian/deb_folder/rules @@ -0,0 +1,27 @@ +#!/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 RELEASE = $(shell echo $(DEB_VERSION) | cut -f 1 -d '-') +export REVISION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.') +export CHART_VERSION = $(RELEASE).$(REVISION) + +%: + dh $@ + +override_dh_auto_build: + # Stage the chart for building + mkdir -p build + mv Makefile snmp build + + # Build the chart + cd build && make CHART_VERSION=$(CHART_VERSION) snmp + +override_dh_auto_install: + install -d -m 755 $(APP_FOLDER) + install -p -D -m 755 build/snmp*.tgz $(APP_FOLDER) + +override_dh_auto_test: diff --git a/helm-charts/custom/snmp-helm/debian/deb_folder/snmp-helm.install b/helm-charts/custom/snmp-helm/debian/deb_folder/snmp-helm.install new file mode 100644 index 0000000..8a0c6de --- /dev/null +++ b/helm-charts/custom/snmp-helm/debian/deb_folder/snmp-helm.install @@ -0,0 +1 @@ +usr/lib/helm/* diff --git a/helm-charts/custom/snmp-helm/debian/deb_folder/source/format b/helm-charts/custom/snmp-helm/debian/deb_folder/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/helm-charts/custom/snmp-helm/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/helm-charts/custom/snmp-helm/debian/meta_data.yaml b/helm-charts/custom/snmp-helm/debian/meta_data.yaml new file mode 100644 index 0000000..9e04339 --- /dev/null +++ b/helm-charts/custom/snmp-helm/debian/meta_data.yaml @@ -0,0 +1,10 @@ +--- +debname: snmp-helm +debver: 1.0-0 +src_path: snmp-helm +revision: + dist: $STX_DIST + GITREVCOUNT: + stx_patch: 1 + SRC_DIR: ${MY_REPO}/stx/snmp-armada-app/helm-charts/custom/snmp-helm/snmp-helm/snmp + BASE_SRCREV: a0292e8c7c68ae9bc3f5cb19e611777b6126d944 diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/Makefile b/helm-charts/custom/snmp-helm/snmp-helm/Makefile similarity index 100% rename from stx-snmp-helm/stx-snmp-helm/helm-charts/Makefile rename to helm-charts/custom/snmp-helm/snmp-helm/Makefile diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/.helmignore b/helm-charts/custom/snmp-helm/snmp-helm/snmp/.helmignore similarity index 100% rename from stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/.helmignore rename to helm-charts/custom/snmp-helm/snmp-helm/snmp/.helmignore diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/Chart.yaml b/helm-charts/custom/snmp-helm/snmp-helm/snmp/Chart.yaml similarity index 100% rename from stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/Chart.yaml rename to helm-charts/custom/snmp-helm/snmp-helm/snmp/Chart.yaml diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/snmpd/snmpd.conf b/helm-charts/custom/snmp-helm/snmp-helm/snmp/snmpd/snmpd.conf similarity index 100% rename from stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/snmpd/snmpd.conf rename to helm-charts/custom/snmp-helm/snmp-helm/snmp/snmpd/snmpd.conf diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/NOTES.txt b/helm-charts/custom/snmp-helm/snmp-helm/snmp/templates/NOTES.txt similarity index 100% rename from stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/NOTES.txt rename to helm-charts/custom/snmp-helm/snmp-helm/snmp/templates/NOTES.txt diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/_helpers.tpl b/helm-charts/custom/snmp-helm/snmp-helm/snmp/templates/_helpers.tpl similarity index 100% rename from stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/_helpers.tpl rename to helm-charts/custom/snmp-helm/snmp-helm/snmp/templates/_helpers.tpl diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/configmap.yaml b/helm-charts/custom/snmp-helm/snmp-helm/snmp/templates/configmap.yaml similarity index 100% rename from stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/configmap.yaml rename to helm-charts/custom/snmp-helm/snmp-helm/snmp/templates/configmap.yaml diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml b/helm-charts/custom/snmp-helm/snmp-helm/snmp/templates/deployment.yaml similarity index 100% rename from stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml rename to helm-charts/custom/snmp-helm/snmp-helm/snmp/templates/deployment.yaml diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/service.yaml b/helm-charts/custom/snmp-helm/snmp-helm/snmp/templates/service.yaml similarity index 100% rename from stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/service.yaml rename to helm-charts/custom/snmp-helm/snmp-helm/snmp/templates/service.yaml diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml b/helm-charts/custom/snmp-helm/snmp-helm/snmp/values.yaml similarity index 100% rename from stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml rename to helm-charts/custom/snmp-helm/snmp-helm/snmp/values.yaml diff --git a/stx-snmp-helm/debian/deb_folder/changelog b/stx-snmp-helm/debian/deb_folder/changelog index 3035c03..881bd02 100644 --- a/stx-snmp-helm/debian/deb_folder/changelog +++ b/stx-snmp-helm/debian/deb_folder/changelog @@ -1,3 +1,10 @@ +stx-snmp-helm (1.0-2) unstable; urgency=medium + + * Split helm chart into separate package and apply auto versioning. + + -- Joshua Reed Fri, 16 Feb 2024 20:07:42 +0000 + + stx-snmp-helm (1.0-1) unstable; urgency=medium * Initial release. diff --git a/stx-snmp-helm/debian/deb_folder/control b/stx-snmp-helm/debian/deb_folder/control index bd4f7c6..6c88a69 100644 --- a/stx-snmp-helm/debian/deb_folder/control +++ b/stx-snmp-helm/debian/deb_folder/control @@ -4,6 +4,7 @@ Priority: optional Maintainer: StarlingX Developers Build-Depends: debhelper-compat (= 13), helm, + snmp-helm, python3-k8sapp-snmp, python3-k8sapp-snmp-wheels, build-info diff --git a/stx-snmp-helm/debian/deb_folder/copyright b/stx-snmp-helm/debian/deb_folder/copyright index 4f320f4..b8139c9 100644 --- a/stx-snmp-helm/debian/deb_folder/copyright +++ b/stx-snmp-helm/debian/deb_folder/copyright @@ -3,7 +3,7 @@ Upstream-Name: stx-snmp-helm Source: https://opendev.org/starlingx/snmp-armada-app/ Files: * -Copyright: (c) 2013-2021 Wind River Systems, Inc +Copyright: (c) 2013-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. @@ -23,7 +23,7 @@ License: Apache-2 # 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: 2021 Wind River Systems, Inc +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. diff --git a/stx-snmp-helm/debian/deb_folder/rules b/stx-snmp-helm/debian/deb_folder/rules index ff61084..23f9a66 100755 --- a/stx-snmp-helm/debian/deb_folder/rules +++ b/stx-snmp-helm/debian/deb_folder/rules @@ -10,52 +10,55 @@ export REVISION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.') export APP_NAME = snmp export APP_VERSION = $(RELEASE)-$(REVISION) -export APP_TARBALL_FLUXCD = $(APP_NAME)-$(APP_VERSION).tgz +export APP_TARBALL = $(APP_NAME)-$(APP_VERSION).tgz +export HELM_FOLDER = /usr/lib/helm export HELM_REPO = stx-platform -export STAGING_FLUXCD = staging-fluxcd +export STAGING = staging %: dh $@ override_dh_auto_build: + # Setup the staging directory. + mkdir -p $(STAGING) + cp files/metadata.yaml $(STAGING) + cp -Rv fluxcd-manifests $(STAGING) + mkdir -p $(STAGING)/charts + cp /usr/lib/helm/*.tgz $(STAGING)/charts - ############ - # COMMON # - ############ - # Create the TGZ file. - cd helm-charts && make - - ############ - # FLUXCD # - ############ - - # Setup the staging directory for fluxcd package. - mkdir -p $(STAGING_FLUXCD) - cp files/metadata.yaml $(STAGING_FLUXCD) - cp -R fluxcd-manifests $(STAGING_FLUXCD) - mkdir -p $(STAGING_FLUXCD)/charts - cp helm-charts/*.tgz $(STAGING_FLUXCD)/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. - cd $(STAGING_FLUXCD) - sed -i 's/APP_REPLACE_NAME/$(APP_NAME)/g' $(STAGING_FLUXCD)/metadata.yaml - sed -i 's/APP_REPLACE_VERSION/$(APP_VERSION)/g' $(STAGING_FLUXCD)/metadata.yaml - sed -i 's/HELM_REPLACE_REPO/$(HELM_REPO)/g' $(STAGING_FLUXCD)/metadata.yaml + sed -i 's/APP_REPLACE_NAME/$(APP_NAME)/g' $(STAGING)/metadata.yaml + sed -i 's/APP_REPLACE_VERSION/$(APP_VERSION)/g' $(STAGING)/metadata.yaml + sed -i 's/HELM_REPLACE_REPO/$(HELM_REPO)/g' $(STAGING)/metadata.yaml # Copy the plugins: installed in the buildroot - mkdir -p $(STAGING_FLUXCD)/plugins - cp /plugins/*.whl $(STAGING_FLUXCD)/plugins + mkdir -p $(STAGING)/plugins + cp /plugins/*.whl $(STAGING)/plugins # Create the app package. - cd $(STAGING_FLUXCD) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5 - tar cfz $(APP_TARBALL_FLUXCD) -C $(STAGING_FLUXCD)/ . + cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5 + tar cfz $(APP_TARBALL) -C $(STAGING)/ . - # Cleanup staging. - rm -rf $(STAGING_FLUXCD) + # Cleanup staging + rm -rf $(STAGING) override_dh_auto_install: # Install the app tar file. install -d -m 755 $(APP_FOLDER) - install -p -D -m 755 $(APP_TARBALL_FLUXCD) $(APP_FOLDER) + install -p -D -m 755 $(APP_TARBALL) $(APP_FOLDER) + +override_dh_auto_test: override_dh_usrlocal: diff --git a/stx-snmp-helm/debian/meta_data.yaml b/stx-snmp-helm/debian/meta_data.yaml index dacef43..b9e739d 100644 --- a/stx-snmp-helm/debian/meta_data.yaml +++ b/stx-snmp-helm/debian/meta_data.yaml @@ -1,6 +1,6 @@ --- debname: stx-snmp-helm -debver: 1.0-1 +debver: 1.0-2 src_path: stx-snmp-helm revision: dist: $STX_DIST diff --git a/stx-snmp-helm/stx-snmp-helm/fluxcd-manifests/snmp/helmrelease.yaml b/stx-snmp-helm/stx-snmp-helm/fluxcd-manifests/snmp/helmrelease.yaml index 7b71db1..27aa1fb 100644 --- a/stx-snmp-helm/stx-snmp-helm/fluxcd-manifests/snmp/helmrelease.yaml +++ b/stx-snmp-helm/stx-snmp-helm/fluxcd-manifests/snmp/helmrelease.yaml @@ -15,7 +15,7 @@ spec: chart: spec: chart: snmp - version: 1.0.0 + version: REPLACE_HELM_CHART_VERSION sourceRef: kind: HelmRepository name: stx-platform