Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Ensure odh-model-controller Deployment Waits for ConfigMap #361

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"crypto/tls"
"flag"
"os"
"slices"
"strconv"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
Expand Down Expand Up @@ -305,7 +304,10 @@ func setupNim(mgr manager.Manager, signalHandlerCtx context.Context, kubeClient
var err error

nimState := os.Getenv("NIM_STATE")
if !slices.Contains([]string{"removed", ""}, nimState) {
if nimState == "" {
nimState = "managed"
}
if nimState != "removed" {
trujillm marked this conversation as resolved.
Show resolved Hide resolved
if err = (&nim.AccountReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Expand Down
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ spec:
configMapKeyRef:
name: odh-model-controller-parameters
key: nim-state
optional: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we keep it as optional?
I mean, the os.GetEnv is ok if the env is not set( with the suggested change), however, if for some reason it is not set in during the startup, it would prevent odh to start.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spolti I believe the intent is to block the deployment until the configmap is ready which I believe is the expected behavior for having the optional value defaulted to false

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spolti

shouldn't we keep it as optional?
I mean, the os.GetEnv is ok if the env is not set( with the suggested change)

We have two different default behaviours, for IBM the default is "removed", and for everyone else, it's "managed". So we need the ConfigMap to be configured properly by the operator-controller and we cannot decide a default value without the ConfigMap.

however, if for some reason it is not set in during the startup, it would prevent odh to start.

Is this feasible? Both the Deployment and the ConfigMap are created by the same kustomization file. The ConfigMap is used and probably required by other parts too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for IBM the default is "removed",

How is this achieved?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomerFi I understand why you choose removed for the condition. I am ok with it.
However, I have a question about the IBM case. How can you set the default value removed?
The configmap manifests will be reside in RHOAI operator so it can not be editable after release.

Copy link
Contributor

@TomerFi TomerFi Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagin the pipelins running for IBM set the DataScienceCluster.spec.kserve.nim.managedState to "removed", this gets translated into the params.env before executing the kustomization file that creates both the ConfigMap and the Deployment.

Copy link
Contributor

@Jooho Jooho Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if Opendatahub operator have the logic, it makes sense then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading back my comment, I think I was unclear. When I wrote: We have two different default behaviours, of course, we don't actually have two defaults, sorry about that. My point was, we can't decide what default value to use, hence we must rely on the ConfigMap that always has the correct value for us.

optional: false
livenessProbe:
httpGet:
path: /healthz
Expand Down