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 sync remote-tracking branch 'upstream/main' into tarilabs-20241…
…028-sync
- Loading branch information
Showing
16 changed files
with
595 additions
and
242 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -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 = cfg.Scheme | ||
|
||
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
Oops, something went wrong.