kannon92 commented on code in PR #475:
URL: https://github.com/apache/yunikorn-k8shim/pull/475#discussion_r1014632612
##########
pkg/common/utils/utils.go:
##########
@@ -238,7 +241,27 @@ func MergeMaps(first, second map[string]string)
map[string]string {
}
// find user name from pod label
-func GetUserFromPod(pod *v1.Pod) string {
+func GetUserFromPod(pod *v1.Pod) (string, []string) {
+ if pod.Annotations[userInfoKey] != "" {
+ userInfoJSON := pod.Annotations[userInfoKey]
+ var userGroup si.UserGroupInformation
+ err := json.Unmarshal([]byte(userInfoJSON), &userGroup)
+ if err != nil {
+ log.Logger().Error("unable to process user info
annotation", zap.Error(err))
+ return constants.DefaultUser, nil
+ }
+ user := userGroup.User
+ groups := userGroup.Groups
Review Comment:
New to the project so this may be a useless suggestion. Do you care if
groups are empty? Should there be logic for a default group? Or at least a
warning if groups are empty?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]