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

chore: controller refactoring #963

Closed
wants to merge 5 commits into from
Closed

chore: controller refactoring #963

wants to merge 5 commits into from

Conversation

tolusha
Copy link
Contributor

@tolusha tolusha commented Jul 22, 2021

@tolusha
Copy link
Contributor Author

tolusha commented Jul 22, 2021

/retest

@tolusha
Copy link
Contributor Author

tolusha commented Jul 23, 2021

/retest

@tolusha
Copy link
Contributor Author

tolusha commented Jul 23, 2021

/test v7-devworkspace-happy-path

@tolusha tolusha force-pushed the 19978 branch 2 times, most recently from 74b28a6 to 45920a4 Compare July 28, 2021 14:27
@tolusha
Copy link
Contributor Author

tolusha commented Jul 29, 2021

/retest

@codecov
Copy link

codecov bot commented Jul 29, 2021

Codecov Report

Merging #963 (2f9b708) into main (a3abf33) will increase coverage by 0.83%.
The diff coverage is 38.56%.

❗ Current head 2f9b708 differs from pull request most recent head 0cd3dd1. Consider uploading reports for the commit 0cd3dd1 to get more accurate results
Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
pkg/deploy/identity-provider/identity_provider.go 10.57% <0.00%> (-0.06%) ⬇️
pkg/deploy/kubernetes_image_puller.go 0.00% <0.00%> (ø)
pkg/deploy/tls.go 12.33% <0.00%> (ø)
controllers/che/checluster_controller.go 31.05% <45.73%> (+11.41%) ⬆️
controllers/che/gateway_permission.go 21.62% <50.00%> (ø)
controllers/che/proxy.go 61.11% <50.00%> (ø)
controllers/che/workspace_namespace_permission.go 69.94% <57.14%> (ø)
controllers/che/create.go 45.03% <100.00%> (ø)
pkg/deploy/server/server_configmap.go 85.50% <0.00%> (-0.22%) ⬇️

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 a3abf33...0cd3dd1. Read the comment docs.

// Check Che CR correctness
func validateCheClusterCR(deployContext *deploy.DeployContext) (*ctrl.Result, error) {
if !util.IsTestMode() {
if err := ValidateCheCR(deployContext.CheCluster); 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.

Can we use this function instead of the wrapper?

return nil, nil
}

func doneToResult(done bool, forceRequeueIfNotDone bool, err error) (*ctrl.Result, error) {
Copy link
Contributor

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 and error as, for example, here
  • Return ctrl.Result in place

}

if forceRequeueIfNotDone {
return &ctrl.Result{RequeueAfter: time.Second}, err
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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.

@openshift-ci
Copy link

openshift-ci bot commented Aug 3, 2021

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the lgtm label Aug 3, 2021
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>
@openshift-ci
Copy link

openshift-ci bot commented Aug 4, 2021

New changes are detected. LGTM label has been removed.

@openshift-ci
Copy link

openshift-ci bot commented Aug 8, 2021

@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.

@openshift-ci
Copy link

openshift-ci bot commented Dec 17, 2021

@tolusha: The following tests 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-stable-to-nightly 0cd3dd1 link /test v7-stable-to-nightly
ci/prow/v7-devworkspace-happy-path 0cd3dd1 link /test v7-devworkspace-happy-path
ci/prow/v8-e2e-all-namespaces-deployment 0cd3dd1 link true /test v8-e2e-all-namespaces-deployment
ci/prow/v7-e2e-all-namespaces-deployment 0cd3dd1 link true /test v7-e2e-all-namespaces-deployment
ci/prow/v9-single-host-nightly-deployment 0cd3dd1 link true /test v9-single-host-nightly-deployment
ci/prow/v9-multi-host-next-deployment 0cd3dd1 link true /test v9-multi-host-next-deployment
ci/prow/v9-devworkspace-happy-path 0cd3dd1 link true /test v9-devworkspace-happy-path
ci/prow/v9-stable-to-nightly 0cd3dd1 link true /test v9-stable-to-nightly
ci/prow/v9-images 0cd3dd1 link true /test v9-images
ci/prow/v9-ci-index 0cd3dd1 link true /test v9-ci-index
ci/prow/v9-upgrade-stable-to-next 0cd3dd1 link true /test v9-upgrade-stable-to-next
ci/prow/v9-operator-test 0cd3dd1 link true /test v9-operator-test
ci/prow/v8-operator-test 0cd3dd1 link true /test v8-operator-test

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 closed this Dec 17, 2021
@tolusha tolusha deleted the 19978 branch December 17, 2021 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants