Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions pkg/client/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ func convertV1User2Resource(user v1.User) (*v2.Resource, error) {
"generate_name": user.GenerateName,
}

traits := []rs.UserTraitOption{
rs.WithUserProfile(profile),
rs.WithCreatedAt(user.CreationTimestamp.Time),
}
traits := []rs.UserTraitOption{}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Suggestion: The migration itself is correct (WithResourceProfile/WithResourceCreatedAt run before the appended WithUserTrait, and syncUserTraitToResource only backfills unset resource fields, so behavior is unchanged). Now that the user trait slice is empty, it's visible that these user resources carry no login/email data even though v1.User exposes FullName and Identities — consider rs.WithUserLogin(user.Name, user.Identities...) to improve identity matching. Out of scope for this PR; non-blocking.


return rs.NewUserResource(
user.Name,
Expand All @@ -62,6 +59,8 @@ func convertV1User2Resource(user v1.User) (*v2.Resource, error) {
},
string(user.UID),
traits,
rs.WithResourceProfile(profile),
rs.WithResourceCreatedAt(user.CreationTimestamp.Time),
)
}

Expand Down Expand Up @@ -90,7 +89,6 @@ func convertV1RoleList2Resource(roleList rbacv1.Role) (*v2.Resource, error) {
}

traits := []rs.RoleTraitOption{
rs.WithRoleProfile(profile),
// FIXME(shackra): add creation time
}

Expand All @@ -106,6 +104,7 @@ func convertV1RoleList2Resource(roleList rbacv1.Role) (*v2.Resource, error) {
},
string(roleList.UID),
traits,
rs.WithResourceProfile(profile),
)
}

Expand Down Expand Up @@ -177,9 +176,7 @@ func convertV1Group2Resource(group v1.Group) (*v2.Resource, error) {
"created_at": group.CreationTimestamp.Format(time.RFC3339),
}

traits := []rs.GroupTraitOption{
rs.WithGroupProfile(profile),
}
traits := []rs.GroupTraitOption{}

return rs.NewGroupResource(
group.GetName(),
Expand All @@ -192,5 +189,6 @@ func convertV1Group2Resource(group v1.Group) (*v2.Resource, error) {
},
string(group.UID),
traits,
rs.WithResourceProfile(profile),
)
}
Loading