Skip to content

Commit

Permalink
Add DevFlag SET_RUNTIMES_CM to enable/diable the feature
Browse files Browse the repository at this point in the history
  • Loading branch information
atheo89 committed Feb 25, 2025
1 parent 407180d commit e48c239
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion components/odh-notebook-controller/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ run: manifests generate fmt vet certificates ktunnel ## Run a controller from yo
go run ./main.go

.PHONY: docker-build
docker-build: ## Build docker image with the manager.
docker-build: test ## Build docker image with the manager.
cd ../ && ${CONTAINER_ENGINE} build . -t ${IMG}:${TAG} -f odh-notebook-controller/Dockerfile

.PHONY: docker-push
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ spec:
env:
- name: SET_PIPELINE_RBAC
value: "false"
- name: SET_RUNTIMES_CM
value: "true"
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,12 @@ func (r *OpenshiftNotebookReconciler) Reconcile(ctx context.Context, req ctrl.Re
return ctrl.Result{}, err
}

err = r.EnsureNotebookConfigMap(notebook, ctx)
if err != nil {
return ctrl.Result{}, err
// Create/Watch and Update the pipeline-runtime-image ConfigMap on Notebook's Namspace
if strings.ToLower(strings.TrimSpace(os.Getenv("SET_RUNTIMES_CM"))) == "true" {
err = r.EnsureNotebookConfigMap(notebook, ctx)
if err != nil {
return ctrl.Result{}, err
}
}

// Call the Rolebinding reconciler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"os"
"sort"
"strings"

Expand Down Expand Up @@ -251,12 +252,13 @@ func (w *NotebookWebhook) Handle(ctx context.Context, req admission.Request) adm
return admission.Errored(http.StatusInternalServerError, err)
}

// Mount ConfigMap pipeline-runtime-images
err = MountPipelineRuntimeImages(notebook, log)
if err != nil {
return admission.Errored(http.StatusInternalServerError, err)
if strings.ToLower(strings.TrimSpace(os.Getenv("SET_RUNTIMES_CM"))) == "true" {
// Mount ConfigMap pipeline-runtime-images as runtime-images
err = MountPipelineRuntimeImages(notebook, log)
if err != nil {
return admission.Errored(http.StatusInternalServerError, err)
}
}

}

// Check Imagestream Info both on create and update operations
Expand Down

0 comments on commit e48c239

Please sign in to comment.