-
Notifications
You must be signed in to change notification settings - Fork 34
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
drop CRTClient abstraction #473
drop CRTClient abstraction #473
Conversation
func NewMemberClusterServiceContext(_ *testing.T, cl client.Client) fake.MemberClusterServiceContext { | ||
return fake.MemberClusterServiceContext{ | ||
CrtClient: crtClient, | ||
Svcs: application, | ||
NamespacedClient: namespaced.NewClient(cl, commontest.HostOperatorNs), | ||
Svcs: server.NewInClusterApplication(cl, commontest.HostOperatorNs), | ||
} | ||
} |
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.
This will go away in one of the following PRs. Just wanted to minimize the number of changes so I left it here for now.
labelSelector := client.MatchingLabels{ | ||
toolchainv1alpha1.UserSignupStateLabelKey: toolchainv1alpha1.UserSignupStateLabelValueApproved, | ||
toolchainv1alpha1.BannedUserPhoneNumberHashLabelKey: labelValue, | ||
} | ||
userSignups := &toolchainv1alpha1.UserSignupList{} | ||
if err := s.List(gocontext.TODO(), userSignups, client.InNamespace(s.Namespace), labelSelector); 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.
Originally, we listed UserSignups that were NOT deactivated
nor not-ready
.
see:
registration-service/pkg/kubeclient/signup.go
Lines 83 to 87 in 6d3e720
selector := labels.NewSelector() | |
stateRequirement, err := labels.NewRequirement(crtapi.UserSignupStateLabelKey, selection.NotIn, []string{crtapi.UserSignupStateLabelValueDeactivated, crtapi.UserSignupStateLabelValueNotReady}) | |
if err != nil { | |
return nil, err | |
} |
This means usersignups that were either
approved
or banned
. Banned user are already covered by the BannedUser CRs, so I decided to simplify the logic and list only the approved
ones.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #473 +/- ##
==========================================
+ Coverage 82.47% 85.43% +2.96%
==========================================
Files 42 33 -9
Lines 2687 2541 -146
==========================================
- Hits 2216 2171 -45
+ Misses 385 283 -102
- Partials 86 87 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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 👍
I have only few minor comments.
pkg/signup/service/signup_service.go
Outdated
if signup.Spec.IdentityClaims.Sub != userID && signup.Spec.IdentityClaims.PreferredUsername != username && !states.Deactivated(signup) { // nolint:gosec | ||
|
||
for _, signup := range userSignups.Items { | ||
userSignup := signup |
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.
is it needed? IIRC, signup
is not a pointer
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.
no, it's not a pointer, but I create a pointer to the userSignup
in the next line and since we still use go 1.20 we have to do this re-assignment
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.
added a comment 8df7f52
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.
great, thanks!
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 for taking my comment into account, @MatousJobanek !
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alexeykazakov, MatousJobanek, mfrancisc, xcoulon 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 |
Quality Gate passedIssues Measures |
c11f3a8
into
codeready-toolchain:master
namespaced.Client
which holds theClient
itself plus the host operator namespace. With this type it's much easier to propagate the Client and the namespace in the services.KUBESAW-197