charts/tools/deployment/common/get-values-overrides.sh
intlabs b94014be52 Rework AIO
1) Removes unused/duplicate deployment/gate scripts
2) Removes unrequired NFS deployment
3) Adds Ingress controller
4) Adds Cert-Manager
5) Removes unrequired harbor chart, and replaces with upstream
6) Adds ingress rules to tekton
7) Fix linting issues with newer k8s versions and dex-aio chart
8) Add Gerrit Chart
9) Fixes hardcoded namespace references in tekton-triggers chart.
10) Sets up CA certs on host to anble validation of tls backed services.
11) TLS in tekton dashboard via cert-manager
12) TLS in loki and grafana via cert-manager
13) TLS in harbor & notary ingres via cert-manager
14) TLS for all internal harbor components via self signed certs
15) TLS for gerrit via cert-manager
16) Rework DNS config to fix resolving k8s services from host
17) Update kube deployment script to configure /etc/resolv.conf to direct jarvis.local to ingress
18) Add docker push test for harbor
19) Reset documentation

Change-Id: I71850770ba46d7635b950da60ec59c0b08208c70
Signed-off-by: intlabs <pete@port.direct>
2021-01-11 06:51:03 +00:00

77 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
#
# 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
#
# http://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.
set -e
HELM_CHART="$1"
: "${HELM_CHART_ROOT_PATH:="./charts"}"
: "${FEATURE_GATES:=""}"
: "${CONTAINER_DISTRO_NAME:="default"}"
: "${CONTAINER_DISTRO_VERSION:="default"}"
CHARTS_FEATURE_MIX="${FEATURE_GATES} ${CONTAINER_DISTRO_NAME} ${CONTAINER_DISTRO_VERSION}"
values_location="$(mktemp -d)"
function echoerr () {
echo "$@" 1>&2;
}
function generate_awk_exp_from_mask () {
local POSITION=1
for VALUE in $@; do
[ "${VALUE}" -eq 1 ] && echo -n "print \$${POSITION};"
POSITION=$((POSITION+1))
done
echo -e "\n"
}
function combination () {
POWER=$((2**$#))
BITS="$(awk "BEGIN { while (c++ < $#) printf \"0\" }")"
while [ "${POWER}" -gt 1 ];do
POWER=$((POWER-1))
BIN="$(bc <<< "obase=2; ${POWER}")"
MASK="$(echo "${BITS}" | sed -e "s/0\{${#BIN}\}$/$BIN/" | grep -o .)"
#NOTE: This line is odd, but written to support both BSD and GNU utils
awk -v ORS="-" "{$(generate_awk_exp_from_mask "$MASK")}" <<< "$@" | awk 1 | sed 's/-$//'
done
}
function replace_variables() {
for key in $(env); do
local arr=( $(echo $key | awk -F'=' '{ print $1, $2}') )
sed -i "s#%%%REPLACE_${arr[0]}%%%#${arr[1]}#g" $@
done
}
function override_file_args () {
OVERRIDE_ARGS=""
echoerr "We will attempt to use values-override files with the following paths:"
for FILE in $(combination ${1//,/ } | uniq | tac); do
FILE_PATH="${HELM_CHART_ROOT_PATH}/${HELM_CHART}/values_overrides/${FILE}.yaml"
echoerr "${FILE_PATH}"
if [ -f "${FILE_PATH}" ]; then
file_location=$(mktemp -d --tmpdir="${values_location}")
cp ${FILE_PATH} ${file_location}/${FILE_PATH##*/}
replace_variables ${file_location}/${FILE_PATH##*/}
OVERRIDE_ARGS+=" --values=${file_location}/${FILE_PATH##*/} "
fi
done
echo "${OVERRIDE_ARGS}"
}
echoerr "We are going to deploy the service ${HELM_CHART} using ${CONTAINER_DISTRO_NAME} (${CONTAINER_DISTRO_VERSION}) distribution containers."
#source ${HELM_CHART_ROOT_PATH}/tools/deployment/common/env-variables.sh
override_file_args "${CHARTS_FEATURE_MIX}"