Bug 1688674

Summary: Scheduler priority "ImageLocalityPriority" not take effect
Product: OpenShift Container Platform Reporter: MinLi <minmli>
Component: NodeAssignee: ravig <rgudimet>
Status: CLOSED DUPLICATE QA Contact: Jianwei Hou <jhou>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.1.0CC: aos-bugs, jokerman, mmccomas
Target Milestone: ---   
Target Release: 4.1.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-03-20 15:32:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description MinLi 2019-03-14 08:22:14 UTC
Description of problem:
When create configmap and scheduler for policy priority "ImageLocalityPriority", it not take effect. It means a pod is not scheduled to a node which has image digest locally but to a node which need to pull image from registry.

Version-Release number of selected component (if applicable):
4.0.0-0.nightly-2019-03-13-233958
oc v4.0.0-0.182.0

How reproducible:
always

Steps to Reproduce:
1.#oc create configmap -n openshift-config --from-file=policy.cfg mypolicy
policy.cfg is like:
{
"kind" : "Policy",
"apiVersion" : "v1",
"priorities" : [
        {"name" : "ImageLocalityPriority", "weight" : 100}
        ]
}

2.#oc create -f scheduler.yaml
scheduler.yaml is like:
apiVersion: config.openshift.io/v1
kind: Scheduler
metadata:
  name: cluster
spec:
  policy:
    name: mypolicy

3.Pull image with digest in node1
#sudo crictl pull docker.io/deshuai/hello-pod@sha256:90b815d55c95fffafd7b68a997787d0b939cdae1bca785c6f52b5d3ffa70714f

4.Make sure only node1 has this image digest
#oc get node $nodeName -o json | grep
"sha256:90b815d55c95fffafd7b68a997787d0b939cdae1bca785c6f52b5d3ffa70714f"

5.Create a pod with this image digest.
#oc create -f pod.json -n minmli
pod.json is like:
{  
  "kind": "Pod",  
  "apiVersion": "v1",  
  "metadata": {  
    "name": "hello-openshift",  
    "creationTimestamp": null,  
    "labels": {  
      "name": "hello-openshift"  
    }  
  },  
  "spec": {  
    "containers": [  
      {  
        "name": "hello-openshift",  
**        "image": "docker.io/deshuai/hello-pod@sha256:90b815d55c95fffafd7b68a997787d0b939cdae1bca785c6f52b5d3ffa70714f",**  
        "ports": [  
          {  
            "containerPort": 8080,  
            "protocol": "TCP"  
          }  
        ],  
        "resources": {},  
        "volumeMounts": [  
          {  
            "name":"tmp",  
            "mountPath":"/tmp"  
          }  
        ],  
        "terminationMessagePath": "/dev/termination-log",  
        "imagePullPolicy": "IfNotPresent",  
        "capabilities": {},  
        "securityContext": {  
          "capabilities": {},  
          "privileged": false  
        }  
      }  
    ],  
    "volumes": [  
      {  
        "name":"tmp",  
        "emptyDir": {}  
      }  
    ],  
    "restartPolicy": "Always",  
    "dnsPolicy": "ClusterFirst",  
    "serviceAccount": ""  
  },  
  "status": {}  
}

Actual results:
5.the pod is not scheduled to node1, but node2 which need to pull image first. 

Expected results:
5.the pod is scheduled to node1


Additional info:
I think there should be some log in openshift-kube-scheduler pod, but I find nothing related, perhaps we should add some schedule log or maybe I don't choose correct log-level.