-
Notifications
You must be signed in to change notification settings - Fork 88
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
chore: controller refactoring #963
Conversation
/retest |
/retest |
/test v7-devworkspace-happy-path |
74b28a6
to
45920a4
Compare
/retest |
Codecov Report
@@ Coverage Diff @@
## main #963 +/- ##
==========================================
+ Coverage 50.02% 50.86% +0.83%
==========================================
Files 56 56
Lines 6806 6800 -6
==========================================
+ Hits 3405 3459 +54
+ Misses 3036 2990 -46
+ Partials 365 351 -14
Continue to review full report at Codecov.
|
// Check Che CR correctness | ||
func validateCheClusterCR(deployContext *deploy.DeployContext) (*ctrl.Result, error) { | ||
if !util.IsTestMode() { | ||
if err := ValidateCheCR(deployContext.CheCluster); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use this function instead of the wrapper?
return nil, nil | ||
} | ||
|
||
func doneToResult(done bool, forceRequeueIfNotDone bool, err error) (*ctrl.Result, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this method?
Please consider alternatives:
- Detect reconcile status based on
done
anderror
as, for example, here - Return
ctrl.Result
in place
} | ||
|
||
if forceRequeueIfNotDone { | ||
return &ctrl.Result{RequeueAfter: time.Second}, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctrl
usually stands for control
, but here you probably meant controller
. Please change the short name.
return &ctrl.Result{}, err | ||
} | ||
|
||
func errToResult(err error) (*ctrl.Result, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as above
@@ -42,19 +42,19 @@ type ImageAndName struct { | |||
|
|||
// Reconcile the imagePuller section of the CheCluster CR. If imagePuller.enable is set to true, install the Kubernetes Image Puller operator and create | |||
// a KubernetesImagePuller CR. Add a finalizer to the CheCluster CR. If false, remove the KubernetesImagePuller CR, uninstall the operator, and remove the finalizer. | |||
func ReconcileImagePuller(ctx *DeployContext) (reconcile.Result, error) { | |||
func ReconcileImagePuller(ctx *DeployContext) (*reconcile.Result, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have to change to pointer for reconcile.Result
? In main controller object is passed directly. Moreover it will cause a lot of edit below.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: AndrienkoAleksandr, tolusha 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 |
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
New changes are detected. LGTM label has been removed. |
@tolusha: PR needs rebase. 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/test-infra repository. |
@tolusha: The following tests failed, say
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/test-infra repository. I understand the commands that are listed here. |
Signed-off-by: Anatolii Bazko abazko@redhat.com
What does this PR do?
Refactor checluster controller to easier update its status.
Screenshot/screencast of this PR
N/A
What issues does this PR fix or reference?
eclipse-che/che#19978
How to test this PR?
N/A
PR Checklist
As the author of this Pull Request I made sure that:
What issues does this PR fix or reference
andHow to test this PR
completedReviewers
Reviewers, please comment how you tested the PR when approving it.