Yongjun Zhang created YUNIKORN-1831:
---------------------------------------

             Summary: 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


[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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to