-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement model registry inference service reconciliation (#135)
Implement the model registry InferenceService reconciliation, the implemented workflow is the opposite of the one proposed in #124. Here the direction goes from Cluster to ModelRegistry. The new reconciler will monitor InferenceService CRs having pre-defined labels, based on those labels will sync the model registry by keeping track of every deployment that occurred in the cluster. Then will update the InferenceService CR by linking it to the model registry record using a specific label. * Fix overlays/dev deployment * Setup InferenceService reconciliation to model registry * Setup e2e test for new reconciler * Enable new reconciler * Create serving env when not found * Retrieve MR namespace from ISVC label * Added Kind cluster configuration for local e2e tests * Check if IS already exists in MR * Improve e2e testing * Refactor dev manifests Signed-off-by: Andrea Lamparelli <[email protected]> Co-authored-by: Edgar Hernández <[email protected]>
- Loading branch information
1 parent
294850c
commit 518cfa2
Showing
24 changed files
with
1,610 additions
and
52 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
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,3 +1,10 @@ | ||
resources: | ||
- serving.kserve.io_inferenceservices.yaml | ||
- serving.kserve.io_servingruntimes.yaml | ||
- route.openshift.io_routes.yaml | ||
- monitoring.coreos.com_podmonitors.yaml | ||
- monitoring.coreos.com_servicemonitors.yaml | ||
- maistra.io_servicemeshmemberrolls.yaml | ||
- maistra.io_servicemeshmembers.yaml | ||
- telemetry.istio.io_telemetries.yaml | ||
# - route.openshift.io_routes.yaml #minikube |
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,3 +1,30 @@ | ||
resources: | ||
- ../../crd/external | ||
- ../../manager/namespace.yaml | ||
- ../../crd/external | ||
- ../../default | ||
|
||
patchesStrategicMerge: | ||
- odh_model_controller_manager_patch.yaml | ||
|
||
namespace: default | ||
configMapGenerator: | ||
- envs: | ||
- params.env | ||
name: odh-model-controller-parameters | ||
generatorOptions: | ||
disableNameSuffixHash: true | ||
|
||
vars: | ||
- fieldref: | ||
fieldPath: metadata.namespace | ||
name: mesh-namespace | ||
objref: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
name: odh-model-controller-parameters | ||
- fieldref: | ||
fieldPath: data.monitoring-namespace | ||
name: monitoring-namespace | ||
objref: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
name: odh-model-controller-parameters |
19 changes: 19 additions & 0 deletions
19
config/overlays/dev/odh_model_controller_manager_patch.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,19 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: odh-model-controller | ||
spec: | ||
replicas: 3 | ||
template: | ||
spec: | ||
containers: | ||
- args: | ||
- --leader-elect | ||
- --model-registry-inference-reconcile | ||
- "--monitoring-namespace" | ||
- "$(MONITORING_NS)" | ||
env: | ||
- name: MONITORING_NS | ||
value: $(monitoring-namespace) | ||
name: manager | ||
imagePullPolicy: IfNotPresent |
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,2 @@ | ||
monitoring-namespace=default | ||
metadata.namespace=default |
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 |
---|---|---|
|
@@ -196,6 +196,7 @@ rules: | |
verbs: | ||
- get | ||
- list | ||
- update | ||
- watch | ||
- apiGroups: | ||
- serving.kserve.io | ||
|
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,34 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package comparators | ||
|
||
import ( | ||
"reflect" | ||
|
||
kservev1beta1 "github.com/kserve/kserve/pkg/apis/serving/v1beta1" | ||
"github.com/opendatahub-io/odh-model-controller/controllers/constants" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
func GetInferenceServiceComparator() ResourceComparator { | ||
return func(deployed client.Object, requested client.Object) bool { | ||
deployedInferenceService := deployed.(*kservev1beta1.InferenceService) | ||
requestedInferenceService := requested.(*kservev1beta1.InferenceService) | ||
return reflect.DeepEqual(deployedInferenceService.Labels[constants.ModelRegistryInferenceServiceIdLabel], requestedInferenceService.Labels[constants.ModelRegistryInferenceServiceIdLabel]) && | ||
reflect.DeepEqual(deployedInferenceService.Labels[constants.ModelRegistryRegisteredModelIdLabel], requestedInferenceService.Labels[constants.ModelRegistryRegisteredModelIdLabel]) && | ||
reflect.DeepEqual(deployedInferenceService.Labels[constants.ModelRegistryModelVersionIdLabel], requestedInferenceService.Labels[constants.ModelRegistryModelVersionIdLabel]) | ||
} | ||
} |
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
Oops, something went wrong.