diff --git a/debian_pkg_dirs b/debian_pkg_dirs index 06aff29..1e92fef 100644 --- a/debian_pkg_dirs +++ b/debian_pkg_dirs @@ -1,2 +1,3 @@ +helm-charts/upstream/cert-manager-helm python3-k8sapp-cert-manager stx-cert-manager-helm diff --git a/stx-cert-manager-helm/stx-cert-manager-helm/helm-charts/Makefile b/helm-charts/upstream/cert-manager-helm/cert-manager-helm/files/Makefile similarity index 65% rename from stx-cert-manager-helm/stx-cert-manager-helm/helm-charts/Makefile rename to helm-charts/upstream/cert-manager-helm/cert-manager-helm/files/Makefile index 08b83ae..a934079 100644 --- a/stx-cert-manager-helm/stx-cert-manager-helm/helm-charts/Makefile +++ b/helm-charts/upstream/cert-manager-helm/cert-manager-helm/files/Makefile @@ -1,7 +1,7 @@ # # Copyright 2017 The Openstack-Helm Authors. # -# Copyright (c) 2020 Wind River Systems, Inc. +# Copyright (c) 2019,2024 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -9,8 +9,8 @@ SHELL := /bin/bash TASK := build -EXCLUDES := helm-toolkit doc tests tools logs tmp -CHARTS := helm-toolkit $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) +EXCLUDES := doc tests tools logs tmp +CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) .PHONY: $(EXCLUDES) $(CHARTS) @@ -25,19 +25,17 @@ $(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 %: - @: + @: \ No newline at end of file diff --git a/helm-charts/upstream/cert-manager-helm/debian/deb_folder/cert-manager-helm.install b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/cert-manager-helm.install new file mode 100644 index 0000000..8a0c6de --- /dev/null +++ b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/cert-manager-helm.install @@ -0,0 +1 @@ +usr/lib/helm/* diff --git a/helm-charts/upstream/cert-manager-helm/debian/deb_folder/changelog b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/changelog new file mode 100644 index 0000000..31d416b --- /dev/null +++ b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +cert-manager-helm (1.13-1) unstable; urgency=medium + + * Initial release matching helm chart version used. + + -- Joshua Reed Tue, 21 Feb 2024 14:54:00 +0000 diff --git a/helm-charts/upstream/cert-manager-helm/debian/deb_folder/control b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/control new file mode 100644 index 0000000..5f90b4c --- /dev/null +++ b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/control @@ -0,0 +1,15 @@ +Source: cert-manager-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: cert-manager-helm +Section: libs +Architecture: any +Depends: ${misc:Depends} +Description: StarlingX Cert Manager Helm Chart + This package contains helm charts for the Cert Manager application. diff --git a/helm-charts/upstream/cert-manager-helm/debian/deb_folder/copyright b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/copyright new file mode 100644 index 0000000..a69b663 --- /dev/null +++ b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/copyright @@ -0,0 +1,41 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: cert-manager-helm +Source: https://opendev.org/starlingx/cert-manager-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'. diff --git a/stx-cert-manager-helm/stx-cert-manager-helm/files/0001-Patch-for-chartyaml-cm-v1.13.1.patch b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/patches/0001-Patch-for-chartyaml-cm-v1.13.1.patch similarity index 100% rename from stx-cert-manager-helm/stx-cert-manager-helm/files/0001-Patch-for-chartyaml-cm-v1.13.1.patch rename to helm-charts/upstream/cert-manager-helm/debian/deb_folder/patches/0001-Patch-for-chartyaml-cm-v1.13.1.patch diff --git a/helm-charts/upstream/cert-manager-helm/debian/deb_folder/patches/series b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/patches/series new file mode 100644 index 0000000..2e75afc --- /dev/null +++ b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/patches/series @@ -0,0 +1 @@ +0001-Patch-for-chartyaml-cm-v1.13.1.patch diff --git a/helm-charts/upstream/cert-manager-helm/debian/deb_folder/rules b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/rules new file mode 100644 index 0000000..4bfef6c --- /dev/null +++ b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/rules @@ -0,0 +1,35 @@ +#!/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 = v$(CHART_BASE_VERSION)+STX.$(PATCH_VERSION) + +export ROOT = debian/tmp +export APP_FOLDER = $(ROOT)/usr/lib/helm + +%: + dh $@ + +override_dh_auto_build: + + mkdir -p cert-manager + + # Copy cert-manager charts + cp -r deploy/charts/* cert-manager + cp cert-manager/cert-manager/Chart.template.yaml cert-manager/cert-manager/Chart.yaml + + # Copy CRD yaml files to templates + cp deploy/crds/*.yaml cert-manager/cert-manager/templates + + cp Makefile cert-manager + + cd cert-manager && make CHART_VERSION=$(CHART_VERSION) cert-manager + +override_dh_auto_install: + # Install the app tar file. + install -d -m 755 $(APP_FOLDER) + install -p -D -m 755 cert-manager/cert-manager*.tgz $(APP_FOLDER) + +override_dh_auto_test: diff --git a/helm-charts/upstream/cert-manager-helm/debian/deb_folder/source/format b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/helm-charts/upstream/cert-manager-helm/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/helm-charts/upstream/cert-manager-helm/debian/meta_data.yaml b/helm-charts/upstream/cert-manager-helm/debian/meta_data.yaml new file mode 100644 index 0000000..c5cee42 --- /dev/null +++ b/helm-charts/upstream/cert-manager-helm/debian/meta_data.yaml @@ -0,0 +1,15 @@ +--- +debname: cert-manager-helm +debver: 1.13-1 +dl_path: + name: cert-manager-helm-1.13.1.tar.gz + url: https://github.com/cert-manager/cert-manager/archive/refs/tags/v1.13.1.tar.gz + sha256sum: e4a6dc4f937742ea48b102118abd509b647bc96e82634d54db17a5d1126e169c +src_files: + - cert-manager-helm/files/Makefile +revision: + dist: $STX_DIST + stx_patch: 0 + GITREVCOUNT: + BASE_SRCREV: 1008d7e9815526b72ad2587422764b826a3d0c5b + SRC_DIR: ${MY_REPO}/stx/cert-manager-armada-app/helm-charts/upstream/cert-manager-helm diff --git a/stx-cert-manager-helm/debian/deb_folder/control b/stx-cert-manager-helm/debian/deb_folder/control index 677277f..8573372 100644 --- a/stx-cert-manager-helm/debian/deb_folder/control +++ b/stx-cert-manager-helm/debian/deb_folder/control @@ -3,10 +3,8 @@ Section: libs Priority: optional Maintainer: StarlingX Developers Build-Depends: debhelper-compat (= 13), - chartmuseum, helm, - procps, - python3-k8sapp-cert-manager, + cert-manager-helm, python3-k8sapp-cert-manager-wheels, build-info Standards-Version: 4.5.1 diff --git a/stx-cert-manager-helm/debian/deb_folder/rules b/stx-cert-manager-helm/debian/deb_folder/rules index ec3756e..b9d6035 100755 --- a/stx-cert-manager-helm/debian/deb_folder/rules +++ b/stx-cert-manager-helm/debian/deb_folder/rules @@ -8,52 +8,35 @@ export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 export RELEASE = $(shell cat /etc/build.info | grep SW_VERSION | cut -d'"' -f2) export REVISION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.') - export APP_NAME = cert-manager export APP_VERSION = $(RELEASE)-$(REVISION) export APP_TARBALL = $(APP_NAME)-$(APP_VERSION).tgz +export HELM_FOLDER = /usr/lib/helm export HELM_REPO = stx-platform export STAGING = staging -export PATCH_1 = 0001-Patch-for-chartyaml-cm-v1.13.1.patch -export CM_VERSION = 1.13.1 - %: dh $@ override_dh_auto_build: - # Host a server for the helm charts. - chartmuseum --debug --port=8879 --context-path='/charts' --storage="local" --storage-local-rootdir="." & - sleep 2 - helm repo add local http://localhost:8879/charts - - # Extract the cert-manager chart - rm -rf fluxcd - mkdir -p fluxcd - # Extract the upstream source - tar -C fluxcd -xf helm-charts-certmanager-$(CM_VERSION).tar.gz - - # Apply patches with our modifications - cp files/$(PATCH_1) fluxcd/helm-charts - cd fluxcd/helm-charts ; \ - patch -p1 < $(PATCH_1) ; \ - # Copy CRD yaml files to templates ; \ - cp deploy/crds/*.yaml deploy/charts/cert-manager/templates/ ; \ - - # Make the updated cert-manager helm-chart - cp files/Makefile fluxcd/helm-charts/deploy/charts - cd fluxcd/helm-charts/deploy/charts && $(MAKE) cert-manager - cd fluxcd/helm-charts/deploy/charts && mv *.tgz $(APP_TARBALL) - - # Terminate the helm chart server. - pkill chartmuseum - # Setup the staging directory. mkdir -p $(STAGING) cp files/metadata.yaml $(STAGING) + cp -Rv fluxcd-manifests $(STAGING) mkdir -p $(STAGING)/charts - cp fluxcd/helm-charts/deploy/charts/cert*.tgz $(STAGING)/charts - cp -R fluxcd-manifests/ $(STAGING)/ + 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 @@ -64,9 +47,9 @@ override_dh_auto_build: mkdir -p $(STAGING)/plugins cp /plugins/*.whl $(STAGING)/plugins - # Generate checksum file and package the tarball + # Create the app package. cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5 - tar -zcf $(APP_TARBALL) -C $(STAGING)/ . + tar cfz $(APP_TARBALL) -C $(STAGING)/ . # Cleanup staging rm -rf $(STAGING) diff --git a/stx-cert-manager-helm/debian/meta_data.yaml b/stx-cert-manager-helm/debian/meta_data.yaml index 297edd0..990b721 100644 --- a/stx-cert-manager-helm/debian/meta_data.yaml +++ b/stx-cert-manager-helm/debian/meta_data.yaml @@ -2,11 +2,6 @@ debname: stx-cert-manager-helm debver: 1.0-1 src_path: stx-cert-manager-helm -dl_files: - helm-charts-certmanager-1.13.1.tar.gz: - topdir: helm-charts - url: https://github.com/cert-manager/cert-manager/archive/refs/tags/v1.13.1.tar.gz - sha256sum: e4a6dc4f937742ea48b102118abd509b647bc96e82634d54db17a5d1126e169c revision: dist: $STX_DIST stx_patch: 28 diff --git a/stx-cert-manager-helm/stx-cert-manager-helm/files/index.yaml b/stx-cert-manager-helm/stx-cert-manager-helm/files/index.yaml deleted file mode 100644 index 36db709..0000000 --- a/stx-cert-manager-helm/stx-cert-manager-helm/files/index.yaml +++ /dev/null @@ -1,3 +0,0 @@ -apiVersion: v1 -entries: {} -generated: 2019-01-07T12:33:46.098166523-06:00 diff --git a/stx-cert-manager-helm/stx-cert-manager-helm/fluxcd-manifests/cert-manager/helmrelease.yaml b/stx-cert-manager-helm/stx-cert-manager-helm/fluxcd-manifests/cert-manager/helmrelease.yaml index 0695480..17af4f3 100644 --- a/stx-cert-manager-helm/stx-cert-manager-helm/fluxcd-manifests/cert-manager/helmrelease.yaml +++ b/stx-cert-manager-helm/stx-cert-manager-helm/fluxcd-manifests/cert-manager/helmrelease.yaml @@ -15,7 +15,7 @@ spec: chart: spec: chart: cert-manager - version: 1.13.1 + version: REPLACE_HELM_CHART_VERSION sourceRef: kind: HelmRepository name: stx-platform