Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • None
    • None

    Description

      Right now it os possible to query an application based on its name:

      https://github.com/apache/incubator-yunikorn-k8shim/blob/master/pkg/client/clientset/versioned/typed/yunikorn.apache.org/v1alpha1/application.go#L46, but if we will set the applicationId = UID, we will need to be able to query the application based on the UID as well.

       

       

      Attachments

        Activity

          kmarton Kinga Marton added a comment - - edited

          Huang Ting Yao since you are familiar with go client code generation, can you please help me with this issue?

          kmarton Kinga Marton added a comment - - edited Huang Ting Yao  since you are familiar with go client code generation, can you please help me with this issue?
          wwei Weiwei Yang added a comment -

          hi kmarton

          That code is generated, I don't think we should edit any of that.
          Based on your investigation, if it is not possible to query application by spec.UID, then we need to think the other way round. Please confirm if this is the case.
          The other option we were talking about is to use "namespace-appCRDName" as the applicationID. We put a dash("-") between namespace and the CRD name, it should be unique in the cluster.

          wwei Weiwei Yang added a comment - hi kmarton That code is generated, I don't think we should edit any of that. Based on your investigation, if it is not possible to query application by spec.UID, then we need to think the other way round. Please confirm if this is the case. The other option we were talking about is to use "namespace-appCRDName" as the applicationID. We put a dash("-") between namespace and the CRD name, it should be unique in the cluster.
          tingyao TingYao Huang added a comment - - edited

          Agree with wwei, I think we shouldn't edit the generated file.

          tingyao TingYao Huang added a comment - - edited Agree with wwei , I think we shouldn't edit the generated file.
          kmarton Kinga Marton added a comment -

          wwei I was thinking if it is possible to pass some parameters to the code generator, to generate the new selector as well. Huang Ting Yao do you know if it is possible? If not, I suggest to go with namespace-name as applicationID.

          kmarton Kinga Marton added a comment - wwei I was thinking if it is possible to pass some parameters to the code generator, to generate the new selector as well. Huang Ting Yao  do you know if it is possible? If not, I suggest to go with namespace-name as applicationID.
          tingyao TingYao Huang added a comment - - edited

          According the Adding expansion methods part of this docs. We can create a func like GetAppWithUID().

          But not sure the Param() in that library which was used by Get() can get the Application by UID.

          Still need to check.

          tingyao TingYao Huang added a comment - - edited According the  Adding expansion methods  part of this  docs . We can create a func like GetAppWithUID(). But not sure the Param() in that library which was used by Get() can get the Application by UID. Still need to check.
          tingyao TingYao Huang added a comment - - edited

          Hi kmarton wwei

          After my testing, I can't get Application with UID by Param().

          Here is the GetAppWithUID() func I try to create, in e2e test it will return a empty Application.

           

          func (c *applications) GetAppWithUID(id string, options v1.GetOptions) (result *v1alpha1.Application, err error) {    
                 result = &v1alpha1.Application{}
                 err = c.client.Get().
                     Namespace(c.ns).
                     Resource("applications").
                     Param("uid", id).
                     VersionedParams(&options, scheme.ParameterCodec).
                     Do().
                     Into(result)
                 return
          }

           

           

           

          tingyao TingYao Huang added a comment - - edited Hi kmarton wwei After my testing, I can't get Application with UID by Param(). Here is the GetAppWithUID() func I try to create, in e2e test it will return a empty Application.   func (c *applications) GetAppWithUID(id string, options v1.GetOptions) (result *v1alpha1.Application, err error) {     result = &v1alpha1.Application{} err = c.client.Get(). Namespace(c.ns). Resource( "applications" ). Param( "uid" , id). VersionedParams(&options, scheme.ParameterCodec). Do(). Into(result) return }      
          kmarton Kinga Marton added a comment -

          Thank you Huang Ting Yao for investigating on this. wwei having in consideration that using UID for app ID is not straight-forwrd, I suggest to use namespace-appname as the id instead of the UID. What do you think?

          kmarton Kinga Marton added a comment - Thank you Huang Ting Yao  for investigating on this. wwei  having in consideration that using UID for app ID is not straight-forwrd, I suggest to use namespace-appname as the id instead of the UID. What do you think?
          tingyao TingYao Huang added a comment - - edited

          kmarton Agree. Use namespace-appname as the id would be a better option.

          tingyao TingYao Huang added a comment - - edited kmarton  Agree. Use namespace-appname as the id would be a better option.

          People

            Unassigned Unassigned
            kmarton Kinga Marton
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: