Skip to content

Commit 74ec0a8

Browse files
committed
Get HPO working again
1. Updated OS image 2. Use quay.io repo instead of DockerHub Signed-off-by: Dinakar Guniguntala <[email protected]>
1 parent d7e024e commit 74ec0a8

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

Dockerfile.hpo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# Runtime Docker Image
1818
##########################################################
1919
# Use ubi-minimal as the base image
20-
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
20+
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5-1733767867
2121

2222
ARG HPO_VERSION
2323
ARG USER=hpo
@@ -32,7 +32,7 @@ ENV PYTHONUNBUFFERED=1 \
3232
PYTHONUSERBASE=$HPO_HOME/app/.local
3333

3434
# Install packages needed for python to function correctly
35-
RUN microdnf install -y python39 gcc-c++ python39-devel python39-pip\
35+
RUN microdnf install -y python3 gcc-c++ python3-devel python3-pip\
3636
&& microdnf update -y \
3737
&& microdnf -y install shadow-utils \
3838
# Setup the user for non-arbitrary UIDs with OpenShift

build_hpo.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
ROOT_DIR="${PWD}"
1818
SCRIPTS_DIR="${ROOT_DIR}/scripts"
1919
HPO_DOCKERFILE="Dockerfile.hpo"
20-
HPO_CONTAINER_REPO="kruize/hpo"
20+
HPO_CONTAINER_REPO="quay.io/kruize/hpo"
2121
HPO_VERSION=$(grep -a -m 1 "HPO_VERSION" ${ROOT_DIR}/version.py | cut -d= -f2)
2222
HPO_VERSION=$(sed -e 's/^"//' -e 's/"$//' <<<"$HPO_VERSION")
2323
echo
@@ -30,7 +30,8 @@ BUILD_PARAMS="--pull --no-cache"
3030
CONTAINER_RUNTIME="docker"
3131

3232
# source the helpers script
33-
. ${SCRIPTS_DIR}/cluster-helpers.sh
33+
source ${SCRIPTS_DIR}/common_utils.sh
34+
source ${SCRIPTS_DIR}/cluster-helpers.sh
3435

3536
function usage() {
3637
echo "Usage: $0 [-d] [-v version_string][-o HPO_CONTAINER_IMAGE]"

deploy_hpo.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

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

@@ -38,9 +38,9 @@ timeout=-1
3838
service_type="both"
3939

4040
# source the helpers script
41-
. ${SCRIPTS_DIR}/cluster-helpers.sh
42-
. ${SCRIPTS_DIR}/openshift-helpers.sh
43-
. ${SCRIPTS_DIR}/common_utils.sh
41+
source ${SCRIPTS_DIR}/cluster-helpers.sh
42+
source ${SCRIPTS_DIR}/openshift-helpers.sh
43+
source ${SCRIPTS_DIR}/common_utils.sh
4444

4545
function usage() {
4646
echo
@@ -49,7 +49,7 @@ function usage() {
4949
echo " -s | --start: start(default) the app"
5050
echo " -t | --terminate: terminate the app"
5151
echo " -c | --cluster_type: cluster type [docker|minikube|native|openshift]]"
52-
echo " -o | --container_image: build with specific hpo container image name [Default - kruize/hpo:<version>]"
52+
echo " -o | --container_image: deploy specific hpo container image name [Default - kruize/hpo:<version>]"
5353
echo " -n | --namespace : Namespace to which hpo is deployed [Default - monitoring namespace for cluster type minikube]"
5454
echo " -d | --configmaps_dir : Config maps directory [Default - manifests/configmaps]"
5555
echo " --both: install both REST and the gRPC service"

scripts/cluster-helpers.sh

100644100755
File mode changed.

scripts/openshift-helpers.sh

100644100755
File mode changed.

src/rest_service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import threading
1717
from http.server import BaseHTTPRequestHandler, HTTPServer
1818
import re
19-
import cgi
19+
from email.message import EmailMessage
2020
import json
2121
import os
2222
import pathlib
@@ -57,7 +57,9 @@ def _set_response(self, status_code, return_value):
5757
def do_POST(self):
5858
"""Serve a POST request."""
5959
if re.search(HPOSupportedTypes.API_ENDPOINT + "$", self.path):
60-
content_type, params = cgi.parse_header(self.headers.get('content-type'))
60+
msg = EmailMessage()
61+
msg['content-type'] = self.headers.get('content-type')
62+
content_type, params = msg.get_content_type(), msg['content-type'].params
6163
if content_type == HPOSupportedTypes.CONTENT_TYPE:
6264
length = int(self.headers.get('content-length'))
6365
str_object = self.rfile.read(length).decode('utf8')

0 commit comments

Comments
 (0)