[ 
https://issues.apache.org/jira/browse/YUNIKORN-2636?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yu-Lin Chen updated YUNIKORN-2636:
----------------------------------
    Description: 
Admission controller should patch missing queueName/applicationID if they were 
not set.

However, if the queueName/applicationID were only set in annotation, AM will 
still patch the default value to pod. The updatePodLabel() only check existing 
labels.
 * 
[https://github.com/apache/yunikorn-k8shim/blob/master/pkg/admission/util.go#L39-L40]
 * 
[https://github.com/apache/yunikorn-k8shim/blob/6f2800f689e9e341c736a6af8cbf178a711a9423/pkg/admission/util.go#L53]

 

{*}What will impact users{*}:

When set placement rule to"provided", the application will be submitted to 
default queue instead the queue set in the original pod.

Step to reproduce the issue:
 # Update placement rule to provide
{code:java}
apiVersion: v1
kind: ConfigMap
metadata:
  name: yunikorn-configs
  namespace: yunikorn
data:
  log.level: "DEBUG"
  queues.yaml: |
    partitions:
      - name: default
        queues:
          - name: root
            submitacl: '*'
        placementrules:
          - name: provided
            create: true  {code}

 # Create pod with queue/app-id annotations 
{code:java}
apiVersion: v1
kind: Pod
metadata:
  labels:
    app: sleep
  annotations:
    yunikorn.apache.org/app-id: "application-sleep-0001"
    yunikorn.apache.org/queue: "root.sandbox"
  name: pod-with-annotations-only
spec:
  schedulerName: yunikorn
  restartPolicy: Never
  containers:
    - name: sleep-6000s
      image: "alpine:latest"
      command: ["sleep", "6000"]
      resources:
        requests:
          cpu: "100m"
          memory: "500M"{code}

 # Check below labels in pod, thees are added by AM.
 ## queue=root.default
 ## applicationId=yunikorn-default-autogen
 # Check the app's queue: 
[http://localhost:9889/ws/v1/partition/default/application/application-sleep-0001]
 .

The app is in "root.default", but it should be in "root.sandbox". 
(Please check the queue ordering: 
[Doc|https://yunikorn.apache.org/docs/user_guide/labels_and_annotations_in_yunikorn#annotations-in-yunikorn])

To fix this issue, we should let AM check all the possible locations.

Notes: As part of the future change in YUNIKORN-2504, If the same metadata 
(queue or applicationID) is specified in multiple locations and their values 
are inconsistent, the pod should be reject.

  was:
Admission controller should patch missing queueName/applicationID if they were 
not set.

However, if the queueName/applicationID were only set in annotation, AM will 
still patch the default value to pod. The updatePodLabel() only check existing 
labels.
 * 
[https://github.com/apache/yunikorn-k8shim/blob/master/pkg/admission/util.go#L39-L40]
 * 
[https://github.com/apache/yunikorn-k8shim/blob/6f2800f689e9e341c736a6af8cbf178a711a9423/pkg/admission/util.go#L53]

 

{*}What will impact users{*}:

When set placement rule to"provided", the application will be submitted to 
default queue instead the queue set in the original pod.

Step to reproduce the issue:
 # Update placement rule to provided
{code:java}
apiVersion: v1
kind: ConfigMap
metadata:
  name: yunikorn-configs
  namespace: yunikorn
data:
  log.level: "DEBUG"
  queues.yaml: |
    partitions:
      - name: default
        queues:
          - name: root
            submitacl: '*'
        placementrules:
          - name: provided
            create: true {code}

 # Create pod with queue/app-id annotations 
{code:java}
apiVersion:v1
kind: Pod
metadata:
  labels:
    app: sleep
  annotations:
    yunikorn.apache.org/app-id: "application-sleep-0001"    
    yunikorn.apache.org/queue: "root.sandbox"
  name: pod-with-annotations-only
spec:
  schedulerName: yunikorn
  restartPolicy: Never
  containers:
    - name: sleep-6000s
      image: "alpine:latest"
      command: ["sleep", "6000"]
      resources:
        requests:
          cpu: "100m"
          memory: "500M" {code}

 # Check below labels in pod, thees are added by AM. 
 ## applicationId=yunikorn-default-autogen
 ## queue=root.default
 # Check the app's queue: 
[http://localhost:9889/ws/v1/partition/default/application/application-sleep-0001]
 .
The app is in "root.default", but it should be "root.sandbox". 
(Please check the queue ordering: 
[Doc|https://yunikorn.apache.org/docs/user_guide/labels_and_annotations_in_yunikorn#annotations-in-yunikorn])

To fix this issue, we should let AM check all the possible locations.

And as part of the future change in YUNIKORN-2504, If the same metadata (queue 
or applicationID) is specified in multiple locations and their values are 
inconsistent, the pod should be reject.


> Admission Controller ignores existing Queue/ApplicationID annotations
> ---------------------------------------------------------------------
>
>                 Key: YUNIKORN-2636
>                 URL: https://issues.apache.org/jira/browse/YUNIKORN-2636
>             Project: Apache YuniKorn
>          Issue Type: Bug
>          Components: shim - kubernetes
>            Reporter: Yu-Lin Chen
>            Assignee: Yu-Lin Chen
>            Priority: Major
>             Fix For: 1.6.0
>
>
> Admission controller should patch missing queueName/applicationID if they 
> were not set.
> However, if the queueName/applicationID were only set in annotation, AM will 
> still patch the default value to pod. The updatePodLabel() only check 
> existing labels.
>  * 
> [https://github.com/apache/yunikorn-k8shim/blob/master/pkg/admission/util.go#L39-L40]
>  * 
> [https://github.com/apache/yunikorn-k8shim/blob/6f2800f689e9e341c736a6af8cbf178a711a9423/pkg/admission/util.go#L53]
>  
> {*}What will impact users{*}:
> When set placement rule to"provided", the application will be submitted to 
> default queue instead the queue set in the original pod.
> Step to reproduce the issue:
>  # Update placement rule to provide
> {code:java}
> apiVersion: v1
> kind: ConfigMap
> metadata:
>   name: yunikorn-configs
>   namespace: yunikorn
> data:
>   log.level: "DEBUG"
>   queues.yaml: |
>     partitions:
>       - name: default
>         queues:
>           - name: root
>             submitacl: '*'
>         placementrules:
>           - name: provided
>             create: true  {code}
>  # Create pod with queue/app-id annotations 
> {code:java}
> apiVersion: v1
> kind: Pod
> metadata:
>   labels:
>     app: sleep
>   annotations:
>     yunikorn.apache.org/app-id: "application-sleep-0001"
>     yunikorn.apache.org/queue: "root.sandbox"
>   name: pod-with-annotations-only
> spec:
>   schedulerName: yunikorn
>   restartPolicy: Never
>   containers:
>     - name: sleep-6000s
>       image: "alpine:latest"
>       command: ["sleep", "6000"]
>       resources:
>         requests:
>           cpu: "100m"
>           memory: "500M"{code}
>  # Check below labels in pod, thees are added by AM.
>  ## queue=root.default
>  ## applicationId=yunikorn-default-autogen
>  # Check the app's queue: 
> [http://localhost:9889/ws/v1/partition/default/application/application-sleep-0001]
>  .
> The app is in "root.default", but it should be in "root.sandbox". 
> (Please check the queue ordering: 
> [Doc|https://yunikorn.apache.org/docs/user_guide/labels_and_annotations_in_yunikorn#annotations-in-yunikorn])
> To fix this issue, we should let AM check all the possible locations.
> Notes: As part of the future change in YUNIKORN-2504, If the same metadata 
> (queue or applicationID) is specified in multiple locations and their values 
> are inconsistent, the pod should be reject.



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

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

Reply via email to