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

(feat): Add migration logic for odhdashboardconfig #1709

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

AjayJagan
Copy link
Contributor

Signed-off-by: AjayJagan ajaganat@redhat.com

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED

Description

The dashboard team has asked for a temporary fix which is to patch the odhdashboardconfig CR if it doesnot have an entry of notebookSizes or modelServerSizes.

JIRA: https://issues.redhat.com/browse/RHOAIENG-19058

Note that these changes will be removed once dashboard fixes it on their side.

jira to track removal: https://issues.redhat.com/browse/RHOAIENG-21080

How Has This Been Tested?

  • Install the operator with the changes in a cluster
  • Create DSCI
  • Create DSC with dashboard pointing to different manifests if required(to test different combinations) using dev flags
  • See the modelServerSizes and notebookSizes getting added if they are missed or if the array is empty

Screenshot or short clip

Merge criteria

  • 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 Mar 5, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from ajayjagan. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@AjayJagan AjayJagan force-pushed the dashboard-migration-script branch from 704bbb2 to 28077d3 Compare March 5, 2025 15:29
@AjayJagan AjayJagan force-pushed the dashboard-migration-script branch from 28077d3 to 93f7ae4 Compare March 5, 2025 15:33
Signed-off-by: AjayJagan <ajaganat@redhat.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@AjayJagan AjayJagan force-pushed the dashboard-migration-script branch from 93f7ae4 to 7c3be1d Compare March 5, 2025 15:55
@AjayJagan AjayJagan force-pushed the dashboard-migration-script branch from e84b51b to f10e296 Compare March 6, 2025 01:58
@AjayJagan
Copy link
Contributor Author

/test opendatahub-operator-e2e

Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 0% with 151 lines in your changes missing coverage. Please review.

Project coverage is 23.37%. Comparing base (3fb2d67) to head (18b3133).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pkg/upgrade/upgrade.go 0.00% 151 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1709      +/-   ##
==========================================
- Coverage   23.68%   23.37%   -0.31%     
==========================================
  Files         169      169              
  Lines       11625    11776     +151     
==========================================
  Hits         2753     2753              
- Misses       8598     8749     +151     
  Partials      274      274              

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@AjayJagan AjayJagan force-pushed the dashboard-migration-script branch from f10e296 to 18b3133 Compare March 6, 2025 07:23
@AjayJagan AjayJagan requested a review from lburgazzoli March 6, 2025 10:19
@@ -615,3 +615,179 @@ func cleanupModelControllerLegacyDeployment(ctx context.Context, cli client.Clie

return nil
}

// TODO: to be removed: https://issues.redhat.com/browse/RHOAIENG-21080
func PatchOdhDashboardConfig(ctx context.Context, cli client.Client) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably this function should also check the current and previous version to determine if the patch should be applied ? something like https://github.com/opendatahub-io/opendatahub-operator/blob/main/pkg/upgrade/upgrade.go#L503

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep it can be done, although I may need some guidance on which versions should be patched
@Gkrumbach07 ^

}

for _, cr := range dashboardConfigs.Items {
if !cluster.IsNotReservedNamespace(&corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: cr.GetNamespace()}}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this required ? my understanding is that there is only one OdhDashboardConfig per cluster so I thinnk it should be patched, regardless of the namespace ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have changed the logic to handle the singleton case

log.Info("Found CR, applying patch", "namespace", cr.GetNamespace(), "name", cr.GetName())

patch := cr.DeepCopy()
updates := map[string][]any{
Copy link
Contributor

@lburgazzoli lburgazzoli Mar 9, 2025

Choose a reason for hiding this comment

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

nip: since the updates map is always the same, can't this be just a var ? not sure I see the benefits of having the values returned by functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

var would do fine 😄

Signed-off-by: AjayJagan <ajaganat@redhat.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@AjayJagan AjayJagan force-pushed the dashboard-migration-script branch from 10274b4 to b0ea636 Compare March 10, 2025 07:12
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
Copy link

openshift-ci bot commented Mar 10, 2025

@AjayJagan: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/opendatahub-operator-e2e c0978c2 link true /test opendatahub-operator-e2e

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants