{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/31652","repository_url":"https://api.github.com/repos/kubernetes/kubernetes","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/31652/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/31652/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/31652/events","html_url":"https://github.com/kubernetes/kubernetes/pull/31652","id":173893665,"number":31652,"title":"[PHASE 1] Opaque integer resource accounting.","user":{"login":"ConnorDoyle","id":379372,"avatar_url":"https://avatars.githubusercontent.com/u/379372?v=3","gravatar_id":"","url":"https://api.github.com/users/ConnorDoyle","html_url":"https://github.com/ConnorDoyle","followers_url":"https://api.github.com/users/ConnorDoyle/followers","following_url":"https://api.github.com/users/ConnorDoyle/following{/other_user}","gists_url":"https://api.github.com/users/ConnorDoyle/gists{/gist_id}","starred_url":"https://api.github.com/users/ConnorDoyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ConnorDoyle/subscriptions","organizations_url":"https://api.github.com/users/ConnorDoyle/orgs","repos_url":"https://api.github.com/users/ConnorDoyle/repos","events_url":"https://api.github.com/users/ConnorDoyle/events{/privacy}","received_events_url":"https://api.github.com/users/ConnorDoyle/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/area/scheduling","name":"area/scheduling","color":"ab6420"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/cla:%20no","name":"cla: no","color":"e11d21"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/do-not-merge","name":"do-not-merge","color":"e11d21"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/kind/api-change","name":"kind/api-change","color":"c7def8"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/release-note","name":"release-note","color":"c2e0c6"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/size/XL","name":"size/XL","color":"ee5500"}],"state":"open","locked":false,"assignee":{"login":"timothysc","id":169553,"avatar_url":"https://avatars.githubusercontent.com/u/169553?v=3","gravatar_id":"","url":"https://api.github.com/users/timothysc","html_url":"https://github.com/timothysc","followers_url":"https://api.github.com/users/timothysc/followers","following_url":"https://api.github.com/users/timothysc/following{/other_user}","gists_url":"https://api.github.com/users/timothysc/gists{/gist_id}","starred_url":"https://api.github.com/users/timothysc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timothysc/subscriptions","organizations_url":"https://api.github.com/users/timothysc/orgs","repos_url":"https://api.github.com/users/timothysc/repos","events_url":"https://api.github.com/users/timothysc/events{/privacy}","received_events_url":"https://api.github.com/users/timothysc/received_events","type":"User","site_admin":false},"assignees":[{"login":"timothysc","id":169553,"avatar_url":"https://avatars.githubusercontent.com/u/169553?v=3","gravatar_id":"","url":"https://api.github.com/users/timothysc","html_url":"https://github.com/timothysc","followers_url":"https://api.github.com/users/timothysc/followers","following_url":"https://api.github.com/users/timothysc/following{/other_user}","gists_url":"https://api.github.com/users/timothysc/gists{/gist_id}","starred_url":"https://api.github.com/users/timothysc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timothysc/subscriptions","organizations_url":"https://api.github.com/users/timothysc/orgs","repos_url":"https://api.github.com/users/timothysc/repos","events_url":"https://api.github.com/users/timothysc/events{/privacy}","received_events_url":"https://api.github.com/users/timothysc/received_events","type":"User","site_admin":false},{"login":"davidopp","id":8264113,"avatar_url":"https://avatars.githubusercontent.com/u/8264113?v=3","gravatar_id":"","url":"https://api.github.com/users/davidopp","html_url":"https://github.com/davidopp","followers_url":"https://api.github.com/users/davidopp/followers","following_url":"https://api.github.com/users/davidopp/following{/other_user}","gists_url":"https://api.github.com/users/davidopp/gists{/gist_id}","starred_url":"https://api.github.com/users/davidopp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidopp/subscriptions","organizations_url":"https://api.github.com/users/davidopp/orgs","repos_url":"https://api.github.com/users/davidopp/repos","events_url":"https://api.github.com/users/davidopp/events{/privacy}","received_events_url":"https://api.github.com/users/davidopp/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/kubernetes/kubernetes/milestones/23","html_url":"https://github.com/kubernetes/kubernetes/milestones/v1.5","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones/23/labels","id":1945978,"number":23,"title":"v1.5","description":"","creator":{"login":"lavalamp","id":647318,"avatar_url":"https://avatars.githubusercontent.com/u/647318?v=3","gravatar_id":"","url":"https://api.github.com/users/lavalamp","html_url":"https://github.com/lavalamp","followers_url":"https://api.github.com/users/lavalamp/followers","following_url":"https://api.github.com/users/lavalamp/following{/other_user}","gists_url":"https://api.github.com/users/lavalamp/gists{/gist_id}","starred_url":"https://api.github.com/users/lavalamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lavalamp/subscriptions","organizations_url":"https://api.github.com/users/lavalamp/orgs","repos_url":"https://api.github.com/users/lavalamp/repos","events_url":"https://api.github.com/users/lavalamp/events{/privacy}","received_events_url":"https://api.github.com/users/lavalamp/received_events","type":"User","site_admin":false},"open_issues":214,"closed_issues":171,"state":"open","created_at":"2016-08-16T21:47:28Z","updated_at":"2016-10-18T20:20:26Z","due_on":"2016-12-09T00:00:00Z","closed_at":null},"comments":67,"created_at":"2016-08-29T23:06:40Z","updated_at":"2016-10-18T21:05:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/31652","html_url":"https://github.com/kubernetes/kubernetes/pull/31652","diff_url":"https://github.com/kubernetes/kubernetes/pull/31652.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/31652.patch"},"body":"## [PHASE 1] Opaque integer resource accounting.\r\n\r\nThis change provides a simple way to advertise some amount of arbitrary countable resource for a node in a Kubernetes cluster. Users can consume these resources by including them in pod specs, and the scheduler takes them into account when placing pods on nodes. See the example at the bottom of the PR description for more info.\r\n\r\nSummary of changes:\r\n\r\n- Defines opaque integer resources as any resource with prefix `pod.alpha.kubernetes.io/opaque-int-resource-`.\r\n- Prevent kubelet from overwriting capacity.\r\n- Handle opaque resources in scheduler.\r\n- Validate integer-ness of opaque int quantities in API server.\r\n- Tests for above.\r\n\r\nFeature issue: https://github.com/kubernetes/features/issues/76\r\n\r\nDesign: http://goo.gl/IoKYP1\r\n\r\nIssues:\r\n\r\nkubernetes/kubernetes#28312\r\nkubernetes/kubernetes#19082\r\n\r\nRelated:\r\n\r\nkubernetes/kubernetes#19080\r\n\r\nCC @davidopp @timothysc @balajismaniam \r\n\r\n**Release note**:\r\n<!--  Steps to write your release note:\r\n1. Use the release-note-* labels to set the release note state (if you have access) \r\n2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. \r\n-->\r\n```release-note\r\nTODO\r\n```\r\n\r\n## Usage example\r\n\r\n```sh\r\n$ echo '[{\"op\": \"add\", \"path\": \"pod.alpha.kubernetes.io~1opaque-int-resource-bananas\", \"value\": \"555\"}]' | \\\r\n> http PATCH http://localhost:8080/api/v1/nodes/localhost.localdomain/status \\\r\n> Content-Type:application/json-patch+json\r\n```\r\n\r\n```http\r\nHTTP/1.1 200 OK\r\nContent-Type: application/json\r\nDate: Thu, 11 Aug 2016 16:44:55 GMT\r\nTransfer-Encoding: chunked\r\n\r\n{\r\n    \"apiVersion\": \"v1\",\r\n    \"kind\": \"Node\",\r\n    \"metadata\": {\r\n        \"annotations\": {\r\n            \"volumes.kubernetes.io/controller-managed-attach-detach\": \"true\"\r\n        },\r\n        \"creationTimestamp\": \"2016-07-12T04:07:43Z\",\r\n        \"labels\": {\r\n            \"beta.kubernetes.io/arch\": \"amd64\",\r\n            \"beta.kubernetes.io/os\": \"linux\",\r\n            \"kubernetes.io/hostname\": \"localhost.localdomain\"\r\n        },\r\n        \"name\": \"localhost.localdomain\",\r\n        \"resourceVersion\": \"12837\",\r\n        \"selfLink\": \"/api/v1/nodes/localhost.localdomain/status\",\r\n        \"uid\": \"2ee9ea1c-47e6-11e6-9fb4-525400659b2e\"\r\n    },\r\n    \"spec\": {\r\n        \"externalID\": \"localhost.localdomain\"\r\n    },\r\n    \"status\": {\r\n        \"addresses\": [\r\n            {\r\n                \"address\": \"10.0.2.15\",\r\n                \"type\": \"LegacyHostIP\"\r\n            },\r\n            {\r\n                \"address\": \"10.0.2.15\",\r\n                \"type\": \"InternalIP\"\r\n            }\r\n        ],\r\n        \"allocatable\": {\r\n            \"alpha.kubernetes.io/nvidia-gpu\": \"0\",\r\n            \"cpu\": \"2\",\r\n            \"memory\": \"8175808Ki\",\r\n            \"pods\": \"110\"\r\n        },\r\n        \"capacity\": {\r\n            \"alpha.kubernetes.io/nvidia-gpu\": \"0\",\r\n            \"pod.alpha.kubernetes.io/opaque-int-resource-bananas\": \"555\",\r\n            \"cpu\": \"2\",\r\n            \"memory\": \"8175808Ki\",\r\n            \"pods\": \"110\"\r\n        },\r\n        \"conditions\": [\r\n            {\r\n                \"lastHeartbeatTime\": \"2016-08-11T16:44:47Z\",\r\n                \"lastTransitionTime\": \"2016-07-12T04:07:43Z\",\r\n                \"message\": \"kubelet has sufficient disk space available\",\r\n                \"reason\": \"KubeletHasSufficientDisk\",\r\n                \"status\": \"False\",\r\n                \"type\": \"OutOfDisk\"\r\n            },\r\n            {\r\n                \"lastHeartbeatTime\": \"2016-08-11T16:44:47Z\",\r\n                \"lastTransitionTime\": \"2016-07-12T04:07:43Z\",\r\n                \"message\": \"kubelet has sufficient memory available\",\r\n                \"reason\": \"KubeletHasSufficientMemory\",\r\n                \"status\": \"False\",\r\n                \"type\": \"MemoryPressure\"\r\n            },\r\n            {\r\n                \"lastHeartbeatTime\": \"2016-08-11T16:44:47Z\",\r\n                \"lastTransitionTime\": \"2016-08-10T06:27:11Z\",\r\n                \"message\": \"kubelet is posting ready status\",\r\n                \"reason\": \"KubeletReady\",\r\n                \"status\": \"True\",\r\n                \"type\": \"Ready\"\r\n            },\r\n            {\r\n                \"lastHeartbeatTime\": \"2016-08-11T16:44:47Z\",\r\n                \"lastTransitionTime\": \"2016-08-10T06:27:01Z\",\r\n                \"message\": \"kubelet has no disk pressure\",\r\n                \"reason\": \"KubeletHasNoDiskPressure\",\r\n                \"status\": \"False\",\r\n                \"type\": \"DiskPressure\"\r\n            }\r\n        ],\r\n        \"daemonEndpoints\": {\r\n            \"kubeletEndpoint\": {\r\n                \"Port\": 10250\r\n            }\r\n        },\r\n        \"images\": [],\r\n        \"nodeInfo\": {\r\n            \"architecture\": \"amd64\",\r\n            \"bootID\": \"1f7e95ca-a4c2-490e-8ca2-6621ae1eb5f0\",\r\n            \"containerRuntimeVersion\": \"docker://1.10.3\",\r\n            \"kernelVersion\": \"4.5.7-202.fc23.x86_64\",\r\n            \"kubeProxyVersion\": \"v1.3.0-alpha.4.4285+7e4b86c96110d3-dirty\",\r\n            \"kubeletVersion\": \"v1.3.0-alpha.4.4285+7e4b86c96110d3-dirty\",\r\n            \"machineID\": \"cac4063395254bc89d06af5d05322453\",\r\n            \"operatingSystem\": \"linux\",\r\n            \"osImage\": \"Fedora 23 (Cloud Edition)\",\r\n            \"systemUUID\": \"D6EE0782-5DEB-4465-B35D-E54190C5EE96\"\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nAfter patching, the kubelet's next sync fills in allocatable:\r\n\r\n```\r\n$ kubectl get node localhost.localdomain -o json | jq .status.allocatable\r\n```\r\n\r\n```json\r\n{\r\n  \"alpha.kubernetes.io/nvidia-gpu\": \"0\",\r\n  \"pod.alpha.kubernetes.io/opaque-int-resource-bananas\": \"555\",\r\n  \"cpu\": \"2\",\r\n  \"memory\": \"8175808Ki\",\r\n  \"pods\": \"110\"\r\n}\r\n```\r\n\r\nCreate two pods, one that needs a single banana and another that needs a truck load:\r\n\r\n```\r\n$ kubectl create -f chimp.yaml\r\n$ kubectl create -f superchimp.yaml\r\n```\r\n\r\nInspect the scheduler result and pod status:\r\n\r\n```\r\n$ kubectl describe pods chimp\r\nName:           chimp\r\nNamespace:      default\r\nNode:           localhost.localdomain/10.0.2.15\r\nStart Time:     Thu, 11 Aug 2016 19:58:46 +0000\r\nLabels:         <none>\r\nStatus:         Running\r\nIP:             172.17.0.2\r\nControllers:    <none>\r\nContainers:\r\n  nginx:\r\n    Container ID:       docker://46ff268f2f9217c59cc49f97cc4f0f085d5ac0e251f508cc08938601117c0cec\r\n    Image:              nginx:1.10\r\n    Image ID:           docker://sha256:82e97a2b0390a20107ab1310dea17f539ff6034438099384998fd91fc540b128\r\n    Port:               80/TCP\r\n    Limits:\r\n      cpu:                                      500m\r\n      memory:                                   64Mi\r\n      pod.alpha.kubernetes.io/opaque-int-resource-bananas:   3\r\n    Requests:\r\n      cpu:                                      250m\r\n      memory:                                   32Mi\r\n      pod.alpha.kubernetes.io/opaque-int-resource-bananas:   1\r\n    State:                                      Running\r\n      Started:                                  Thu, 11 Aug 2016 19:58:51 +0000\r\n    Ready:                                      True\r\n    Restart Count:                              0\r\n    Volume Mounts:                              <none>\r\n    Environment Variables:                      <none>\r\nConditions:\r\n  Type          Status\r\n  Initialized   True \r\n  Ready         True \r\n  PodScheduled  True \r\nNo volumes.\r\nQoS Class:      Burstable\r\nEvents:\r\n  FirstSeen     LastSeen        Count   From                            SubobjectPath           Type            Reason                  Message\r\n  ---------     --------        -----   ----                            -------------           --------        ------                  -------\r\n  9m            9m              1       {default-scheduler }                                    Normal          Scheduled               Successfully assigned chimp to localhost.localdomain\r\n  9m            9m              2       {kubelet localhost.localdomain}                         Warning         MissingClusterDNS       kubelet does not have ClusterDNS IP configured and cannot create Pod using \"ClusterFirst\" policy. Falling back to DNSDefault policy.\r\n  9m            9m              1       {kubelet localhost.localdomain} spec.containers{nginx}  Normal          Pulled                  Container image \"nginx:1.10\" already present on machine\r\n  9m            9m              1       {kubelet localhost.localdomain} spec.containers{nginx}  Normal          Created                 Created container with docker id 46ff268f2f92\r\n  9m            9m              1       {kubelet localhost.localdomain} spec.containers{nginx}  Normal          Started                 Started container with docker id 46ff268f2f92\r\n```\r\n\r\n```\r\n$ kubectl describe pods superchimp\r\nName:           superchimp\r\nNamespace:      default\r\nNode:           /\r\nLabels:         <none>\r\nStatus:         Pending\r\nIP:\r\nControllers:    <none>\r\nContainers:\r\n  nginx:\r\n    Image:      nginx:1.10\r\n    Port:       80/TCP\r\n    Requests:\r\n      cpu:                                      250m\r\n      memory:                                   32Mi\r\n      pod.alpha.kubernetes.io/opaque-int-resource-bananas:   10Ki\r\n    Volume Mounts:                              <none>\r\n    Environment Variables:                      <none>\r\nConditions:\r\n  Type          Status\r\n  PodScheduled  False \r\nNo volumes.\r\nQoS Class:      Burstable\r\nEvents:\r\n  FirstSeen     LastSeen        Count   From                    SubobjectPath   Type            Reason                  Message\r\n  ---------     --------        -----   ----                    -------------   --------        ------                  -------\r\n  3m            1s              15      {default-scheduler }                    Warning         FailedScheduling        pod (superchimp) failed to fit in any node\r\nfit failure on node (localhost.localdomain): Insufficient pod.alpha.kubernetes.io/opaque-int-resource-bananas\r\n```\r\n\r\n<!-- Reviewable:start -->\r\n---\r\nThis change is [<img src=\"https://reviewable.kubernetes.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/31652)\r\n<!-- Reviewable:end -->\r\n"},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/254639066","html_url":"https://github.com/kubernetes/kubernetes/pull/31652#issuecomment-254639066","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/31652","id":254639066,"user":{"login":"ConnorDoyle","id":379372,"avatar_url":"https://avatars.githubusercontent.com/u/379372?v=3","gravatar_id":"","url":"https://api.github.com/users/ConnorDoyle","html_url":"https://github.com/ConnorDoyle","followers_url":"https://api.github.com/users/ConnorDoyle/followers","following_url":"https://api.github.com/users/ConnorDoyle/following{/other_user}","gists_url":"https://api.github.com/users/ConnorDoyle/gists{/gist_id}","starred_url":"https://api.github.com/users/ConnorDoyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ConnorDoyle/subscriptions","organizations_url":"https://api.github.com/users/ConnorDoyle/orgs","repos_url":"https://api.github.com/users/ConnorDoyle/repos","events_url":"https://api.github.com/users/ConnorDoyle/events{/privacy}","received_events_url":"https://api.github.com/users/ConnorDoyle/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T21:05:01Z","updated_at":"2016-10-18T21:05:01Z","body":"@k8s-bot gci gke e2e test this"}}
{"actor":{"display_login":"ConnorDoyle"}}