Skip to content

Commit

Permalink
Get HPO working again
Browse files Browse the repository at this point in the history
1.
Updated OS image
2. Use quay.io repo instead of DockerHub

Signed-off-by: Dinakar Guniguntala <[email protected]>
  • Loading branch information
dinogun committed Jan 9, 2025
1 parent d7e024e commit 74ec0a8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Dockerfile.hpo
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Runtime Docker Image
##########################################################
# Use ubi-minimal as the base image
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5-1733767867

ARG HPO_VERSION
ARG USER=hpo
Expand All @@ -32,7 +32,7 @@ ENV PYTHONUNBUFFERED=1 \
PYTHONUSERBASE=$HPO_HOME/app/.local

# Install packages needed for python to function correctly
RUN microdnf install -y python39 gcc-c++ python39-devel python39-pip\
RUN microdnf install -y python3 gcc-c++ python3-devel python3-pip\
&& microdnf update -y \
&& microdnf -y install shadow-utils \
# Setup the user for non-arbitrary UIDs with OpenShift
Expand Down
5 changes: 3 additions & 2 deletions build_hpo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
ROOT_DIR="${PWD}"
SCRIPTS_DIR="${ROOT_DIR}/scripts"
HPO_DOCKERFILE="Dockerfile.hpo"
HPO_CONTAINER_REPO="kruize/hpo"
HPO_CONTAINER_REPO="quay.io/kruize/hpo"
HPO_VERSION=$(grep -a -m 1 "HPO_VERSION" ${ROOT_DIR}/version.py | cut -d= -f2)
HPO_VERSION=$(sed -e 's/^"//' -e 's/"$//' <<<"$HPO_VERSION")
echo
Expand All @@ -30,7 +30,8 @@ BUILD_PARAMS="--pull --no-cache"
CONTAINER_RUNTIME="docker"

# source the helpers script
. ${SCRIPTS_DIR}/cluster-helpers.sh
source ${SCRIPTS_DIR}/common_utils.sh
source ${SCRIPTS_DIR}/cluster-helpers.sh

function usage() {
echo "Usage: $0 [-d] [-v version_string][-o HPO_CONTAINER_IMAGE]"
Expand Down
10 changes: 5 additions & 5 deletions deploy_hpo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

ROOT_DIR="${PWD}"
SCRIPTS_DIR="${ROOT_DIR}/scripts"
HPO_REPO="kruize/hpo"
HPO_REPO="quay.io/kruize/hpo"
HPO_VERSION=$(grep -a -m 1 "HPO_VERSION" ${ROOT_DIR}/version.py | cut -d= -f2)
HPO_VERSION=$(sed -e 's/^"//' -e 's/"$//' <<<"$HPO_VERSION")

Expand All @@ -38,9 +38,9 @@ timeout=-1
service_type="both"

# source the helpers script
. ${SCRIPTS_DIR}/cluster-helpers.sh
. ${SCRIPTS_DIR}/openshift-helpers.sh
. ${SCRIPTS_DIR}/common_utils.sh
source ${SCRIPTS_DIR}/cluster-helpers.sh
source ${SCRIPTS_DIR}/openshift-helpers.sh
source ${SCRIPTS_DIR}/common_utils.sh

function usage() {
echo
Expand All @@ -49,7 +49,7 @@ function usage() {
echo " -s | --start: start(default) the app"
echo " -t | --terminate: terminate the app"
echo " -c | --cluster_type: cluster type [docker|minikube|native|openshift]]"
echo " -o | --container_image: build with specific hpo container image name [Default - kruize/hpo:<version>]"
echo " -o | --container_image: deploy 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 " --both: install both REST and the gRPC service"
Expand Down
Empty file modified scripts/cluster-helpers.sh
100644 → 100755
Empty file.
Empty file modified scripts/openshift-helpers.sh
100644 → 100755
Empty file.
6 changes: 4 additions & 2 deletions src/rest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import threading
from http.server import BaseHTTPRequestHandler, HTTPServer
import re
import cgi
from email.message import EmailMessage
import json
import os
import pathlib
Expand Down Expand Up @@ -57,7 +57,9 @@ def _set_response(self, status_code, return_value):
def do_POST(self):
"""Serve a POST request."""
if re.search(HPOSupportedTypes.API_ENDPOINT + "$", self.path):
content_type, params = cgi.parse_header(self.headers.get('content-type'))
msg = EmailMessage()
msg['content-type'] = self.headers.get('content-type')
content_type, params = msg.get_content_type(), msg['content-type'].params
if content_type == HPOSupportedTypes.CONTENT_TYPE:
length = int(self.headers.get('content-length'))
str_object = self.rfile.read(length).decode('utf8')
Expand Down

0 comments on commit 74ec0a8

Please sign in to comment.