-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(csi): support multiple model registries
Signed-off-by: Alessio Pragliola <[email protected]>
- Loading branch information
1 parent
505b00e
commit 5ad3b2b
Showing
9 changed files
with
324 additions
and
114 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 |
---|---|---|
|
@@ -62,6 +62,7 @@ jobs: | |
uses: helm/[email protected] | ||
with: | ||
node_image: "kindest/node:v1.27.11" | ||
config: ./csi/test/kind_config.yaml | ||
|
||
- name: Install kustomize | ||
run: ./csi/scripts/install_kustomize.sh | ||
|
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,5 @@ | ||
package constants | ||
|
||
import kserve "github.com/kserve/kserve/pkg/agent/storage" | ||
|
||
const MR kserve.Protocol = "model-registry://" |
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,41 @@ | ||
package modelregistry | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"strings" | ||
|
||
"github.com/kubeflow/model-registry/csi/pkg/constants" | ||
"github.com/kubeflow/model-registry/pkg/openapi" | ||
) | ||
|
||
func NewAPIClient(cfg *openapi.Configuration, storageUri string) *openapi.APIClient { | ||
client := openapi.NewAPIClient(cfg) | ||
|
||
// Parse the URI to retrieve the needed information to query model registry (modelArtifact) | ||
mrUri := strings.TrimPrefix(storageUri, string(constants.MR)) | ||
|
||
tokens := strings.SplitN(mrUri, "/", 3) | ||
|
||
if len(tokens) < 2 { | ||
return client | ||
} | ||
|
||
newCfg := openapi.NewConfiguration() | ||
newCfg.Host = tokens[0] | ||
newCfg.Scheme = "http" | ||
|
||
newClient := openapi.NewAPIClient(newCfg) | ||
|
||
if len(tokens) == 2 { | ||
// Check if the model registry service is available | ||
_, _, err := newClient.ModelRegistryServiceAPI.GetRegisteredModels(context.Background()).Execute() | ||
if err != nil { | ||
log.Printf("Falling back to base url %s for model registry service", cfg.Host) | ||
|
||
return client | ||
} | ||
} | ||
|
||
return newClient | ||
} |
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
Oops, something went wrong.