Add support for overriding docker images

The clients tarball provides a set of default docker images
to be used. This commit adds support for users to change
those default images to other images from any registry.

Changes included in this commit:
- add the "-p" and "-a" parameters to the "configure_client.sh"
  script in order to override default platform and application
  image locations
- fixed README file to properly handle IPv6 address when
  configuring the authentication file  for helm
- forced host networking for client docker containers in order
  to better handle network connectivity to the remote setups
  we want to connect to

Change-Id: I9b88ad91ee873330a0fd62ec7eb6056dd544a758
Story: 2006711
Task: 39150
Signed-off-by: Stefan Dinescu <stefan.dinescu@windriver.com>
This commit is contained in:
Stefan Dinescu 2020-03-25 10:56:34 +02:00
parent be41771eda
commit 6c6f0b0b18
3 changed files with 30 additions and 5 deletions

View File

@ -96,6 +96,11 @@ if [ -z "$OAM_IP" ]; then
# AIO-SX doesn't use oam_floating_ip, but instead uses just oam_ip
OAM_IP=$(system oam-show |grep oam_ip| awk '{print $4}')
fi
# If it's an IPv6 address we must enclose it in brackets
if [[ $OAM_IP =~ .*:.* ]]; then
OAM_IP="[${OAM_IP}]"
fi
kubectl config --kubeconfig ${OUTPUT_FILE} set-cluster stxcluster --server=https://${OAM_IP}:6443 --insecure-skip-tls-verify

View File

@ -70,11 +70,11 @@ else
fi
if [[ "$FORCE_SHELL" == "true" ]]; then
exec ${SHELL_COMMAND} run --rm -ti ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
exec ${SHELL_COMMAND} run --rm --network host -ti ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
elif [[ "$FORCE_NO_SHELL" == "true" ]]; then
exec ${SHELL_COMMAND} run --rm -t ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
exec ${SHELL_COMMAND} run --rm --network host -t ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
elif [ -z "$2" ]; then
exec ${SHELL_COMMAND} run --rm -ti ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
exec ${SHELL_COMMAND} run --rm --network host -ti ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
else
exec ${SHELL_COMMAND} run --rm -t ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
exec ${SHELL_COMMAND} run --rm --network host -t ${COMMAND_ENV} ${VOLUME_LIST} --workdir /wd ${CLIENT_IMAGE_NAME} "$@"
fi

View File

@ -15,6 +15,8 @@ TAG_FILE=docker_image_version.sh
WORK_DIR='.'
custom_conf_file=0
explicit_client_type=0
override_platform_image=0
override_application_image=0
# The script may be called from locations other
# than its own folder, so build the full path to
@ -39,9 +41,11 @@ usage(){
echo " (default value is admin-openrc.sh)"
echo "-k k8s_file kubernetis config file"
echo " (default value is temp-kubeconfig)"
echo "-p <image> override platform docker image"
echo "-a <image> override application docker image"
}
while getopts ":hr:w:o:t:k:" opt; do
while getopts ":hr:w:o:t:k:p:a:" opt; do
case $opt in
h)
usage
@ -64,6 +68,14 @@ while getopts ":hr:w:o:t:k:" opt; do
k)
K8S_FILE=${OPTARG}
;;
p)
PLATFORM_IMAGE=${OPTARG}
override_platform_image=1
;;
a)
APPLICATION_IMAGE=${OPTARG}
override_application_image=1
;;
*)
echo "Invalid parameter provided"
usage
@ -136,3 +148,11 @@ fi
echo "source ${PATH_TO_SCRIPT}/$ALIAS_FILE" >> $CONF_FILE
echo "source ${PATH_TO_SCRIPT}/$TAG_FILE" >> $CONF_FILE
if [[ $override_platform_image -eq 1 ]]; then
echo "export PLATFORM_DOCKER_IMAGE=\"${PLATFORM_IMAGE}\"" >> $CONF_FILE
fi
if [[ $override_application_image -eq 1 ]]; then
echo "export APPLICATION_DOCKER_IMAGE=\"${APPLICATION_IMAGE}\"" >> $CONF_FILE
fi