-
Notifications
You must be signed in to change notification settings - Fork 22
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
Update common libraries to use PropagatedClaims #345
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a150a74
update MatchMasterUserRecord to only use propagated claims
sbryzak 3155429
useraccount annotations don't need to be non nil
sbryzak 2714a65
use correct UserID
sbryzak dee3e5b
don't set UserID on spec
sbryzak 5a1f321
don't populate UserID or email annotation
sbryzak ad9dada
don't set email annotation
sbryzak e4a15ba
remove redundant check
sbryzak 3a9a032
use standard values
sbryzak 6145201
Merge remote-tracking branch 'origin/master' into SANDBOX-482
sbryzak 3ad596e
review
sbryzak 3378b6b
Merge remote-tracking branch 'origin/master' into SANDBOX-482
sbryzak 8b31f7c
updated missed reference
sbryzak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ import ( | |
toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1" | ||
"github.com/codeready-toolchain/toolchain-common/pkg/condition" | ||
"github.com/codeready-toolchain/toolchain-common/pkg/test" | ||
"github.com/gofrs/uuid" | ||
"github.com/redhat-cop/operator-utils/pkg/util" | ||
"github.com/stretchr/testify/require" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
@@ -42,22 +41,18 @@ func NewMasterUserRecords(t *testing.T, size int, nameFmt string, modifiers ...M | |
} | ||
|
||
func NewMasterUserRecord(t *testing.T, userName string, modifiers ...MurModifier) *toolchainv1alpha1.MasterUserRecord { | ||
userID := uuid.Must(uuid.NewV4()).String() | ||
mur := &toolchainv1alpha1.MasterUserRecord{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Namespace: test.HostOperatorNs, | ||
Name: userName, | ||
Labels: map[string]string{}, | ||
Annotations: map[string]string{ | ||
toolchainv1alpha1.MasterUserRecordEmailAnnotationKey: "[email protected]", | ||
}, | ||
Namespace: test.HostOperatorNs, | ||
Name: userName, | ||
Labels: map[string]string{}, | ||
Annotations: map[string]string{}, | ||
}, | ||
Spec: toolchainv1alpha1.MasterUserRecordSpec{ | ||
TierName: "deactivate30", | ||
UserID: userID, | ||
UserAccounts: []toolchainv1alpha1.UserAccountEmbedded{newEmbeddedUa(test.MemberClusterName)}, | ||
PropagatedClaims: toolchainv1alpha1.PropagatedClaims{ | ||
Sub: "44332211", | ||
Sub: "UserID123", | ||
UserID: "135246", | ||
AccountID: "357468", | ||
OriginalSub: "11223344", | ||
|
@@ -93,7 +88,14 @@ func ModifyUaInMur(mur *toolchainv1alpha1.MasterUserRecord, targetCluster string | |
|
||
func UserID(userID string) MurModifier { | ||
return func(mur *toolchainv1alpha1.MasterUserRecord) error { | ||
mur.Spec.UserID = userID | ||
mur.Spec.PropagatedClaims.UserID = userID | ||
return nil | ||
} | ||
} | ||
|
||
func Sub(sub string) MurModifier { | ||
return func(mur *toolchainv1alpha1.MasterUserRecord) error { | ||
mur.Spec.PropagatedClaims.Sub = sub | ||
return nil | ||
} | ||
} | ||
|
@@ -208,7 +210,7 @@ func ProvisionedMur(provisionedTime *metav1.Time) MurModifier { | |
// UserIDFromUserSignup creates a MurModifier to change the userID value to match the provided usersignup | ||
func UserIDFromUserSignup(userSignup *toolchainv1alpha1.UserSignup) MurModifier { | ||
return func(mur *toolchainv1alpha1.MasterUserRecord) error { | ||
mur.Spec.UserID = userSignup.Name | ||
mur.Spec.PropagatedClaims.UserID = userSignup.Name | ||
return nil | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
btw, why did you drop this function?
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.
@MatousJobanek
The PR is indeed ready for review. Fields won't be dropped from the CRDs until everything has been refactored to only use the PropagatedClaims.
The cases mentioned in usersignup.go and notification_builder.go are not missed, they are not within the scope of this PR and will be updated when the UserSignupController is refactored (these changes are limited to only the MasterUserRecordController).
I've updated useraccount_test.go to perform an equality check of the entire PropagatedClaims instead.
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.
cool, thanks for the explanation 👍 I was missing the description in the PR - what the PR is changing and what are the next steps.
I don't see any changes in the file. Apart from that, it's still using the UserId from spec
toolchain-common/pkg/test/useraccount/useraccount_test.go
Line 19 in 6145201