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 Dec 2, 2024
1 parent aee3e05 commit f8c02d4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/base/params.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ caikit-standalone-image=quay.io/opendatahub/caikit-nlp:fast
tgis-image=quay.io/opendatahub/text-generation-inference:fast
ovms-image=quay.io/opendatahub/openvino_model_server:2024.3-release
vllm-image=quay.io/opendatahub/vllm:fast

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: 12 additions & 7 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"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -242,13 +243,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).
Expand Down

0 comments on commit f8c02d4

Please sign in to comment.