From ce5ec668f2ea6e0081106ddaf2f964e85d40f596 Mon Sep 17 00:00:00 2001 From: Apoorva Appadoo Srinivas Date: Sun, 20 Oct 2024 19:01:31 +0200 Subject: [PATCH] feat: add custom model support --- config/manager/manager.yaml | 2 +- internal/controller/custommodel_controller.go | 2 +- internal/controller/model_controller.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 4d5b68d..36659bd 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -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 diff --git a/internal/controller/custommodel_controller.go b/internal/controller/custommodel_controller.go index 9aa43c3..30545e3 100644 --- a/internal/controller/custommodel_controller.go +++ b/internal/controller/custommodel_controller.go @@ -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, diff --git a/internal/controller/model_controller.go b/internal/controller/model_controller.go index d1e0555..849eea1 100644 --- a/internal/controller/model_controller.go +++ b/internal/controller/model_controller.go @@ -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 {