Skip to content

Commit

Permalink
feat: add custom model support
Browse files Browse the repository at this point in the history
  • Loading branch information
Apoorva64 committed Oct 20, 2024
1 parent 56e6385 commit ce5ec66
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ spec:
args:
- --leader-elect
- --health-probe-bind-address=:8081
image: ghcr.io/startupnationlabs/simple-ollama-operator/operator:7140985dc58a76e689b9802cbd224630924bcf77
image: ghcr.io/startupnationlabs/simple-ollama-operator/operator:56e63854b4f9bc038972f5fbf8c636724d2ef7f5
name: manager
securityContext:
allowPrivilegeEscalation: false
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/custommodel_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (r *CustomModelReconciler) Reconcile(ctx context.Context, req ctrl.Request)
return ctrl.Result{}, err
}
// if the CustomModel does not exist, create it
logger.Info("CustomModel does not exist, creating CustomModel", "CustomModel Name", CustomModel.Spec.ModelName, "Ollama URL", ollamaUrl)
logger.Info("CustomModel does not exist, creating CustomModel", "CustomModel Name", CustomModel.Spec.ModelName, "Ollama URL", ollamaUrl, "ModelFile", CustomModel.Spec.ModelFile)
stream := false
_, err = ollamaClient.PostApiCreate(ctx, ollama_client.PostApiCreateJSONRequestBody{
Name: &CustomModel.Spec.ModelName,
Expand Down
1 change: 1 addition & 0 deletions internal/controller/model_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func (r *ModelReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl
res, err := ollamaClient.PostApiShowWithResponse(ctx, ollama_client.PostApiShowJSONRequestBody{
Name: &model.Spec.ModelName,
})
logger.Info("Checking if Model exists", "Model Name", model.Spec.ModelName, "Ollama URL", ollamaUrl, "status", res.Status())
if err == nil && res.Status() == "200" {
logger.Info("Model exists", "Model Name", model.Spec.ModelName, "Ollama URL", ollamaUrl)
if res.JSON200 != nil {
Expand Down

0 comments on commit ce5ec66

Please sign in to comment.