Skip to content

feat(controller): introduce inferenceservice controller#917

Merged
google-oss-prow[bot] merged 8 commits intokubeflow:mainfrom
Al-Pragliola:al-pragliola-model-registry-controller
Apr 14, 2025
Merged

feat(controller): introduce inferenceservice controller#917
google-oss-prow[bot] merged 8 commits intokubeflow:mainfrom
Al-Pragliola:al-pragliola-model-registry-controller

Conversation

@Al-Pragliola
Copy link
Copy Markdown
Contributor

@Al-Pragliola Al-Pragliola commented Mar 28, 2025

Description

closes #577

How Has This Been Tested?

Tilt testing

# if using podman
DOCKER_BUILDKIT=0 make -C devenv tilt-up
# with docker
make -C devenv tilt-up

## wait for model registry proxy to be up and running

export MR_HOSTNAME=localhost:8080

curl --silent -X 'POST' \
    "$MR_HOSTNAME/api/model_registry/v1alpha3/registered_models" \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "description": "Iris scikit-learn model",
    "name": "iris"
}'

curl --silent -X 'POST' \
      "$MR_HOSTNAME/api/model_registry/v1alpha3/model_versions" \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
      "description": "Iris model version v1",
      "name": "v1",
      "registeredModelID": "1"
}'

curl --silent -X 'POST' \
      "$MR_HOSTNAME/api/model_registry/v1alpha3/model_versions/2/artifacts" \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
      "description": "Model artifact for Iris v1",
      "uri": "gs://kfserving-examples/models/sklearn/1.0/model",
      "state": "UNKNOWN",
      "name": "iris-model-v1",
      "modelFormatName": "sklearn",
      "modelFormatVersion": "1",
      "artifactType": "model-artifact"
}'

kubectl apply -n kubeflow -f - <<EOF
    apiVersion: "serving.kserve.io/v1beta1"
    kind: "InferenceService"
    metadata:
      name: "iris-model"
      labels:
        modelregistry.kubeflow.org/registered-model-id: "1"
        modelregistry.kubeflow.org/model-version-id: "2"
      annotations:
        sidecar.istio.io/inject: "false"
    spec:
      predictor:
        model:
          modelFormat:
            name: sklearn
            version: "1"
          storageUri: "gs://kfserving-examples/models/sklearn/1.0/model"
    EOF

kubectl get inferenceservices.serving.kserve.io -n kubeflow iris-model -o yaml | grep inference-service-id

Manual testing

kubectl create ns kubeflow

MODEL_REGISTRY_VERSION=0.2.15
kubectl apply -k "https://github.com/kubeflow/model-registry/manifests/kustomize/overlays/db?ref=v${MODEL_REGISTRY_VERSION}"

# port forward in another shell 
kubectl port-forward --namespace kubeflow svc/model-registry-service 8080:8080

export MR_HOSTNAME=localhost:8080

curl --silent -X 'POST' \
    "$MR_HOSTNAME/api/model_registry/v1alpha3/registered_models" \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "description": "Iris scikit-learn model",
    "name": "iris"
}'

curl --silent -X 'POST' \
      "$MR_HOSTNAME/api/model_registry/v1alpha3/model_versions" \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
      "description": "Iris model version v1",
      "name": "v1",
      "registeredModelID": "1"
}'

curl --silent -X 'POST' \
      "$MR_HOSTNAME/api/model_registry/v1alpha3/model_versions/2/artifacts" \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
      "description": "Model artifact for Iris v1",
      "uri": "gs://kfserving-examples/models/sklearn/1.0/model",
      "state": "UNKNOWN",
      "name": "iris-model-v1",
      "modelFormatName": "sklearn",
      "modelFormatVersion": "1",
      "artifactType": "model-artifact"
}'

helm install kserve-crd oci://ghcr.io/kserve/charts/kserve-crd --version v0.15.0

docker build -t docker.io/controller/controller:0.1.0 -f ./cmd/controller/Dockerfile.controller .

kind load docker-image docker.io/controller/controller:0.1.0

IMG_REPO=controller/controller make controller/deploy

kubectl patch deployment -n kubeflow controller-controller-manager --patch '{"spec": {"template": {"spec": {"containers": [{"name": "manager", "image": "controller/controller:0.1.0", "imagePullPolicy": "IfNotPresent"}]}}}}'

kubectl apply -n kubeflow -f - <<EOF
    apiVersion: "serving.kserve.io/v1beta1"
    kind: "InferenceService"
    metadata:
      name: "iris-model"
      labels:
        modelregistry.kubeflow.org/registered-model-id: "1"
        modelregistry.kubeflow.org/model-version-id: "2"
      annotations:
        sidecar.istio.io/inject: "false"
    spec:
      predictor:
        model:
          modelFormat:
            name: sklearn
            version: "1"
          storageUri: "gs://kfserving-examples/models/sklearn/1.0/model"
    EOF

kubectl get inferenceservices.serving.kserve.io -n kubeflow iris-model -o yaml | grep inference-service-id

output of grep should be

modelregistry.kubeflow.org/inference-service-id: "4"

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages; the author will squash them after approval or in case of manual merges will ask to merge with squash.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work.
  • Code changes follow the kubeflow contribution guidelines.
  • For first time contributors: Please reach out to the Reviewers to ensure all tests are being run, ensuring the label ok-to-test has been added to the PR.

@Al-Pragliola
Copy link
Copy Markdown
Contributor Author

/cc @pboyd @dhirajsb @adysenrothman

@google-oss-prow google-oss-prow Bot requested a review from pboyd April 4, 2025 19:22
@google-oss-prow
Copy link
Copy Markdown
Contributor

@Al-Pragliola: GitHub didn't allow me to request PR reviews from the following users: dhirajsb, adysenrothman.

Note that only kubeflow members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

/cc @pboyd @dhirajsb @adysenrothman

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Copy Markdown
Member

@pboyd pboyd left a comment

Choose a reason for hiding this comment

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

I had few minor comments, but nothing major.

/lgtm

Comment thread cmd/controller/Dockerfile.controller Outdated
Comment thread cmd/controller/Dockerfile.controller Outdated

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do you think about starting with ubi9? I understand that we'll have to upgrade soon.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We are stuck in ubi8 until we create an alternative to mlmd, I would like to wait until then and move everything to ubi9

Comment thread manifests/kustomize/options/controller/manager/manager.yaml Outdated
@google-oss-prow google-oss-prow Bot added lgtm and removed lgtm labels Apr 4, 2025
@Al-Pragliola
Copy link
Copy Markdown
Contributor Author

thanks for your suggestions @pboyd 🙏🏼

@Al-Pragliola Al-Pragliola requested a review from pboyd April 7, 2025 13:59
Copy link
Copy Markdown
Member

@pboyd pboyd left a comment

Choose a reason for hiding this comment

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

/lgtm

@google-oss-prow google-oss-prow Bot added the lgtm label Apr 7, 2025
Copy link
Copy Markdown
Contributor

@adysenrothman adysenrothman left a comment

Choose a reason for hiding this comment

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

good work on this! /lgtm

@pboyd
Copy link
Copy Markdown
Member

pboyd commented Apr 14, 2025

/lgtm

@google-oss-prow google-oss-prow Bot added the lgtm label Apr 14, 2025
@tarilabs
Copy link
Copy Markdown
Member

I've restarted the Test CSI GHA.

@google-oss-prow google-oss-prow Bot removed the lgtm label Apr 14, 2025
Al-Pragliola and others added 8 commits April 14, 2025 16:09
…stry repo

Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Co-authored-by: Paul Boyd <paul@camelot.email>
Signed-off-by: Alessio Pragliola <83355398+Al-Pragliola@users.noreply.github.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
@Al-Pragliola Al-Pragliola force-pushed the al-pragliola-model-registry-controller branch from bfb8e40 to 7d7b54b Compare April 14, 2025 14:13
@tarilabs tarilabs requested a review from pboyd April 14, 2025 14:51
Copy link
Copy Markdown
Member

@tarilabs tarilabs left a comment

Choose a reason for hiding this comment

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

@pboyd can you kindly reapply lgtm, from my side
/approve

Copy link
Copy Markdown
Member

@pboyd pboyd left a comment

Choose a reason for hiding this comment

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

/lgtm

@google-oss-prow google-oss-prow Bot added the lgtm label Apr 14, 2025
@google-oss-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pboyd, tarilabs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow Bot merged commit a5f1fea into kubeflow:main Apr 14, 2025
17 checks passed
@Al-Pragliola Al-Pragliola deleted the al-pragliola-model-registry-controller branch April 14, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Kserve <> Model Registry connection: InferenceService Controller

4 participants