diff --git a/deploy_hpo.sh b/deploy_hpo.sh index e2747e1..33a16b5 100755 --- a/deploy_hpo.sh +++ b/deploy_hpo.sh @@ -33,6 +33,7 @@ non_interactive=0 hpo_ns="" # docker: loop timeout is turned off by default timeout=-1 +LOG_LEVEL="info" service_type="both" # source the helpers script @@ -49,6 +50,7 @@ function usage() { echo " -o | --container_image: build with specific hpo container image name [Default - kruize/hpo:]" echo " -n | --namespace : Namespace to which hpo is deployed [Default - monitoring namespace for cluster type minikube]" echo " -d | --configmaps_dir : Config maps directory [Default - manifests/configmaps]" + echo " -l | --logs : set specific logging level [Default - info]" echo " --both: install both REST and the gRPC service" echo " --rest: install REST only" echo " Environment Variables to be set: REGISTRY, REGISTRY_EMAIL, REGISTRY_USERNAME, REGISTRY_PASSWORD" @@ -66,6 +68,17 @@ function check_cluster_type() { exit -1 esac } +# Check if the cluster_type is one of icp or openshift +function check_log_level() { + case "${LOG_LEVEL}" in + info|debug|warning|error|critical) + ;; + *) + echo "Error: unsupported logging type: ${LOG_LEVEL}" + usage + exit -1 + esac +} VALID_ARGS=$(getopt -o ac:d:o:n:strb --long non_interactive,cluster_type:,configmaps:,container_image:,namespace:,start,terminate,rest,both -- "$@") if [[ $? -ne 0 ]]; then @@ -107,6 +120,11 @@ while [ : ]; do setup=0 shift ;; + -l | --logs) + LOG_LEVEL="${OPTARG}" + check_log_level + shift + ;; --rest) service_type="REST" shift diff --git a/scripts/cluster-helpers.sh b/scripts/cluster-helpers.sh index 3f584ca..9246812 100644 --- a/scripts/cluster-helpers.sh +++ b/scripts/cluster-helpers.sh @@ -89,9 +89,9 @@ function native_start() { check_prereq running ${SERVICE_STATUS_NATIVE} if [ "$1" = "REST" ]; then - python3 -u src/service.py "REST" + python3 -u src/service.py "REST" -log=${LOG_LEVEL} else - python3 -u src/service.py + python3 -u src/service.py -log=${LOG_LEVEL} fi }