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

add enablement flag for nim #1330

Open
wants to merge 23 commits into
base: incubation
Choose a base branch
from

Conversation

trujillm
Copy link

@trujillm trujillm commented Oct 31, 2024

Description

Adding NIM flag under Kserve component in ODH

https://issues.redhat.com/browse/NVPE-23

How Has This Been Tested?

The flag will do nothing until the triggers is handled from the odh-model-controller
This first requires the enablement to be present at which point we can test the trigger from the odh-model-controller

  • You have read the contributors guide.
  • Commit messages are meaningful - have a clear and concise summary and detailed explanation of what was changed and why.
  • Pull Request contains a description of the solution, a link to the JIRA issue, and to any dependent or related Pull Request.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Copy link

openshift-ci bot commented Oct 31, 2024

Hi @trujillm. Thanks for your PR.

I'm waiting for a opendatahub-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Contributor

This PR can't be merged just yet 😢

Please run make generate manifests api-docs and commit the changes.

For more info: https://github.com/opendatahub-io/opendatahub-operator/actions/runs/11610782036

Copy link
Contributor

This PR can't be merged just yet 😢

Please run make generate manifests api-docs and commit the changes.

For more info: https://github.com/opendatahub-io/opendatahub-operator/actions/runs/11610862112

components/kserve/kserve.go Outdated Show resolved Hide resolved
Copy link
Contributor

@etirelli etirelli left a comment

Choose a reason for hiding this comment

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

see my previous comment

@VaishnaviHire
Copy link
Member

/hold

@VaishnaviHire
Copy link
Member

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Ok to Test and removed needs-ok-to-test labels Nov 1, 2024
Copy link

codecov bot commented Nov 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (incubation@87c87ab). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff              @@
##             incubation    #1330   +/-   ##
=============================================
  Coverage              ?   19.08%           
=============================================
  Files                 ?       30           
  Lines                 ?     3369           
  Branches              ?        0           
=============================================
  Hits                  ?      643           
  Misses                ?     2657           
  Partials              ?       69           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@openshift-ci openshift-ci bot added the lgtm label Nov 5, 2024
Copy link

openshift-ci bot commented Nov 5, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: etirelli

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Nov 5, 2024
@openshift-ci openshift-ci bot removed the lgtm label Nov 6, 2024
Copy link

openshift-ci bot commented Nov 6, 2024

New changes are detected. LGTM label has been removed.

@zdtsw
Copy link
Member

zdtsw commented Nov 7, 2024

also by having this opendatahub-io/odh-model-controller#281 already in odh-model-controller , do we need to add rbac on it?

@mpaulgreen
Copy link

@israel-hdez @lburgazzoli After AM slack chat, we recognized that this configuration switches needs to be tested with odh-model-controller to come with a settled design. @trujillm has started with that. Lets await his testing with both options we have.

func getNimManagementFlag(obj metav1.Object) string {
removed := string(operatorv1.Removed)
un, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj)
if err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

it is usually a good practice in golang to keep the happy path on the left, so

if err != nil {
    return removed
}
...

This holds true also for the if/else below

Copy link
Author

Choose a reason for hiding this comment

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

@lburgazzoli.... updated ✅

@@ -131,6 +132,12 @@ func (k *Kserve) ReconcileComponent(ctx context.Context, cli client.Client,
return err
}
}
extraParamsMap := map[string]string{
"nim-state": string(k.NIM.ManagementState),
Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that here we are updating the params.env only in the KServe is Managed, if not, the value in the params.env is untouched. However in the ModelMesh component reconciliation, the params.env value is updated regardless of the status of the KServe component.

It is probably not an issue but wonder if the behavior should be made consistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

The assumption is that NIM depends on Kserve. If Kserve is not managed, NIM shouldn't be either. If Kserve is not managed, is the Kserve component's reconciler running? How would you suggest making the behaviour consistent?

Copy link
Contributor

@lburgazzoli lburgazzoli Nov 25, 2024

Choose a reason for hiding this comment

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

There is a single reconciler for all the components, when one component is marked as Removed, the specific component reconcile is invoked and it deletes the related resources. In this case it would leave the nim-state as it was defined previously, which I don't think it would be a problem, since KServe would be set as Removed.

In the ModelMesh however, the nim-state is updated regardless of the fact that the ModelMesh is set to Managed or Removed, see https://github.com/opendatahub-io/opendatahub-operator/pull/1330/files#diff-be28ef017be36951371e5f700cafcdad5925b03de9ae41d754825781f213aa78R131-R137.

So for my POV, it should not be a problem, just want to double check.

Copy link
Contributor

Choose a reason for hiding this comment

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

So if the Kserve's component has some cleanup logic in place, can we use it to set nim-state to removed if kserve is removed? That way, we can make both behaviours consistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. it is the same ReconcileComponent metho, there is a check enabled := k.GetManagementState() == operatorv1.Managed

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the ConfigMap being deleted when Kserve's component is removed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it is, so yes, it is not an issue, my point was mainly about consistency in the code.
But I'm fine to leave it as it is.

@trujillm
Copy link
Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

10 participants