-
Notifications
You must be signed in to change notification settings - Fork 39
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
Remove unused code for devspace endpoints #476
Conversation
Ref. https://issues.redhat.com/browse/SANDBOX-345 Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
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 Once the patch is verified, the new status will be reflected by the 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. |
/ok-to-test |
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.
Looks good. Thanks!
@rajivnathan could you please take a look?
Codecov Report
@@ 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
|
(based on golangci-lint error report)
/test e2e |
1 similar comment
/test e2e |
/retest |
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.
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
return nil | ||
} | ||
|
||
if config.Che().IsDevSpacesMode() { | ||
return r.deleteDevSpacesUser(logger, userAcc) | ||
} | ||
|
||
userExists, err := r.CheClient.UserExists(userAcc.Name) | ||
if err != nil { | ||
return 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.
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
member-operator/controllers/useraccount/useraccount_controller.go
Lines 667 to 674 in 00d55d9
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 | |
} |
Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
/ok-to-test |
Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
/test e2e |
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.
Nice work!
I guess that the following can be removed as well:
controllers/useraccount/useraccount_controller_test.go
cheRoute
funckeycloackRoute
functestRoute
funcnewSecretWithCheAdminCreds
func
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.
Looks good! Thanks for addressing the comments
Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
/ok-to-test |
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.
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 |
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.
// when the member operator secret exists and has a che admin user configured then che user deletion is enabled | |
// when |
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.
Done. 795fc70
// given | ||
|
||
// when the member operator secret exists and has a che admin user configured then che user deletion is enabled |
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.
you could remove this whole test
t.Run("delete che user fails because find che user request failed", func(t *testing.T) {
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.
Done. 795fc70
func gockTokenSuccess(calls *int) { | ||
gock.New(testKeycloakURL). | ||
Post("auth/realms/codeready/protocol/openid-connect/token"). |
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.
I guess that we can delete this gock mock and also the other ones in this file.
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.
Done. 795fc70
[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:
Approvers can indicate their approval by writing |
Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
SonarCloud Quality Gate failed. 0 Bugs No Coverage information Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
/lgtm |
94559a0
into
codeready-toolchain:master
Ref. https://issues.redhat.com/browse/SANDBOX-345