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: do not trigger reconcile on DSC if no instance in the cluster #1323

Draft
wants to merge 1 commit into
base: incubation
Choose a base branch
from

Conversation

zdtsw
Copy link
Member

@zdtsw zdtsw commented Oct 29, 2024

Description

  • uninstall is handled by configMapPredicates: CM for is created or updated in operator namespace
  • remove check in watchDataScienceClusterResources for CM in operator namespace and with label : defer to configMapPredicates and HasDeleteConfigMap
  • remove zero DSC object case to trigger reconcile by dummy getRquestName

How Has This Been Tested?

local build: quay.io/wenzhou/opendatahub-operator:2.16.1029-2

  • install operator
  • create CM without DSCI or DSC
  • things should work
  • add annoation on CM but set to false
  • things should work
  • update annotation on CM but set to true
  • opreator into reconcile and deleted everything, pod gone etc
  • install opreator again
  • create DSCI and DSC repeat above test, same result

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 Oct 29, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link

openshift-ci bot commented Oct 29, 2024

[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 zdtsw. For more information see the Kubernetes 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

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

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

Please upload report for BASE (incubation@8ea9ea0). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...atasciencecluster/datasciencecluster_controller.go 0.00% 11 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             incubation    #1323   +/-   ##
=============================================
  Coverage              ?   19.10%           
=============================================
  Files                 ?       30           
  Lines                 ?     3365           
  Branches              ?        0           
=============================================
  Hits                  ?      643           
  Misses                ?     2653           
  Partials              ?       69           

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

@zdtsw zdtsw marked this pull request as ready for review October 29, 2024 15:11
@zdtsw zdtsw requested review from lburgazzoli and removed request for ykaliuta October 29, 2024 15:13
@zdtsw zdtsw mentioned this pull request Oct 29, 2024
5 tasks
@@ -384,8 +384,29 @@ var configMapPredicates = predicate.Funcs{
if e.ObjectNew.GetName() == "inferenceservice-config" && (namespace == "redhat-ods-applications" || namespace == "opendatahub") { //nolint:goconst
return false
}
// Trigger reconcile function when uninstall configmap has this label
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems to be unrelated right ?

Copy link
Member Author

Choose a reason for hiding this comment

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

i have a feeling.......... this is not the code on my local branch :D
let me push it and see what the changes :D

return true
},
CreateFunc: func(e event.CreateEvent) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems to be unrelated right ?

Copy link
Member Author

Choose a reason for hiding this comment

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

i think the main reason to add this new one UninstallconfigMapPredicates is to keep uninstallation with configmap still working if we remove the 0 dsc instance switch-case.

or i misundertsand this comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not very sure how this is expected to work to be honest as now the watch is configured like:

Watches(
    &corev1.ConfigMap{},
    &handler.EnqueueRequestForObject{},
    builder.WithPredicates(UninstallconfigMapPredicates),

Which in my understanding means:

  1. EnqueueRequestForObject would create a request containing the Name and Namespace of the object that is the source of the event, so the config map, which does not map to a DSC
  2. UninstallconfigMapPredicates would only validate that source of the event is a ConfigMap in the same namespace as the operator, effectively discarding any other event on any other deployed ConfigMap.

So I'm not sure if this is the intended behavior.

Copy link
Member Author

Choose a reason for hiding this comment

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

what i was thinking:

1.Owns(&corev1.ConfigMap{})is for all the configmap that created by Operator
2. Watches(&corev1.ConfigMap{},....) is for the ones that user created by themself.

when user create a new CM in operator namespace with expected label, or they add expected label to CM. => to trigger DSC reconcile=> into if upgrade.HasDeleteConfigMap(ctx, r.Client) {...}

Copy link
Contributor

Choose a reason for hiding this comment

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

mh, yep but still the enqueue function is not right, it should always map to a DSC

Copy link
Contributor

Choose a reason for hiding this comment

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

what i was thinking:

1.Owns(&corev1.ConfigMap{})is for all the configmap that created by Operator 2. Watches(&corev1.ConfigMap{},....) is for the ones that user created by themself.

when user create a new CM in operator namespace with expected label, or they add expected label to CM. => to trigger DSC reconcile=> into if upgrade.HasDeleteConfigMap(ctx, r.Client) {...}

Since Owns is a special kind of Watches and the result anyway is just triggering of the same Reconcile should it be one Watch?

@zdtsw zdtsw force-pushed the chore_135 branch 2 times, most recently from 42914a4 to b4825c8 Compare October 31, 2024 17:12
- remove check on zeor DSC instance to not continue recontile with dummy name
- uninstall is handled by UninstallconfigMapPredicates:when no DSC but CM for uninstall is created or updated

Signed-off-by: Wen Zhou <[email protected]>
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.

3 participants