Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide option to user to change log levels #76

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions deploy_hpo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -49,6 +50,7 @@ function usage() {
echo " -o | --container_image: build with specific hpo container image name [Default - kruize/hpo:<version>]"
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"
Expand All @@ -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
Expand Down Expand Up @@ -107,6 +120,11 @@ while [ : ]; do
setup=0
shift
;;
-l | --logs)
LOG_LEVEL="${OPTARG}"
check_log_level
shift
;;
--rest)
service_type="REST"
shift
Expand Down
4 changes: 2 additions & 2 deletions scripts/cluster-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down