Repository navigation
Conversation
e4f7201 to
6bd24ef
Compare
mandre
left a comment
There was a problem hiding this comment.
Just a first pass for now, I'll look again after you've moved the update logic into its own reconciler.
b0820fd to
7fb0cc4
Compare
mandre
left a comment
There was a problem hiding this comment.
Looking good, thanks for the quick iteration. Let me know if you want to add the UserIDs in status in a follow-up change or here.
| func (c groupErrorClient) AddUser(ctx context.Context, groupID, userID string) error { | ||
| return c.error | ||
| } | ||
|
|
||
| func (c groupErrorClient) RemoveUser(ctx context.Context, groupID, userID string) error { | ||
| return c.error | ||
| } | ||
|
|
||
| func (c groupErrorClient) ListUsers(ctx context.Context, groupID string) ([]users.User, error) { | ||
| return nil, c.error | ||
| } |
There was a problem hiding this comment.
Just in order to be consistent:
| func (c groupErrorClient) AddUser(ctx context.Context, groupID, userID string) error { | |
| return c.error | |
| } | |
| func (c groupErrorClient) RemoveUser(ctx context.Context, groupID, userID string) error { | |
| return c.error | |
| } | |
| func (c groupErrorClient) ListUsers(ctx context.Context, groupID string) ([]users.User, error) { | |
| return nil, c.error | |
| } | |
| func (e groupErrorClient) AddUser(_ context.Context, _, _ string) error { | |
| return e.error | |
| } | |
| func (e groupErrorClient) RemoveUser(_ context.Context, _, _ string) error { | |
| return e.error | |
| } | |
| func (e groupErrorClient) ListUsers(_ context.Context, _ string) ([]users.User, error) { | |
| return nil, e.error | |
| } |
| commands: | ||
| - script: |- | ||
| export OS_CLOUD=openstack-admin OS_CLIENT_CONFIG_FILE=${E2E_KUTTL_OSCLOUDS} | ||
| result=`openstack group contains user group-create-full-override group-create-full 2>&1` |
There was a problem hiding this comment.
Now that begs the question whether we should add a UserIDs field to the GroupResourceStatus. I think we should, possibly as a follow-up (up to you if you want to tackle it in this PR or later).
This would make for a nice cleanup in all the tests (if you need to shell out to openstack this typically indicates that something is missing in ORC).
There was a problem hiding this comment.
I agree it would be better to have UserIDs in the status. Not just for testing but also for user visibility. I just haven't found a good way to achive this without breaking the existing status update pattern.
One idea I have is reuse the Group.Extra field to carry the user name/ids from reconcileUserRefs to ApplyResourceStatus within osResourceT. I know it is a hack and might not be the best way. What do you think? If there is a better way, I would be happy to hear.
Also I'd like to have the user info in the status like below to be more verbose for user:
status:
resource:
users:
- name: user1
id: 12345
- name: user2
id: 67890There was a problem hiding this comment.
I think you can create a custom osResource under osclients/group.go, and add to it the User struct, like we do for ports. For example:
type GroupExt struct {
groups.Group
users.Users
}Then we could populate it as desired and write on status. That's another alternative that I've thought.
There was a problem hiding this comment.
The problem with a more complex struct that just user IDs is that we're only duplicating data that is already in the User object own status (which should be the source or truth).
There was a problem hiding this comment.
Seems creating a wrapper struct for Group and UserIDs is a way to go. I will follow this.
Containing UserName/UserID in the status is surely kind of duplcated, but from the point of view of an admin/user, it would save efforts to match between UserName and UserID when he looks at the output of a Group. If conciseness is prefered, I have no issue with it.
There was a problem hiding this comment.
I have a concern about drifting the states. If someone does a change in the User user-a, and this user is part of a group, will a new event be triggered on the Group to reconcile the user list?
Answering myself: I think so, since we register a WatchEventHandler. And yeah, I agree that's a downside having duplicated data for users =/.
|
|
||
| Delete one of the Users from the group. Verify if only that specific user is not in the group in OpenStack anymore. | ||
|
|
||
| # Step 04 |
There was a problem hiding this comment.
Inconsistent heading
| # Step 04 | |
| ## Step 04 |
There was a problem hiding this comment.
It seems I need to push AI harder to find things like this :D
5e4548f to
86f2842
Compare
86f2842 to
b83fb91
Compare
This PR adds
UserRefsfield in theGroupspec to allow user to manageUsers in aGroupin OpenStack.Notes to reviewers:
MaxItemsofUserRefsis set to1024to allow a large group. Please suggest if you consider this value is inappropriate.Close #905