summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xansible/group_vars/all.yml30
-rw-r--r--ansible/roles/application-install/tasks/main.yml17
-rw-r--r--build/package.conf17
-rwxr-xr-xbuild/package.sh15
4 files changed, 58 insertions, 21 deletions
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index e70a837b..d2385f65 100755
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -84,22 +84,28 @@ runtime_images:
# Application specific params #
###############################
-# Project name to utilize same codebase
-# e.g. project_configuration: onap-me
+# Project name to utilize same codebase. Just helper variable inside ansible
+# configuration files (like this file) to avoid writing own project name multiple
+# times for paths, namespaces, Helm release, derived variables..
+# e.g. project_configuration: onap-casablanca
project_configuration:
-# App Helm charts dir. E.g. application/helm_charts/<xxx> where xxx is a charts folder name.
-# Helm charts are expected to be inside SW package somewhere inside ./ansible/application
-# those will be available for offline installer under /ansible/application/<helm_charts_name>
-# for OOM project helm charts are usually within kubernetes sub-folder
-# so the path for them can be:
-# e.g app_helm_charts_install_directory: "/ansible/application/oom/kubernetes"
-app_helm_charts_install_directory:
+# App Helm charts directory location in installation package.
+# The path is absolute path (even locates relative inside of this sw package
+# installation folder) because it must be visible for ansible docker/chroot
+# process to find directory and to transfer it into machine (infra node) running
+# Helm repository.
+# Content of the folder must be Helm chart directories of the app with Makefile.
+# In case of ONAP OOM it would be <oom_repo>/kubernetes folder content.
+# NOTE: This default value should not be changed if not really needed and it
+# must match with the variable "HELM_CHARTS_DIR_IN_PACKAGE" value in package.sh
+# script!
+app_helm_charts_install_directory: "/ansible/application/helm_charts"
# to specify target dir where helm charts should be copied into on infra node
# this should be directory with all charts and Makefile
# e.g. app_helm_charts_infra_directory: "{{ app_data_path }}/helm_charts"
-app_helm_charts_infra_directory:
+app_helm_charts_infra_directory: "{{ app_data_path }}/helm_charts"
# Main Helm chart to install
# e.g. app_helm_chart_name: onap
@@ -114,12 +120,12 @@ app_helm_build_targets:
# Directory with helm plugins
# It's an optional parameter used e.g. in OOM Casablanca
-# app_helm_plugins_directory: "{{ app_helm_charts_install_directory}}/kubernetes/helm/plugins/"
+# app_helm_plugins_directory: "{{ app_helm_charts_install_directory}}/helm/plugins/"
app_helm_plugins_directory:
# Helm release name (visible in POD names) used by Helm
# e.g. app_helm_release_name: "{{ project_configuration }}"
-app_helm_release_name:
+app_helm_release_name: "{{ project_configuration }}"
# Kubernetes namespace where application is installed
# e.g. app_kubernetes_namespace: onap
diff --git a/ansible/roles/application-install/tasks/main.yml b/ansible/roles/application-install/tasks/main.yml
index 3306d9e4..89e7ef7e 100644
--- a/ansible/roles/application-install/tasks/main.yml
+++ b/ansible/roles/application-install/tasks/main.yml
@@ -2,4 +2,21 @@
- debug:
msg: "phase is {{ phase }}"
+- name: Check if install needed
+ block:
+ - name: "Does {{ app_helm_charts_install_directory }} exist and contain Helm Charts"
+ find:
+ paths: "{{ app_helm_charts_install_directory }}"
+ recurse: yes
+ delegate_to: localhost
+ register: charts_files
+ - name: Set install active fact
+ set_fact:
+ install_needed: "{{ yes if charts_files.matched | int > 0 else no }}"
+ when: phase == "pre-install"
+
- include_tasks: "{{ phase }}.yml"
+ when: install_needed
+
+- debug:
+ msg: "Install needed {{ install_needed }}"
diff --git a/build/package.conf b/build/package.conf
index c3bbeee9..7a738f31 100644
--- a/build/package.conf
+++ b/build/package.conf
@@ -1,8 +1,7 @@
-# For the packaging script it is expected that all artifacts are present on local file system
-# (e.g. they can be mounted) Downloading stuff from internet is currently not supported.
-# Furthermore we don't want to replicate content of our static data_lists for download in there
-# and those are downloaded before this packaging script is supposed to be run.
-# Therefore we can limit number of artifacts to be added into packages just to couple of items.
+# For the packaging script it is expected that all artifacts are present on local file system.
+# Artifacts include:
+# - installer source code (this git repository content)
+# - all binary artifacts pre-downloaded from internet (docker images, rpm packages, npm packages, Maven artifacts etc.)
###########################
# Project specific params #
@@ -12,10 +11,14 @@
SOFTWARE_PACKAGE_BASENAME="onap-offline"
########################
-# Helm charts handling #
+# Helm charts #
########################
-# directory with helm charts
+# Provide application installed to Kubernetes cluster. Helm chart is the supported format https://helm.sh/.
+# Directory provided here must contain all the Chart directories of the application (https://docs.helm.sh/developing_charts/#charts) and Makefile.
+# E.g. in case of ONAP oom repo it will be the content of kubernetes directory.
+# NOTE: Leaving this variable commented out will mean that no Helm application will be installed to
+# offline Kubernetes cluster. This may be sometimes wanted.
#HELM_CHARTS_DIR=~/myclones/casablanca_oom/
###################
diff --git a/build/package.sh b/build/package.sh
index fd9b9e75..89764ccf 100755
--- a/build/package.sh
+++ b/build/package.sh
@@ -109,8 +109,8 @@ function create_sw_package {
then
echo "Helm charts handling"
# Copy charts available for ansible playbook to use/move them to target server/dir
- mkdir -p "${pkg_root}"/ansible/application/helm_charts
- cp -r "${HELM_CHARTS_DIR}"/* "${pkg_root}"/ansible/application/helm_charts
+ mkdir -p ${pkg_root}/${HELM_CHARTS_DIR_IN_PACKAGE}
+ cp -r "${HELM_CHARTS_DIR}"/* ${pkg_root}/${HELM_CHARTS_DIR_IN_PACKAGE}
fi
# Add metadata to the package
@@ -192,6 +192,17 @@ TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
SCRIPT_DIR=$(dirname "${0}")
LOCAL_PATH=$(readlink -f "$SCRIPT_DIR")
+# Relative location inside the package to place Helm charts to be available for
+# Ansible process to transfer them into machine (infra node) running Helm repository.
+# NOTE: This is quite hardcoded place to put them and agreement with Ansible code
+# is done in ansible/group_vars/all.yml with variable "app_helm_charts_install_directory"
+# whihc value must match to value of this variable (with exception of slash '/'
+# prepended so that ansible docker/chroot process can see the dir).
+# This variable can be of course changed in package.conf if really needed if
+# corresponding ansible variable "app_helm_charts_install_directory" value
+# adjusted accordingly.
+HELM_CHARTS_DIR_IN_PACKAGE="ansible/application/helm_charts"
+
if [ "$#" -lt 3 ]; then
echo "Missing some mandatory parameter!"
usage