You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by "Yongjun Zhang (Jira)" <ji...@apache.org> on 2023/07/14 21:20:00 UTC

[jira] [Commented] (YUNIKORN-1831) Incorrect key name used for user info in pod annotation in user guide example

    [ https://issues.apache.org/jira/browse/YUNIKORN-1831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17743294#comment-17743294 ] 

Yongjun Zhang commented on YUNIKORN-1831:
-----------------------------------------

Thanks [~ccondit] .

> Incorrect key name used for user info in pod annotation in user guide example
> -----------------------------------------------------------------------------
>
>                 Key: YUNIKORN-1831
>                 URL: https://issues.apache.org/jira/browse/YUNIKORN-1831
>             Project: Apache YuniKorn
>          Issue Type: Improvement
>          Components: documentation
>            Reporter: Yongjun Zhang
>            Assignee: Yongjun Zhang
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.4.0
>
>
> [https://yunikorn.apache.org/docs/user_guide/usergroup_resolution/]
> {code:java}
> metadata:
>   annotations:
>     yunikorn.apache.org/user.info: "
>     {
>       username: \"yunikorn\",
>       groups: [
>         \"developers\",
>         \"devops\"
>       ]
>     }" {code}
> There are two problems with this example:
> Without quoting the key name, yunikorn will complain
> {code:java}
> 2023-06-22T21:48:56.243Z	ERROR	utils/utils.go:277	unable to process user info annotation	{"error": "invalid character 'u' looking for beginning of object key string"}github.com/apache/yunikorn-k8shim/pkg/common/utils.GetUserFromPod	/Users/yongjunzhang/code/yunikorn-vote/apache-yunikorn-1.3.0-src/k8shim/pkg/common/utils/utils.go:277github.com/apache/yunikorn-k8shim/pkg/appmgmt/general.getAppMetadata
>  {code}
> After adding quote
> {code:java}
>  metadata:
>   annotations:
>     yunikorn.apache.org/user.info: "
>     {
>       \"username\": \"yunikorn\",
>       \"groups\": [
>         \"developers\",
>         \"devops\"
>       ]
>     }"{code}
> I saw that user name still did not take effect, and found the code points to:
> {code:java}
> type UserGroupInformation struct {
>    // the user name
>    User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
>    // the list of groups of the user, can be empty
>    Groups               []string `protobuf:"bytes,2,rep,name=groups,proto3" json:"groups,omitempty"`
>  {code}
> Which means we should use "user" rather than "username"



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org