forked from kubeflow/model-registry
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'odh-main' into tarilabs-20240318-midstreamsync
- Loading branch information
Showing
11 changed files
with
304 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version: "1" | ||
rules: | ||
- base: main | ||
upstream: kubeflow:main | ||
label: "tide/merge-method-merge" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
# DO NOT EDIT; this file is auto-generated using https://github.com/openshift/ci-tools. | ||
# Fetched from https://github.com/opendatahub-io/codeflare-operator root OWNERS | ||
# If the repo had OWNERS_ALIASES then the aliases were expanded | ||
# Logins who are not members of 'openshift' organization were filtered out | ||
# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md | ||
|
||
approvers: | ||
- andreyvelich | ||
- ckadner | ||
- tarilabs | ||
- rareddy | ||
- Tomcli | ||
- zijianjoy | ||
- dhirajsb | ||
- isinyaaa | ||
- lampajr | ||
- nehachopra27 | ||
- rareddy | ||
- rkubis | ||
- tarilabs | ||
- tonyxrmdavidson | ||
options: {} | ||
reviewers: | ||
- andreyvelich | ||
- dhirajsb | ||
- isinyaaa | ||
- lampajr | ||
- nehachopra27 | ||
- rareddy | ||
- rkubis | ||
- tarilabs | ||
- tonyxrmdavidson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: CatalogSource | ||
metadata: | ||
name: model-registry-test-source | ||
namespace: openshift-marketplace | ||
spec: | ||
displayName: '' | ||
image: 'registry-proxy.engineering.redhat.com/rh-osbs/iib:688477' | ||
publisher: '' | ||
sourceType: grpc |
38 changes: 38 additions & 0 deletions
38
openshift-ci/resources/opendatahub-data-science-cluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
kind: DataScienceCluster | ||
apiVersion: datasciencecluster.opendatahub.io/v1 | ||
metadata: | ||
labels: | ||
app.kubernetes.io/created-by: opendatahub-operator | ||
app.kubernetes.io/instance: default | ||
app.kubernetes.io/managed-by: kustomize | ||
app.kubernetes.io/name: datasciencecluster | ||
app.kubernetes.io/part-of: opendatahub-operator | ||
name: default-dsc | ||
spec: | ||
components: | ||
codeflare: | ||
managementState: Removed | ||
dashboard: | ||
managementState: Managed | ||
datasciencepipelines: | ||
managementState: Managed | ||
kserve: | ||
managementState: Managed | ||
serving: | ||
ingressGateway: | ||
certificate: | ||
type: SelfSigned | ||
managementState: Managed | ||
name: knative-serving | ||
kueue: | ||
managementState: Removed | ||
modelmeshserving: | ||
managementState: Managed | ||
modelregistry: | ||
managementState: Managed | ||
ray: | ||
managementState: Removed | ||
trustyai: | ||
managementState: Managed | ||
workbenches: | ||
managementState: Managed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: rhods-operator | ||
namespace: openshift-operators | ||
spec: | ||
channel: odh-nightlies | ||
installPlanApproval: Automatic | ||
name: rhods-operator | ||
source: model-registry-test-source | ||
sourceNamespace: openshift-marketplace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export RED='\033[0;31m' | ||
export GREEN='\033[0;32m' | ||
export NC='\033[0m' | ||
export YELLOW='\033[0;33m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
#!/bin/bash | ||
|
||
# Define variables for ODH nightly deployment | ||
OPENDATAHUB_CATALOGUE_SOURCE_CREATE="../resources/opendatahub-catalogue-source.yaml" | ||
OPENDATAHUB_DEPLOY_MANIFEST="../resources/opendatahub-operator-deploy.yaml" | ||
DATA_SCIENCE_CLUSTER_MANIFEST="../resources/opendatahub-data-science-cluster.yaml" | ||
MODEL_REGISTRY_OPERATOR_GIT_URL="https://github.com/opendatahub-io/model-registry-operator.git" | ||
source colour_text_variables.sh | ||
|
||
# Function to deploy and wait for deployment | ||
deploy_and_wait() { | ||
local manifest=$1 | ||
local resource_name=$(basename -s .yaml $manifest) | ||
|
||
echo "Deploying $resource_name from $manifest..." | ||
|
||
if oc apply -f $manifest --wait=true --timeout=300s; then | ||
echo "Deployment of $resource_name succeeded." | ||
else | ||
echo "Error: Deployment of $resource_name failed or timed out." >&2 | ||
return 1 | ||
fi | ||
} | ||
|
||
# Deploy resource and wait for readiness | ||
deploy_resource() { | ||
local manifest=$1 | ||
echo $manifest "deploying" | ||
deploy_and_wait $manifest | ||
} | ||
|
||
# Function to clone a Git repository and deploy the appropriate | ||
clone_deploy_model_registry_operator_crd_files() { | ||
local url="temp_repo/config/samples/mysql/" | ||
local files=("mysql-db.yaml" "modelregistry_v1alpha1_modelregistry.yaml") | ||
# Clone the Git repository | ||
git clone "$MODEL_REGISTRY_OPERATOR_GIT_URL" temp_repo | ||
|
||
#Change the deployment serviceRoute to enabled | ||
yq eval '.spec.rest.serviceRoute = "enabled"' -i "$url${files[1]}" | ||
|
||
# Deploy the model-registry crd files | ||
for file in "${files[@]}"; do | ||
local path_and_file="$url$file" | ||
oc apply -f "$path_and_file" --wait=true --timeout=300s >/tmp/oc_output 2>&1 && rm /tmp/oc_output | ||
done | ||
|
||
# Remove temp_repo | ||
rm -rf temp_repo | ||
} | ||
|
||
check_deployment_availability() { | ||
local namespace="$1" | ||
local deployment="$2" | ||
local timeout=300 # Timeout in seconds | ||
local start_time=$(date +%s) | ||
|
||
# Loop until timeout | ||
while (( $(date +%s) - start_time < timeout )); do | ||
# Get the availability status of the deployment | ||
local deployment_status=$(oc get deployment "$deployment" -n "$namespace" --no-headers -o custom-columns=:.status.availableReplicas) | ||
|
||
# Check if the deployment is available | ||
if [[ $deployment_status != "" ]]; then | ||
echo -e "${GREEN}✔ Success:${NC} Deployment $deployment is available" | ||
return 0 # Success | ||
fi | ||
|
||
sleep 5 # Wait for 5 seconds before checking again | ||
done | ||
|
||
echo -e "${RED}X Fail:${NC} Timeout reached. Deployment $deployment did not become available within $timeout seconds" | ||
return 1 # Failure | ||
} | ||
|
||
check_pod_status() { | ||
local namespace="$1" | ||
local pod_selector="$2" | ||
local expected_ready_containers="$3" | ||
local timeout=300 # Timeout in seconds | ||
local start_time=$(date +%s) | ||
|
||
# Loop until timeout | ||
while (( $(date +%s) - start_time < timeout )); do | ||
# Get the list of pods in the specified namespace matching the provided partial names | ||
local pod_list=$(oc get pods -n $namespace $pod_selector --no-headers -o custom-columns=NAME:.metadata.name) | ||
|
||
# Iterate over each pod in the list | ||
while IFS= read -r pod_name; do | ||
# Get the pod info | ||
local pod_info=$(oc get pod "$pod_name" -n "$namespace" --no-headers) | ||
|
||
# Extract pod status and ready status from the info | ||
local pod_name=$(echo "$pod_info" | awk '{print $1}') | ||
local pod_status=$(echo "$pod_info" | awk '{print $3}') | ||
local pod_ready=$(echo "$pod_info" | awk '{print $2}') | ||
local ready_containers=$(echo "$pod_ready" | cut -d'/' -f1) | ||
|
||
# Check if the pod is Running and all containers are ready | ||
if [[ $pod_status == "Running" ]] && [[ $ready_containers -eq $expected_ready_containers ]]; then | ||
echo -e "${GREEN}✔ Success:${NC} Pod $pod_name is running and $ready_containers out of $expected_ready_containers containers are ready" | ||
return 0 # Success | ||
else | ||
echo -e "${YELLOW}! Info:${NC} Pod $pod_name is not running or does not have $expected_ready_containers containers ready" | ||
fi | ||
done <<< "$pod_list" | ||
|
||
sleep 5 # Wait for 5 seconds before checking again | ||
done | ||
|
||
echo -e "${RED}X Failure:${NC} Timeout reached. No pod matching '$pod_name_partial' became ready within $timeout seconds" | ||
return 1 # Failure | ||
} | ||
|
||
check_route_status() { | ||
local namespace="$1" | ||
local route_name="$2" | ||
local key="items" | ||
local interval=5 | ||
local timeout=300 | ||
local start_time=$(date +%s) | ||
|
||
while (( $(date +%s) - start_time < timeout )); do | ||
# Get the route URL | ||
local route=$(oc get route -n "$namespace" "$route_name" -o jsonpath='{.spec.host}') | ||
local route_url="http://$route" | ||
|
||
if [[ -z "$route_url" ]]; then | ||
echo -e "${RED}X Fail:${NC} Route '$route_name' does not exist in namespace '$namespace'" | ||
return 1 | ||
else | ||
echo -e "${GREEN}✔ Success:${NC} Route '$route_name' exists in namespace '$namespace'" | ||
fi | ||
|
||
# Test if the route is live | ||
local response=$(curl -s -o /dev/null -w "%{http_code}" "$route_url/api/model_registry/v1alpha2/registered_models") | ||
|
||
# Check if the response status code is 200 OK or 404 Not Found | ||
if [[ "$response" == "200" ]]; then | ||
echo -e "${GREEN}✔ Success:${NC} Route server is reachable. Status code: 200 OK" | ||
return 0 | ||
elif [[ "$response" == "404" ]]; then | ||
echo -e "${GREEN}✔ Success:${NC} Route server is reachable. Status code: 404 Not Found" | ||
return 0 | ||
else | ||
echo -e "${RED}X Fail:${NC} Route server is unreachable. Status code: $response" | ||
fi | ||
|
||
sleep "$interval" | ||
done | ||
|
||
echo -e "${RED}X Fail:${NC} Timeout reached. Route '$route_name' did not become live within $timeout seconds." | ||
return 1 | ||
} | ||
|
||
# Run the deployment tests. | ||
run_deployment_tests() { | ||
check_deployment_availability default model-registry-db | ||
check_deployment_availability default modelregistry-sample | ||
check_pod_status default "-l name=model-registry-db" 1 | ||
check_pod_status default "-l app=modelregistry-sample" 2 | ||
check_route_status "default" "modelregistry-sample-http" | ||
} | ||
|
||
# Main function for orchestrating deployments | ||
main() { | ||
deploy_and_wait $OPENDATAHUB_CATALOGUE_SOURCE_CREATE | ||
deploy_resource $OPENDATAHUB_DEPLOY_MANIFEST | ||
deploy_resource $DATA_SCIENCE_CLUSTER_MANIFEST | ||
check_pod_status "opendatahub" "-l component.opendatahub.io/name=model-registry-operator" 2 | ||
clone_deploy_model_registry_operator_crd_files | ||
run_deployment_tests | ||
} | ||
|
||
# Execute main function | ||
main |