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

core: allow oci_layers_on_top with single manifest #18

Merged
merged 2 commits into from
Mar 6, 2025

Conversation

tarilabs
Copy link
Member

@tarilabs tarilabs commented Mar 5, 2025

when downloading single-arch (non-multi-arch) base image into oci-layout, using for example:

  • skopeo copy ----multi-arch system ...
  • oras copy --platform linux/arm64 --to-oci-layout ...

the base image oci-layout will not reference Index(es) but only OCI Image Manifest, the single image Manifest of the single-arch.

This modification resolves an old TODO in the code.

@tarilabs tarilabs changed the title ore: allow oci_layers_on_top with single manifest core: allow oci_layers_on_top with single manifest Mar 5, 2025
@tarilabs
Copy link
Member Author

tarilabs commented Mar 5, 2025

Tested also locally with:

kind create cluster
./e2e/deploy_distribution_registry.sh
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.1/cert-manager.yaml
e2e/repeat.sh kubectl apply --server-side -f https://github.com/kserve/kserve/releases/download/v0.14.0/kserve.yaml
e2e/repeat.sh kubectl apply --server-side -f https://github.com/kserve/kserve/releases/download/v0.14.0/kserve-cluster-resources.yaml
kubectl patch configmap/inferenceservice-config -n kserve --type=strategic -p '{"data": {"deploy": "{\"defaultDeploymentMode\": \"RawDeployment\"}"}}'
e2e/enable-modelcar.sh
IMAGE_DIR=download
OCI_REGISTRY_SOURCE=quay.io/mmortari/hello-world-wait:latest
OCI_REGISTRY_DESTINATION=localhost:5001/nstestorg/modelcar
# the following is done manually, but python shortcut are available
oras copy --platform linux/arm64 --to-oci-layout ${OCI_REGISTRY_SOURCE} ${IMAGE_DIR}:latest
chmod +w download/blobs/sha256/70378ac6bb0f7e7e39ce50fff837162f5fd38c4e8daf8de1a120df9a7d79d633
chmod +w download/blobs/sha256/c23ed8b7e30f5edd2417e1dd99fedad4445f3e835edb58760b2f83f2c0517878
# ...resume scenario
poetry run olot $IMAGE_DIR --modelcard tests/data/sample-model/README.md tests/data/sample-model/model.joblib
skopeo copy --tls-verify=false --multi-arch all oci:${IMAGE_DIR}:latest docker://${OCI_REGISTRY_DESTINATION}
skopeo copy --src-tls-verify=false docker://localhost:5001/nstestorg/modelcar docker-daemon:localhost:5001/nstestorg/modelcar:v1
e2e/repeat.sh kubectl apply -f e2e/isvc-modelcar.yaml
kubectl wait --for=condition=Ready isvc/my-inference-service --timeout=240s
echo "Starting port-forward..."
kubectl port-forward svc/my-inference-service-predictor 8080:80 &
PID=$!
sleep 2
echo "I have launched port-forward in background with: $PID."
echo "Check that OIP return the expected name"
curl -s http://localhost:8080/v2/models | jq -e '.models | index("my-inference-service") != null'
echo "Check that OIP produces an Inference Prediction"
curl -s -H "Content-Type: application/json" -d @e2e/data/input0.json http://localhost:8080/v2/models/my-inference-service/infer | jq
curl -s -H "Content-Type: application/json" -d @e2e/data/input1.json http://localhost:8080/v2/models/my-inference-service/infer | jq
curl -s -H "Content-Type: application/json" -d @e2e/data/input4.json http://localhost:8080/v2/models/my-inference-service/infer | jq

Screenshot 2025-03-05 at 11 37 15

@tarilabs tarilabs requested a review from jaideepr97 March 5, 2025 11:57
Copy link
Contributor

@Crazyglue Crazyglue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

Comment on lines -144 to +145
print(m)
logger.debug("Parsing manifest %s", m)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great cleanup!

@tarilabs
Copy link
Member Author

tarilabs commented Mar 6, 2025

thanks @Crazyglue @syntaxsdev

@tarilabs tarilabs merged commit 043d5e9 into main Mar 6, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants