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

Get HPO working again #141

Merged
merged 2 commits into from
Jan 10, 2025
Merged
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
16 changes: 8 additions & 8 deletions .github/workflows/test_on_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build hpo
run: |
echo Software versions
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:

- name: Upload results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: hpo-results
path: ./hpo_docker_results.tar
Expand All @@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Minikube
uses: manusa/[email protected]
with:
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
ls
- name: Upload results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: hpo-results
path: ./hpo_minikube_results.tar
Expand All @@ -109,7 +109,7 @@ jobs:
test_on_native:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Sanity test on native
run: |
echo Software versions
Expand All @@ -127,7 +127,7 @@ jobs:

- name: Upload results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: hpo-results
path: ./hpo_native_results.tar
Expand All @@ -136,7 +136,7 @@ jobs:
grpc_test_on_native:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: GRPC Sanity test on native
run: |
echo Software versions
Expand All @@ -154,7 +154,7 @@ jobs:

- name: Upload results
if: failure()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: hpo-results
path: ./hpo_grpc_native_results.tar
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build hpo
run: |
echo Build hpo
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:

- name: Upload results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: hpo-results
path: ./hpo_docker_results.tar
Expand All @@ -64,7 +64,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Minikube
uses: manusa/[email protected]
with:
Expand All @@ -91,7 +91,7 @@ jobs:
ls
- name: Upload results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: hpo-results
path: ./hpo_minikube_results.tar
Expand Down
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