Enable StarlingX helm charts for stx-openstack app

Use an application RPM to build and collect application artifacts.

This follows the same mechanism that is used to build the openstack-helm
and openstack-helm-infra charts. The custom StarlingX charts are built
and the application specific armada manifests are included in the RPM.

This application RPM will be used to produce some of the required build
artifacts (custom helm tarballs + armada manifests) but is not intended
to be installed on the system. These artifacts are extracted later for
proper application packaging with additional required metadata.

Changes also include:
 - Update the README describing the new layouts for applications.
 - Move the nova-api-proxy chart from the common area to be included as
   a chart specific to the stx-openstack app.

Change-Id: I1140760d56035249324519be93bb913e18f394d9
Story: 2004005
Task: 27801
Depends-On: I57c5ec5f3565e9e585f0935af745e495699aa28c
Signed-off-by: Robert Church <robert.church@windriver.com>
This commit is contained in:
Robert Church 2018-11-06 11:22:33 -05:00
parent fa3a1dd05f
commit 9a749f1d80
21 changed files with 138 additions and 10 deletions

View File

@ -2,16 +2,38 @@ The expected layout for this subdirectory is as follows:
kubernetes
|-- applications
| `-- stx-openstack
| `-- manifest.yaml
| `-- <application>
| `-- <application>-helm RPM
| `-- centos
| `-- build_srpm.data
| `-- <application>-helm.spec
| `-- <application>-helm
| `-- manifests
| `-- main-manifest.yaml
| `-- alt-manifest-1.yaml
| `-- ...
| `-- alt-manifest-N.yaml
| `-- custom chart 1
| `-- Chart.yaml
| `-- ...
| `-- ...
| `-- custom chart N
| `-- Chart.yaml
| `-- ...
|-- helm-charts
| `-- placeholder
| `-- placeholder.txt
| `-- chart
| `-- chart
`-- README
The idea is that all our custom helm charts would go under "helm-charts". Each
chart would get a subdirectory.
The idea is that all our custom helm charts that are common across applications
would go under "helm-charts". Each chart would get a subdirectory.
Custom applications would generally consist of an armada manifest referencing
multiple helm charts (both ours and upstream ones). These applications would
each get their own subdirectory under "applications".
Custom applications would generally consist of one or more armada manifest
referencing multiple helm charts (both ours and upstream ones). The application
is packaged as an RPM. These application RPM are used to produce the build
artifacts (helm tarballs + armada manifests) but are not installed on the
system. These artifacts are extracted later for proper application packaging
with additional required metadata (TBD).
These applications would each get their own subdirectory under
"applications".

View File

@ -0,0 +1,2 @@
SRC_DIR="stx-openstack-helm"
TIS_PATCH_VER=1

View File

@ -0,0 +1,54 @@
%global helm_folder /usr/lib/helm
%global armada_folder /usr/lib/armada
%global toolkit_version 0.1.0
%global helmchart_version 0.1.0
Summary: StarlingX Openstack Application Helm charts
Name: stx-openstack-helm
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: helm
BuildRequires: openstack-helm-infra
Requires: openstack-helm-infra
%description
StarlingX Openstack Application Helm charts
%prep
%setup
%build
# initialize helm and stage the toolkit
helm init --client-only
# Host a server for the charts
cp %{helm_folder}/helm-toolkit-%{toolkit_version}.tgz .
helm serve --repo-path . &
helm repo rm local
helm repo add local http://localhost:8879/charts
# Make the charts. These produce a tgz file
make nova-api-proxy
# remove helm-toolkit. This will be packaged with openstack-helm-infra
rm ./helm-toolkit-%{toolkit_version}.tgz
%install
# helm_folder is created by openstack-helm-infra
install -d -m 755 ${RPM_BUILD_ROOT}%{helm_folder}
install -p -D -m 755 *.tgz ${RPM_BUILD_ROOT}%{helm_folder}
install -d -m 755 ${RPM_BUILD_ROOT}%{armada_folder}
install -p -D -m 755 manifests/*.yaml ${RPM_BUILD_ROOT}%{armada_folder}
%files
#helm_folder is owned by openstack-helm-infra
%defattr(-,root,root,-)
%{helm_folder}/*
%{armada_folder}/*

View File

@ -0,0 +1,43 @@
#
# Copyright 2017 The Openstack-Helm Authors.
#
# Copyright (c) 2018 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,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 commom charts.

View File

@ -26,7 +26,9 @@ commands =
-i E006,E010"
bash -c "find {toxinidir} \
\( -name .tox -o -path {toxinidir}/kubernetes/helm-charts -prune \) \
\( -name .tox \
-o -path {toxinidir}/kubernetes/applications -prune \
-o -path {toxinidir}/kubernetes/helm-charts -prune \) \
-o -type f -name '*.yaml' \
-print0 | xargs -0 yamllint -f parsable \
-c {toxinidir}/.yamllint"