Skip to content

Commit

Permalink
Add NIM flag logic
Browse files Browse the repository at this point in the history
  • Loading branch information
trujillm committed Nov 26, 2024
1 parent 516e192 commit 6d6274a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions config/base/params.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ caikit-standalone-image=quay.io/opendatahub/caikit-nlp:stable-994ec60
tgis-image=quay.io/opendatahub/text-generation-inference:stable-eba83ba
ovms-image=quay.io/opendatahub/openvino_model_server:2024.3-release-4c8c52c
vllm-image=quay.io/opendatahub/vllm:stable-849f0f5
nim-state=removed
6 changes: 6 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ spec:
name: service-mesh-refs
key: MESH_NAMESPACE
optional: true
- name: NIM_STATE
valueFrom:
configMapKeyRef:
name: odh-model-controller-parameters
key: nim-state
optional: true
livenessProbe:
httpGet:
path: /healthz
Expand Down
19 changes: 11 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"flag"
"os"
"slices"
"strconv"

"github.com/opendatahub-io/odh-model-controller/controllers/webhook"
Expand Down Expand Up @@ -233,15 +234,17 @@ func main() {
}

ctx := ctrl.SetupSignalHandler()
if err = (&controllers.NimAccountReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("NimAccountReconciler"),
KClient: kclient,
}).SetupWithManager(mgr, ctx); err != nil {
setupLog.Error(err, "unable to create controller NIM Account controller")
os.Exit(1)
nimState := os.Getenv("NIM_STATE")
if !slices.Contains([]string{"removed", ""}, nimState) {
if err = (&controllers.NimAccountReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("NimAccountReconciler"),
KClient: kclient,
}).SetupWithManager(mgr, ctx); err != nil {
setupLog.Error(err, "unable to create controller NIM Account controller")
os.Exit(1)
}
}

if err = builder.WebhookManagedBy(mgr).
For(&nimv1.Account{}).
WithValidator(webhook.NewNimAccountValidator(mgr.GetClient())).
Expand Down

0 comments on commit 6d6274a

Please sign in to comment.