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

checontroller refactoring #1138

Merged
merged 9 commits into from
Oct 19, 2021
Merged

checontroller refactoring #1138

merged 9 commits into from
Oct 19, 2021

Conversation

@codecov
Copy link

codecov bot commented Oct 13, 2021

Codecov Report

Merging #1138 (ca1ae3f) into main (488a5d1) will increase coverage by 2.54%.
The diff coverage is 33.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1138      +/-   ##
==========================================
+ Coverage   54.64%   57.19%   +2.54%     
==========================================
  Files          69       70       +1     
  Lines        8421     8440      +19     
==========================================
+ Hits         4602     4827     +225     
+ Misses       3338     3099     -239     
- Partials      481      514      +33     
Impacted Files Coverage Δ
pkg/deploy/defaults.go 51.96% <ø> (+0.98%) ⬆️
pkg/deploy/syncmanager.go 0.00% <0.00%> (ø)
pkg/deploy/kubernetes_image_puller.go 61.80% <25.00%> (+56.97%) ⬆️
controllers/che/checluster_controller.go 23.21% <43.93%> (+2.30%) ⬆️
controllers/che/create.go 44.29% <100.00%> (ø)
controllers/che/workspace_namespace_permission.go 70.55% <100.00%> (-12.19%) ⬇️
pkg/deploy/test_util.go 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 488a5d1...ca1ae3f. Read the comment docs.

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Copy link
Contributor

@mmorhun mmorhun left a comment

Choose a reason for hiding this comment

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

Please change the way how we register components' reconcilers

}

if !util.IsCheMultiUser(ctx.CheCluster) {
return reconcile.Result{}, false, fmt.Errorf("Single user authentication mode is not supported anymore. To backup your data you can commit workspace configuration to an SCM server and use factories to restore it in multi user mode. To switch to multi user authentication mode set 'spec.server.customCheProperties.CHE_MULTIUSER' to 'true' in %s CheCluster custom resource. Switching to multi user authentication mode without backing up your data will cause data loss.", ctx.CheCluster.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move such long messages into constant of a function if the message should be constructed. I think it will make code easier to read.


// Reconcile all objects in a order they have been added
// If reconciliation failed then CheCluster status will be updated accordingly.
func (rm *ReconcileManager) ReconcileAll(ctx *DeployContext) (reconcile.Result, bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename rm. Maybe just manager?

return reconcile.Result{}, true, nil
}

func (sm *ReconcileManager) FinalizeAll(ctx *DeployContext) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename

pkg/deploy/reconcile_manager.go Show resolved Hide resolved
// Does finalization (removes cluster scope objects, etc)
Finalize(ctx *DeployContext) (done bool, err error)
// Does registration
Register(rm *ReconcileManager)
Copy link
Contributor

Choose a reason for hiding this comment

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

This duplicates RegisterReconciler method of the manager. It is redundant.

Comment on lines 103 to 104
cheClusterValidator := NewCheClusterValidator()
cheClusterValidator.Register(reconcileManager)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not to use reconcileManager.Register(NewCheClusterValidator())?

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Copy link
Contributor

@mmorhun mmorhun left a comment

Choose a reason for hiding this comment

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

Great work!

@openshift-ci openshift-ci bot added the lgtm label Oct 18, 2021
@openshift-ci
Copy link

openshift-ci bot commented Oct 18, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mmorhun, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tolusha
Copy link
Contributor Author

tolusha commented Oct 18, 2021

/retest

@openshift-ci
Copy link

openshift-ci bot commented Oct 18, 2021

@tolusha: 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/v7-devworkspace-happy-path 4e78f88 link true /test v7-devworkspace-happy-path

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.

@tolusha tolusha merged commit f838cf4 into main Oct 19, 2021
@tolusha tolusha deleted the 19284 branch October 19, 2021 07:56
@che-bot che-bot added this to the 7.38 milestone Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants