Commit f7f28b0d authored by Julien Leduc's avatar Julien Leduc
Browse files

Adding a systemd option for create_instance.sh and run_systemtest.sh

parent a5caab17
......@@ -13,6 +13,9 @@ model="mhvtl"
# EOS short instance name
EOSINSTANCE=ctaeos
# By default to not use systemd to manage services inside the containers
usesystemd=0
# By default keep Database and keep Objectstore
# default should not make user loose data if he forgot the option
keepdatabase=1
......@@ -21,9 +24,10 @@ keepobjectstore=1
usage() { cat <<EOF 1>&2
Usage: $0 -n <namespace> [-o <objectstore_configmap>] [-d <database_configmap>] \
[-p <gitlab pipeline ID> | -b <build tree base> -B <build tree subdir> ] \
[-D] [-O] [-m [mhvtl|ibm]]
[-S] [-D] [-O] [-m [mhvtl|ibm]]
Options:
-S Use systemd to manage services inside containers
-b The directory containing both the source and the build tree for CTA. It will be mounted RO in the
containers.
-B The subdirectory within the -b directory where the build tree is.
......@@ -35,7 +39,7 @@ exit 1
die() { echo "$@" 1>&2 ; exit 1; }
while getopts "n:o:d:p:b:B:DOm:" o; do
while getopts "n:o:d:p:b:B:SDOm:" o; do
case "${o}" in
o)
config_objectstore=${OPTARG}
......@@ -58,6 +62,9 @@ while getopts "n:o:d:p:b:B:DOm:" o; do
b)
buildtree=${OPTARG}
;;
S)
usesystemd=1
;;
B)
buildtreesubdir=${OPTARG}
;;
......@@ -82,6 +89,9 @@ if [ ! -z "${pipelineid}" -a ! -z "${buildtree}" ]; then
usage
fi
# everyone needs poddir temporary directory to generate pod yamls
poddir=$(mktemp -d)
if [ ! -z "${buildtree}" ]; then
# We need to know the subdir as well
if [ -z "${buildtreesubdir}" ]; then
......@@ -93,8 +103,6 @@ if [ ! -z "${buildtree}" ]; then
# tag image as otherwise kubernetes will always pull latest and won't find it...
docker rmi buildtree-runner:v0 &>/dev/null
docker tag buildtree-runner buildtree-runner:v0
# Create temporary directory for modified pod files
poddir=$(mktemp -d)
cp pod-* ${poddir}
sed -i ${poddir}/pod-* -e "s/\(^\s\+image\):.*/\1: buildtree-runner:v0\n\1PullPolicy: Never/"
......@@ -122,8 +130,6 @@ else
fi
echo "Creating instance using docker image with tag: ${imagetag}"
# Create temporary directory for modified pod files
poddir=$(mktemp -d)
cp pod-* ${poddir}
sed -i ${poddir}/pod-* -e "s/\(^\s\+image:[^:]\+:\).*/\1${imagetag}/"
......@@ -133,6 +139,12 @@ else
fi
fi
if [ $usesystemd == 1 ] ; then
echo "Using systemd to start services on some pods"
for podname in ctafrontend tpsrv; do
sed -i "/^\ *command:/d" ${poddir}/pod-${podname}*.yaml
done
fi
if [ $keepdatabase == 1 ] ; then
echo "DB content will be kept"
......
......@@ -16,13 +16,15 @@ keepnamespace=0
useoracle=0
# by default use VFS objectstore
useceph=0
# by default do not use systemd to manage services in containers
usesystemd=0
# default systemtest timeout is 1 hour
SYSTEMTEST_TIMEOUT=3600
die() { echo "$@" 1>&2 ; exit 1; }
usage() { cat <<EOF 1>&2
Usage: $0 -n <namespace> -s <systemtest_script> [-p <gitlab pipeline ID> | -b <build tree base> -B <build tree subdir> ] [-t <systemtest timeout in seconds>] [-k] [-O] [-D]
Usage: $0 -n <namespace> -s <systemtest_script> [-p <gitlab pipeline ID> | -b <build tree base> -B <build tree subdir> ] [-t <systemtest timeout in seconds>] [-k] [-O] [-D] [-S]
Options:
-b The directory containing both the source and the build tree for CTA. It will be mounted RO in the
......@@ -31,6 +33,7 @@ Options:
-k keep namespace after systemtest_script run if successful
-O use Ceph account associated to this node (wipe content before tests), by default use local VFS
-D use Oracle account associated to this node (wipe content before tests), by default use local sqlite DB
-S Use systemd to manage services inside containers
Create a kubernetes instance and launch the system test script specified.
......@@ -44,7 +47,7 @@ exit 1
# always delete DB and OBJECTSTORE for tests
CREATE_OPTS="-D -O"
while getopts "n:s:p:b:B:t:kDO" o; do
while getopts "n:s:p:b:B:t:kDOS" o; do
case "${o}" in
s)
systemtest_script=${OPTARG}
......@@ -74,6 +77,9 @@ while getopts "n:s:p:b:B:t:kDO" o; do
O)
useceph=1
;;
S)
usesystemd=1
;;
*)
usage
;;
......@@ -115,6 +121,9 @@ if [ $useceph == 1 ] ; then
fi
fi
if [ $usesystemd == 1 ] ; then
CREATE_OPTS="${CREATE_OPTS} -S"
fi
log_dir="${orchestration_dir}/../../pod_logs/${namespace}"
mkdir -p ${log_dir}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment