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

Remove unused code for devspace endpoints #476

Merged

Conversation

baijum
Copy link
Contributor

@baijum baijum commented Oct 4, 2023

Ref. https://issues.redhat.com/browse/SANDBOX-345

Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
@openshift-ci
Copy link

openshift-ci bot commented Oct 4, 2023

Hi @baijum. Thanks for your PR.

I'm waiting for a codeready-toolchain member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@baijum baijum marked this pull request as ready for review October 4, 2023 11:47
@mfrancisc
Copy link
Contributor

/ok-to-test

Copy link
Contributor

@alexeykazakov alexeykazakov left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!
@rajivnathan could you please take a look?

@openshift-ci openshift-ci bot added the approved label Oct 4, 2023
@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Merging #476 (2b427c4) into master (70d1c48) will increase coverage by 0.26%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #476      +/-   ##
==========================================
+ Coverage   82.02%   82.29%   +0.26%     
==========================================
  Files          30       28       -2     
  Lines        3444     3101     -343     
==========================================
- Hits         2825     2552     -273     
+ Misses        474      419      -55     
+ Partials      145      130      -15     
Files Coverage Δ
...ontrollers/memberstatus/memberstatus_controller.go 94.27% <ø> (-2.35%) ⬇️
controllers/useraccount/useraccount_controller.go 83.08% <100.00%> (-1.40%) ⬇️

(based on golangci-lint error report)
@baijum
Copy link
Contributor Author

baijum commented Oct 5, 2023

/test e2e

1 similar comment
@baijum
Copy link
Contributor Author

baijum commented Oct 5, 2023

/test e2e

@MatousJobanek
Copy link
Contributor

/retest
infra

Copy link
Contributor

@MatousJobanek MatousJobanek left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your first contribution @baijum 🙏

@rajivnathan can correct me if I'm wrong but we can drop the entire pkg/che package.

together with that, we can also drop the MemberConfig fields that were there only for this purpose from https://github.com/codeready-toolchain/api/blob/master/api/v1alpha1/memberoperatorconfig_types.go#L77-L101 - this can be done as separate PRs though ;-)

EDIT: I updated the description of the story with additional information

Comment on lines 673 to 678
return nil
}

if config.Che().IsDevSpacesMode() {
return r.deleteDevSpacesUser(logger, userAcc)
}

userExists, err := r.CheClient.UserExists(userAcc.Name)
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

We should drop the whole lookupAndDeleteCheUser function, not only the subsections of it.
When you look at the PR that is linked from the story https://github.com/codeready-toolchain/sandbox-sre/pull/1046 it sets

          userDeletionEnabled: false

which means that the none of these methods are executed anymore. The parameter is checked at the very beginning and when it's false, then it immediately returns from the method

func (r *Reconciler) lookupAndDeleteCheUser(logger logr.Logger, config membercfg.Configuration, userAcc *toolchainv1alpha1.UserAccount) error {
// If Che user deletion is not required then just return, this is a way to disable this Che user deletion logic since
// it's meant to be a temporary measure until Che is updated to handle user deletion on its own
if !config.Che().IsUserDeletionEnabled() {
logger.Info("Che user deletion is not enabled, skipping it")
return nil
}

baijum added 2 commits October 9, 2023 16:44
Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
@MatousJobanek
Copy link
Contributor

/ok-to-test

Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
@baijum
Copy link
Contributor Author

baijum commented Oct 9, 2023

/test e2e

Copy link
Contributor

@rajivnathan rajivnathan left a comment

Choose a reason for hiding this comment

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

Nice work!

I guess that the following can be removed as well:

controllers/useraccount/useraccount_controller_test.go

  • cheRoute func
  • keycloackRoute func
  • testRoute func
  • newSecretWithCheAdminCreds func

Copy link
Contributor

@rajivnathan rajivnathan left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for addressing the comments

rajivnathan and others added 2 commits October 11, 2023 20:21
@MatousJobanek
Copy link
Contributor

/ok-to-test

Copy link
Contributor

@MatousJobanek MatousJobanek left a comment

Choose a reason for hiding this comment

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

Hey, I'm so happy that we are getting rid of this legacy thing.
It's crazy how huge it became during the time.
Thanks a lot for taking care of it @baijum 👍 🥇

@@ -424,14 +422,7 @@ func TestReconcile(t *testing.T) {
// given

// when the member operator secret exists and has a che admin user configured then che user deletion is enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// when the member operator secret exists and has a che admin user configured then che user deletion is enabled
// when

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. 795fc70

Comment on lines 708 to 710
// given

// when the member operator secret exists and has a che admin user configured then che user deletion is enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

you could remove this whole test

t.Run("delete che user fails because find che user request failed", func(t *testing.T) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. 795fc70

Comment on lines 1747 to 1749
func gockTokenSuccess(calls *int) {
gock.New(testKeycloakURL).
Post("auth/realms/codeready/protocol/openid-connect/token").
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess that we can delete this gock mock and also the other ones in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. 795fc70

@openshift-ci
Copy link

openshift-ci bot commented Oct 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexeykazakov, baijum, MatousJobanek, rajivnathan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [MatousJobanek,alexeykazakov]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
35.9% 35.9% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@alexeykazakov
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Oct 13, 2023
@MatousJobanek MatousJobanek merged commit 94559a0 into codeready-toolchain:master Oct 13, 2023
9 of 11 checks passed
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.

5 participants