Harbor App: FluxCD directory structure creation

This commit creates the directory structure of harbor repo.
Harbor helm chart version v1.12.0 (appVersion 2.8.0) is used.

Depends-On: https://review.opendev.org/c/starlingx/app-harbor/+/883476

Test Plan:
PASSED: Build process is successful with creation of debian package.
PASSED: Extract the content of stx-harbor-helm_1.0-1.stx.12_amd64.deb
		and check if the helm tar file is present.
PASSED: AIO-SX app upload using 'system application-apply'

Story: 2010721
Task: 48046

Change-Id: I38b2e2f79d7fe03267cf13c7295651d00a6e1649
Signed-off-by: Jagatguru Prasad Mishra <jagatguruprasad.mishra@windriver.com>
This commit is contained in:
Jagatguru Prasad Mishra 2023-05-18 03:49:10 -04:00
parent 57cfd993bc
commit 304d10ece8
27 changed files with 452 additions and 0 deletions

16
CONTRIBUTING.rst Normal file
View File

@ -0,0 +1,16 @@
If you would like to contribute to the development of OpenStack,
you must follow the steps in this page:
https://docs.openstack.org/infra/manual/developers.html
Once those steps have been completed, changes to OpenStack
should be submitted for review via the Gerrit tool, following
the workflow documented at:
https://docs.openstack.org/infra/manual/developers.html#development-workflow
Pull requests submitted through GitHub will be ignored.
Bugs should be filed in Launchpad:
https://bugs.launchpad.net/starlingx

17
HACKING.rst Normal file
View File

@ -0,0 +1,17 @@
StarlingX App-Harbor Style Commandments
=======================================
- Step 1: Read the OpenStack style commandments
https://docs.openstack.org/hacking/latest/
- Step 2: Read on
App-Harbor Specific Commandments
--------------------------------
None so far
Running tests
-------------
The approach to running tests is to simply run the command ``tox``. This will
create virtual environments, populate them with dependencies and run all of
the tests that OpenStack CI systems run.

10
bindep.txt Normal file
View File

@ -0,0 +1,10 @@
# This is a cross-platform list tracking distribution packages needed for install and tests;
# see https://docs.openstack.org/infra/bindep/ for additional information.
libffi-dev [platform:dpkg]
libldap2-dev [platform:dpkg]
libxml2-dev [platform:dpkg]
libxslt1-dev [platform:dpkg]
libsasl2-dev [platform:dpkg]
libffi-devel [platform:rpm]
python3-all-dev [platform:dpkg]

1
debian_build_layer.cfg Normal file
View File

@ -0,0 +1 @@
flock

2
debian_iso_image.inc Normal file
View File

@ -0,0 +1,2 @@
#stx-harbor-helm
stx-harbor-helm

1
debian_pkg_dirs Normal file
View File

@ -0,0 +1 @@
stx-harbor-helm

View File

@ -0,0 +1,5 @@
stx-harbor-helm (1.0-1) unstable; urgency=medium
* Initial release.
-- Jagatguru Prasad Mishra <jagatguruprasad.mishra@windriver.com> Wed, 17 May 2023 05:47:54 +0000

View File

@ -0,0 +1,17 @@
Source: stx-harbor-helm
Section: libs
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13),
chartmuseum,
helm,
procps,
Standards-Version: 4.5.1
Homepage: https://www.starlingx.io
Package: stx-harbor-helm
Section: libs
Architecture: any
Depends: ${misc:Depends}
Description: StarlingX Harbor Application FluxCD Helm Charts
This package contains Fluxcd helm charts for the harbor application.

View File

@ -0,0 +1,41 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: stx-harbor-helm
Source: https://opendev.org/starlingx/app-harbor/
Files: *
Copyright: (c) 2013-2023 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: 2021 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,72 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export ROOT = debian/tmp
export APP_FOLDER = $(ROOT)/usr/local/share/applications/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 HARBOR_PKG="helm-charts-harbor-v1.12.0.tar.gz"
export HARBOR_PKG_TGZ= "helm-charts-harbor-v1.12.0.tgz"
export APP_NAME = harbor
export APP_VERSION = $(RELEASE)-$(REVISION)
export APP_TARBALL_FLUXCD = $(APP_NAME)-$(APP_VERSION).tgz
export HELM_REPO = stx-platform
export STAGING = staging
%:
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 harbor chart
rm -rf fluxcd
mkdir -p fluxcd
tar -C fluxcd -xf $(HARBOR_PKG)
# create a tgz file
cd fluxcd && mkdir -p output/ && mv helm-charts harbor &&tar -czvf output/$(HARBOR_PKG_TGZ) harbor/
# Terminate the helm chart server.
pkill chartmuseum
# Setup the staging directory.
mkdir -p $(STAGING)/charts
# Copy the fluxcd manifests
cp -R fluxcd-manifests/ $(STAGING)/
# Copy the built chart to staging
cp fluxcd/output/$(HARBOR_PKG_TGZ) $(STAGING)/charts/
# Populate metadata.
cp files/metadata.yaml $(STAGING)
sed -i 's/@APP_NAME@/$(APP_NAME)/g' $(STAGING)/metadata.yaml
sed -i 's/@APP_VERSION@/$(APP_VERSION)/g' $(STAGING)/metadata.yaml
sed -i 's/@HELM_REPO@/$(HELM_REPO)/g' $(STAGING)/metadata.yaml
# Copy the plugins: installed in the buildroot
mkdir -p $(STAGING)/plugins
# cp /plugins/*.whl $(STAGING)/plugins
# Generate checksum file and package the tarball
cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar -zcf $(APP_TARBALL_FLUXCD) -C $(STAGING)/ .
# 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)
override_dh_auto_test:
override_dh_usrlocal:

View File

@ -0,0 +1,75 @@
#!/usr/bin/make -f
# export DH_VERBOSE = 1
export ROOT = debian/tmp
export APP_FOLDER = $(ROOT)/usr/local/share/applications/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 SPO_PKG="helm-charts-harbor-v1.12.0.tar.gz"
export APP_NAME = harbor
export APP_VERSION = $(RELEASE)-$(REVISION)
export APP_TARBALL_FLUXCD = $(APP_NAME)-$(APP_VERSION).tgz
export HELM_REPO = stx-platform
export STAGING = staging
%:
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 harbor chart
rm -rf fluxcd
mkdir -p fluxcd
tar -C fluxcd -xf $(SPO_PKG)
# Apply patches
# create a tgz file
cd fluxcd && mkdir -p output/ && mv helm-charts harbor &&tar -czvf output/$(SPO_PKG) harbor/
# Terminate the helm chart server.
pkill chartmuseum
# Setup the staging directory.
mkdir -p $(STAGING)/charts
# Copy the fluxcd manifests
cp -R fluxcd-manifests/ $(STAGING)/
# Copy the built chart to staging
cp fluxcd/output/$(SPO_PKG) $(STAGING)/charts/
# Populate metadata.
cp files/metadata.yaml $(STAGING)
sed -i 's/@APP_NAME@/$(APP_NAME)/g' $(STAGING)/metadata.yaml
sed -i 's/@APP_VERSION@/$(APP_VERSION)/g' $(STAGING)/metadata.yaml
sed -i 's/@HELM_REPO@/$(HELM_REPO)/g' $(STAGING)/metadata.yaml
# Copy the plugins: installed in the buildroot
mkdir -p $(STAGING)/plugins
cp /plugins/*.whl $(STAGING)/plugins
# Generate checksum file and package the tarball
cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar -zcf $(APP_TARBALL_FLUXCD) -C $(STAGING)/ .
# 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)
override_dh_auto_test:
override_dh_usrlocal:

View File

@ -0,0 +1 @@
3.0 (quilt)

View File

@ -0,0 +1 @@
usr/local/share/applications/helm/*

View File

@ -0,0 +1,14 @@
---
debname: stx-harbor-helm
debver: 1.0-1
src_path: stx-harbor-helm
dl_files:
helm-charts-harbor-v1.12.0.tar.gz:
topdir: helm-charts
url: https://github.com/goharbor/harbor-helm/archive/refs/tags/v1.12.0.tar.gz
md5sum: f650eba90361abe4972fa94489a54cb1
revision:
dist: $STX_DIST
GITREVCOUNT:
SRC_DIR: ${MY_REPO}/stx/app-harbor
BASE_SRCREV: 57cfd993bc30aaa9ab6d9e466ec05bbd47cda2fb

View File

@ -0,0 +1,5 @@
This directory contains all StarlingX charts that need to be built for this
application. Some charts are common across applications. These common charts
reside in the stx-config/kubernetes/helm-charts directory. To include these in
this application update the build_srpm.data file and use the COPY_LIST_TO_TAR
mechanism to populate these common charts.

View File

@ -0,0 +1,43 @@
#
# Copyright 2017 The Openstack-Helm Authors.
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# It's necessary to set this because some environments don't link sh -> bash.
SHELL := /bin/bash
TASK := build
EXCLUDES := helm-toolkit doc tests tools logs tmp
CHARTS := helm-toolkit $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.)))
.PHONY: $(EXCLUDES) $(CHARTS)
all: $(CHARTS)
$(CHARTS):
@if [ -d $@ ]; then \
echo; \
echo "===== Processing [$@] chart ====="; \
make $(TASK)-$@; \
fi
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
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

@ -0,0 +1,3 @@
apiVersion: v1
entries: {}
generated: 2019-01-07T12:33:46.098166523-06:00

View File

@ -0,0 +1,7 @@
app_name: @APP_NAME@
app_version: @APP_VERSION@
helm_repo: @HELM_REPO@
maintain_user_overrides: true
maintain_attributes: true
upgrades:
auto_update: true

View File

@ -0,0 +1,12 @@
apiVersion: v1
generated: 2019-01-02T15:19:36.215111369-06:00
repositories:
- caFile: ""
cache: /builddir/.helm/repository/cache/local-index.yaml
certFile: ""
keyFile: ""
name: local
password: ""
url: http://127.0.0.1:8879/charts
username: ""

View File

@ -0,0 +1,13 @@
#
# Copyright (c) 2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
name: stx-platform
spec:
url: http://192.168.206.1:8080/helm_charts/stx-platform
interval: 1m

View File

@ -0,0 +1,9 @@
#
# Copyright (c) 2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
resources:
- helmrepository.yaml
- namespace.yaml

View File

@ -0,0 +1,10 @@
#
# Copyright (c) 2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
apiVersion: v1
kind: Namespace
metadata:
name: harbor

View File

@ -0,0 +1,6 @@
#
# Copyright (c) 2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#

View File

@ -0,0 +1,5 @@
#
# Copyright (c) 2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#

View File

@ -0,0 +1,36 @@
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
apiVersion: "helm.toolkit.fluxcd.io/v2beta1"
kind: HelmRelease
metadata:
name: harbor
labels:
chart_group: harbor-charts
spec:
releaseName: harbor
chart:
spec:
chart: harbor
version: 1.12.0
sourceRef:
kind: HelmRepository
name: stx-platform
interval: 1m
timeout: 30m
test:
enable: false
install:
disableHooks: false
upgrade:
disableHooks: false
valuesFrom:
- kind: Secret
name: harbor-static-overrides
valuesKey: harbor-static-overrides.yaml
- kind: Secret
name: harbor-system-overrides
valuesKey: harbor-system-overrides.yaml

View File

@ -0,0 +1,18 @@
#
# Copyright (c) 2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
namespace: harbor
resources:
- helmrelease.yaml
secretGenerator:
- name: harbor-static-overrides
files:
- harbor-static-overrides.yaml
- name: harbor-system-overrides
files:
- harbor-system-overrides.yaml
generatorOptions:
disableNameSuffixHash: true

View File

@ -0,0 +1,12 @@
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: harbor
resources:
- base
- harbor