From c937123901e4da29059cbf1bbf731da7a4cf7fa0 Mon Sep 17 00:00:00 2001 From: Robert Church Date: Thu, 25 Apr 2019 11:04:28 -0400 Subject: [PATCH] Add stx-platform-helm RPM Provide a new helm RPM that will be included with and installed by the ISO. This RPM will package an application tarball that is to be managed by the system without user intervention but supports all the existing mechanisms that the user installed applications use. The intent of this application is to provide any charts required for platform integration and install any of those charts through an armada manifest. The armada manifest will reference a new helm repository that will be enabled with a future commit. This repository is intended for platform specific charts installed by RPMs. The existing helm repository is kept for optional runtime user installed applications. Change-Id: Ia34d3a1efa1006b184cc35e17afb231064cf36f9 Story: 2005424 Task: 30452 Signed-off-by: Robert Church --- centos_iso_image.inc | 3 + centos_pkg_dirs | 1 + .../templates/pre-install-check-ceph.yaml | 1 - .../stx-platform-helm/centos/build_srpm.data | 7 ++ .../centos/stx-platform-helm.spec | 99 +++++++++++++++++ .../stx-platform-helm/Makefile | 43 ++++++++ .../stx-platform-helm/README | 6 + .../stx-platform-helm/files/index.yaml | 3 + .../stx-platform-helm/files/metadata.yaml | 3 + .../stx-platform-helm/files/repositories.yaml | 12 ++ .../stx-platform-helm/manifests/manifest.yaml | 103 ++++++++++++++++++ 11 files changed, 280 insertions(+), 1 deletion(-) create mode 100644 kubernetes/platform/stx-platform/stx-platform-helm/centos/build_srpm.data create mode 100644 kubernetes/platform/stx-platform/stx-platform-helm/centos/stx-platform-helm.spec create mode 100644 kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/Makefile create mode 100644 kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/README create mode 100644 kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/index.yaml create mode 100644 kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/metadata.yaml create mode 100644 kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/repositories.yaml create mode 100644 kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/manifests/manifest.yaml diff --git a/centos_iso_image.inc b/centos_iso_image.inc index 1c98e7621a..7787406af1 100644 --- a/centos_iso_image.inc +++ b/centos_iso_image.inc @@ -40,3 +40,6 @@ ansible # playbookconfig playbookconfig + +# Platform helm charts +stx-platform-helm diff --git a/centos_pkg_dirs b/centos_pkg_dirs index 08cd53f08a..68fd3e8689 100644 --- a/centos_pkg_dirs +++ b/centos_pkg_dirs @@ -1,4 +1,5 @@ kubernetes/applications/stx-openstack/stx-openstack-helm +kubernetes/platform/stx-platform/stx-platform-helm worker-utils workerconfig controllerconfig diff --git a/kubernetes/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml b/kubernetes/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml index 202bc260d9..f66262e3db 100644 --- a/kubernetes/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml +++ b/kubernetes/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml @@ -160,7 +160,6 @@ apiVersion: v1 kind: ConfigMap metadata: name: ceph-etc - # This is the name of the openstack application's namespace namespace: {{ $root.Release.Namespace }} data: ceph.conf: | diff --git a/kubernetes/platform/stx-platform/stx-platform-helm/centos/build_srpm.data b/kubernetes/platform/stx-platform/stx-platform-helm/centos/build_srpm.data new file mode 100644 index 0000000000..02d1c5f115 --- /dev/null +++ b/kubernetes/platform/stx-platform/stx-platform-helm/centos/build_srpm.data @@ -0,0 +1,7 @@ +SRC_DIR="stx-platform-helm" + +COPY_LIST_TO_TAR="\ +$PKG_BASE/../../../helm-charts/rbd-provisioner \ +$PKG_BASE/../../../helm-charts/ceph-pools-audit" + +TIS_PATCH_VER=1 diff --git a/kubernetes/platform/stx-platform/stx-platform-helm/centos/stx-platform-helm.spec b/kubernetes/platform/stx-platform/stx-platform-helm/centos/stx-platform-helm.spec new file mode 100644 index 0000000000..58fd967d33 --- /dev/null +++ b/kubernetes/platform/stx-platform/stx-platform-helm/centos/stx-platform-helm.spec @@ -0,0 +1,99 @@ +# Application tunables (maps to metadata) +%global app_name platform-integ-apps +%global helm_repo stx-platform + +# Install location +%global app_folder /usr/local/share/applications/helm + +# Build variables +%global helm_folder /usr/lib/helm +%global toolkit_version 0.1.0 + +Summary: StarlingX Platform Helm charts +Name: stx-platform-helm +Version: 1.0 +Release: %{tis_patch_ver}%{?_tis_dist} +License: Apache-2.0 +Group: base +Packager: Wind River +URL: unknown + +Source0: %{name}-%{version}.tar.gz + +BuildArch: noarch + +BuildRequires: helm +BuildRequires: openstack-helm-infra + +%description +StarlingX Platform Helm charts + +%prep +%setup + +%build +# initialize helm and build the toolkit +# helm init --client-only does not work if there is no networking +# The following commands do essentially the same as: helm init +%define helm_home %{getenv:HOME}/.helm +mkdir %{helm_home} +mkdir %{helm_home}/repository +mkdir %{helm_home}/repository/cache +mkdir %{helm_home}/repository/local +mkdir %{helm_home}/plugins +mkdir %{helm_home}/starters +mkdir %{helm_home}/cache +mkdir %{helm_home}/cache/archive + +# Stage a repository file that only has a local repo +cp files/repositories.yaml %{helm_home}/repository/repositories.yaml + +# Stage a local repo index that can be updated by the build +cp files/index.yaml %{helm_home}/repository/local/index.yaml + +# Stage helm-toolkit in the local repo +cp %{helm_folder}/helm-toolkit-%{toolkit_version}.tgz . + +# Host a server for the charts +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 rbd-provisioner +make ceph-pools-audit + +# Terminate helm server (the last backgrounded task) +kill %1 + +# Create a chart tarball compliant with sysinv kube-app.py +%define app_staging %{_builddir}/staging +%define app_tarball %{app_name}-%{version}-%{tis_patch_ver}.tgz + +# Setup staging +mkdir -p %{app_staging} +cp files/metadata.yaml %{app_staging} +cp manifests/manifest.yaml %{app_staging} +mkdir -p %{app_staging}/charts +cp *.tgz %{app_staging}/charts +cd %{app_staging} + +# Populate metadata +sed -i 's/@APP_NAME@/%{app_name}/g' %{app_staging}/metadata.yaml +sed -i 's/@APP_VERSION@/%{version}-%{tis_patch_ver}/g' %{app_staging}/metadata.yaml +sed -i 's/@HELM_REPO@/%{helm_repo}/g' %{app_staging}/metadata.yaml + +# package it up +find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5 +tar -zcf %{_builddir}/%{app_tarball} -C %{app_staging}/ . + +# Cleanup staging +rm -fr %{app_staging} + +%install +install -d -m 755 %{buildroot}/%{app_folder} +install -p -D -m 755 %{_builddir}/%{app_tarball} %{buildroot}/%{app_folder} + +%files +%defattr(-,root,root,-) +%{app_folder}/* diff --git a/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/Makefile b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/Makefile new file mode 100644 index 0000000000..eff605d3ad --- /dev/null +++ b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/Makefile @@ -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 + +%: + @: diff --git a/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/README b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/README new file mode 100644 index 0000000000..969f8886b5 --- /dev/null +++ b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/README @@ -0,0 +1,6 @@ +This directory contains all StarlingX charts that need to be built to support +platform integration immediately after installation. 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. diff --git a/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/index.yaml b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/index.yaml new file mode 100644 index 0000000000..36db709b19 --- /dev/null +++ b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/index.yaml @@ -0,0 +1,3 @@ +apiVersion: v1 +entries: {} +generated: 2019-01-07T12:33:46.098166523-06:00 diff --git a/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/metadata.yaml b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/metadata.yaml new file mode 100644 index 0000000000..49f72b5bb2 --- /dev/null +++ b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/metadata.yaml @@ -0,0 +1,3 @@ +app_name: @APP_NAME@ +app_version: @APP_VERSION@ +helm_repo: @HELM_REPO@ diff --git a/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/repositories.yaml b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/repositories.yaml new file mode 100644 index 0000000000..e613b63b16 --- /dev/null +++ b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/files/repositories.yaml @@ -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: "" + diff --git a/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/manifests/manifest.yaml b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/manifests/manifest.yaml new file mode 100644 index 0000000000..9b84f9c4ee --- /dev/null +++ b/kubernetes/platform/stx-platform/stx-platform-helm/stx-platform-helm/manifests/manifest.yaml @@ -0,0 +1,103 @@ +--- +schema: armada/Chart/v1 +metadata: + schema: metadata/Document/v1 + name: helm-toolkit +data: + chart_name: helm-toolkit + release: helm-toolkit + namespace: helm-toolkit + values: {} + source: + type: tar + location: http://172.17.0.1:8080/helm_charts/stx-platform/helm-toolkit-0.1.0.tgz + subpath: helm-toolkit + reference: master + dependencies: [] +--- +schema: armada/Chart/v1 +metadata: + schema: metadata/Document/v1 + name: kube-system-rbd-provisioner +data: + chart_name: rbd-provisioner + release: rbd-provisioner + namespace: kube-system + wait: + timeout: 1800 + labels: + app: rbd-provisioner + install: + no_hooks: false + upgrade: + no_hooks: false + pre: + delete: + - type: job + labels: + app: rbd-provisioner + values: + images: + tags: + # TODO: Remove after ceph upgrade + rbd_provisioner_storage_init: docker.io/starlingx/stx-ceph-config-helper:master-centos-stable-latest + rbac: + clusterRole: stx-rbd-provisioner + clusterRoleBinding: stx-rbd-provisioner + serviceAccount: stx-rbd-provisioner + source: + type: tar + location: http://172.17.0.1:8080/helm_charts/stx-platform/rbd-provisioner-0.1.0.tgz + subpath: rbd-provisioner + reference: master + dependencies: + - helm-toolkit +--- +schema: armada/Chart/v1 +metadata: + schema: metadata/Document/v1 + name: kube-system-ceph-pools-audit +data: + chart_name: ceph-pools-audit + release: ceph-pools-audit + namespace: kube-system + wait: + timeout: 1800 + labels: + app: rbd-provisioner + install: + no_hooks: false + upgrade: + no_hooks: false + pre: + delete: + - type: job + labels: + app: ceph-pools-audit + source: + type: tar + location: http://172.17.0.1:8080/helm_charts/stx-platform/ceph-pools-audit-0.1.0.tgz + subpath: ceph-pools-audit + reference: master + dependencies: + - helm-toolkit +--- +schema: armada/ChartGroup/v1 +metadata: + schema: metadata/Document/v1 + name: starlingx-ceph-charts +data: + description: StarlingX Ceph Charts + sequenced: true + chart_group: + - kube-system-rbd-provisioner + - kube-system-ceph-pools-audit +--- +schema: armada/Manifest/v1 +metadata: + schema: metadata/Document/v1 + name: platform-integration-manifest +data: + release_prefix: stx + chart_groups: + - starlingx-ceph-charts