{"action":"created","comment":{"url":"https://api.github.com/repos/knative/serving/pulls/comments/211663002","pull_request_review_id":148115598,"id":211663002,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTY2MzAwMg==","diff_hunk":"@@ -50,14 +50,33 @@ func TestKPAScaler(t *testing.T) {\n \t\twantState     v1alpha1.RevisionServingStateType\n \t\twantReplicas  int\n \t\twantScaling   bool\n+\t\tkpaMutation   func(*kpa.PodAutoscaler)\n \t}{{\n-\t\tlabel:         \"scales to zero\",\n-\t\tstartState:    v1alpha1.RevisionServingStateActive,\n+\t\tlabel:         \"waits to scale to zero\",\n+\t\tstartState:    v1alpha1.RevisionServingStateReserve,\n \t\tstartReplicas: 1,\n \t\tscaleTo:       0,\n \t\twantState:     v1alpha1.RevisionServingStateReserve,\n \t\twantReplicas:  1,\n \t\twantScaling:   false,\n+\t\tkpaMutation: func(kpa *kpa.PodAutoscaler) {\n+\t\t\tkpa.Status.MarkInactive(\"foo\", \"bar\")\n+\t\t},\n+\t}, {\n+\t\tlabel:         \"scale to zero after grace period\",\n+\t\tstartState:    v1alpha1.RevisionServingStateReserve,\n+\t\tstartReplicas: 1,\n+\t\tscaleTo:       0,\n+\t\twantState:     v1alpha1.RevisionServingStateReserve,\n+\t\twantReplicas:  0,\n+\t\twantScaling:   true,\n+\t\tkpaMutation: func(k *kpa.PodAutoscaler) {\n+\t\t\tk.Status.Conditions = []kpa.PodAutoscalerCondition{{\n+\t\t\t\tType:   \"Active\",\n+\t\t\t\tStatus: \"False\",\n+\t\t\t\t// No LTT == a long long time ago","path":"pkg/reconciler/v1alpha1/autoscaling/kpa_scaler_test.go","position":30,"original_position":30,"commit_id":"636902a8e1c9719bacdeda54db3d2c4dc4f665e0","original_commit_id":"636902a8e1c9719bacdeda54db3d2c4dc4f665e0","user":{"login":"mattmoor","id":2442466,"node_id":"MDQ6VXNlcjI0NDI0NjY=","avatar_url":"https://avatars3.githubusercontent.com/u/2442466?v=4","gravatar_id":"","url":"https://api.github.com/users/mattmoor","html_url":"https://github.com/mattmoor","followers_url":"https://api.github.com/users/mattmoor/followers","following_url":"https://api.github.com/users/mattmoor/following{/other_user}","gists_url":"https://api.github.com/users/mattmoor/gists{/gist_id}","starred_url":"https://api.github.com/users/mattmoor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattmoor/subscriptions","organizations_url":"https://api.github.com/users/mattmoor/orgs","repos_url":"https://api.github.com/users/mattmoor/repos","events_url":"https://api.github.com/users/mattmoor/events{/privacy}","received_events_url":"https://api.github.com/users/mattmoor/received_events","type":"User","site_admin":false},"body":"I added a test that checks the `gracePeriod` and just before.","created_at":"2018-08-21T16:00:00Z","updated_at":"2018-08-21T16:01:00Z","html_url":"https://github.com/knative/serving/pull/1906#discussion_r211663002","pull_request_url":"https://api.github.com/repos/knative/serving/pulls/1906","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/knative/serving/pulls/comments/211663002"},"html":{"href":"https://github.com/knative/serving/pull/1906#discussion_r211663002"},"pull_request":{"href":"https://api.github.com/repos/knative/serving/pulls/1906"}},"in_reply_to_id":211543696},"pull_request":{"url":"https://api.github.com/repos/knative/serving/pulls/1906","id":209710651,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5NzEwNjUx","html_url":"https://github.com/knative/serving/pull/1906","diff_url":"https://github.com/knative/serving/pull/1906.diff","patch_url":"https://github.com/knative/serving/pull/1906.patch","issue_url":"https://api.github.com/repos/knative/serving/issues/1906","number":1906,"state":"open","locked":false,"title":"Add a delay following inactivity before scaling to zero.","user":{"login":"mattmoor","id":2442466,"node_id":"MDQ6VXNlcjI0NDI0NjY=","avatar_url":"https://avatars3.githubusercontent.com/u/2442466?v=4","gravatar_id":"","url":"https://api.github.com/users/mattmoor","html_url":"https://github.com/mattmoor","followers_url":"https://api.github.com/users/mattmoor/followers","following_url":"https://api.github.com/users/mattmoor/following{/other_user}","gists_url":"https://api.github.com/users/mattmoor/gists{/gist_id}","starred_url":"https://api.github.com/users/mattmoor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattmoor/subscriptions","organizations_url":"https://api.github.com/users/mattmoor/orgs","repos_url":"https://api.github.com/users/mattmoor/repos","events_url":"https://api.github.com/users/mattmoor/events{/privacy}","received_events_url":"https://api.github.com/users/mattmoor/received_events","type":"User","site_admin":false},"body":"This adds a check that the `LastTransitionTime` of the KPA's `Active` condition was at least 60 seconds prior before performing the actual scale to zero.\r\n\r\nProgress towards: https://github.com/knative/serving/issues/1655\r\nFixes: https://github.com/knative/serving/issues/1395","created_at":"2018-08-21T05:16:02Z","updated_at":"2018-08-21T16:01:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"129d34868cfa4587a74f38c8ed4a6305951123df","assignee":{"login":"josephburnett","id":1103629,"node_id":"MDQ6VXNlcjExMDM2Mjk=","avatar_url":"https://avatars2.githubusercontent.com/u/1103629?v=4","gravatar_id":"","url":"https://api.github.com/users/josephburnett","html_url":"https://github.com/josephburnett","followers_url":"https://api.github.com/users/josephburnett/followers","following_url":"https://api.github.com/users/josephburnett/following{/other_user}","gists_url":"https://api.github.com/users/josephburnett/gists{/gist_id}","starred_url":"https://api.github.com/users/josephburnett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephburnett/subscriptions","organizations_url":"https://api.github.com/users/josephburnett/orgs","repos_url":"https://api.github.com/users/josephburnett/repos","events_url":"https://api.github.com/users/josephburnett/events{/privacy}","received_events_url":"https://api.github.com/users/josephburnett/received_events","type":"User","site_admin":false},"assignees":[{"login":"josephburnett","id":1103629,"node_id":"MDQ6VXNlcjExMDM2Mjk=","avatar_url":"https://avatars2.githubusercontent.com/u/1103629?v=4","gravatar_id":"","url":"https://api.github.com/users/josephburnett","html_url":"https://github.com/josephburnett","followers_url":"https://api.github.com/users/josephburnett/followers","following_url":"https://api.github.com/users/josephburnett/following{/other_user}","gists_url":"https://api.github.com/users/josephburnett/gists{/gist_id}","starred_url":"https://api.github.com/users/josephburnett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephburnett/subscriptions","organizations_url":"https://api.github.com/users/josephburnett/orgs","repos_url":"https://api.github.com/users/josephburnett/repos","events_url":"https://api.github.com/users/josephburnett/events{/privacy}","received_events_url":"https://api.github.com/users/josephburnett/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"josephburnett","id":1103629,"node_id":"MDQ6VXNlcjExMDM2Mjk=","avatar_url":"https://avatars2.githubusercontent.com/u/1103629?v=4","gravatar_id":"","url":"https://api.github.com/users/josephburnett","html_url":"https://github.com/josephburnett","followers_url":"https://api.github.com/users/josephburnett/followers","following_url":"https://api.github.com/users/josephburnett/following{/other_user}","gists_url":"https://api.github.com/users/josephburnett/gists{/gist_id}","starred_url":"https://api.github.com/users/josephburnett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephburnett/subscriptions","organizations_url":"https://api.github.com/users/josephburnett/orgs","repos_url":"https://api.github.com/users/josephburnett/repos","events_url":"https://api.github.com/users/josephburnett/events{/privacy}","received_events_url":"https://api.github.com/users/josephburnett/received_events","type":"User","site_admin":false},{"login":"evankanderson","id":7959095,"node_id":"MDQ6VXNlcjc5NTkwOTU=","avatar_url":"https://avatars2.githubusercontent.com/u/7959095?v=4","gravatar_id":"","url":"https://api.github.com/users/evankanderson","html_url":"https://github.com/evankanderson","followers_url":"https://api.github.com/users/evankanderson/followers","following_url":"https://api.github.com/users/evankanderson/following{/other_user}","gists_url":"https://api.github.com/users/evankanderson/gists{/gist_id}","starred_url":"https://api.github.com/users/evankanderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evankanderson/subscriptions","organizations_url":"https://api.github.com/users/evankanderson/orgs","repos_url":"https://api.github.com/users/evankanderson/repos","events_url":"https://api.github.com/users/evankanderson/events{/privacy}","received_events_url":"https://api.github.com/users/evankanderson/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":873831452,"node_id":"MDU6TGFiZWw4NzM4MzE0NTI=","url":"https://api.github.com/repos/knative/serving/labels/approved","name":"approved","color":"ededed","default":false},{"id":859767870,"node_id":"MDU6TGFiZWw4NTk3Njc4NzA=","url":"https://api.github.com/repos/knative/serving/labels/size/M","name":"size/M","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/knative/serving/pulls/1906/commits","review_comments_url":"https://api.github.com/repos/knative/serving/pulls/1906/comments","review_comment_url":"https://api.github.com/repos/knative/serving/pulls/comments{/number}","comments_url":"https://api.github.com/repos/knative/serving/issues/1906/comments","statuses_url":"https://api.github.com/repos/knative/serving/statuses/636902a8e1c9719bacdeda54db3d2c4dc4f665e0","head":{"label":"mattmoor:scale-down-delay","ref":"scale-down-delay","sha":"636902a8e1c9719bacdeda54db3d2c4dc4f665e0","user":{"login":"mattmoor","id":2442466,"node_id":"MDQ6VXNlcjI0NDI0NjY=","avatar_url":"https://avatars3.githubusercontent.com/u/2442466?v=4","gravatar_id":"","url":"https://api.github.com/users/mattmoor","html_url":"https://github.com/mattmoor","followers_url":"https://api.github.com/users/mattmoor/followers","following_url":"https://api.github.com/users/mattmoor/following{/other_user}","gists_url":"https://api.github.com/users/mattmoor/gists{/gist_id}","starred_url":"https://api.github.com/users/mattmoor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattmoor/subscriptions","organizations_url":"https://api.github.com/users/mattmoor/orgs","repos_url":"https://api.github.com/users/mattmoor/repos","events_url":"https://api.github.com/users/mattmoor/events{/privacy}","received_events_url":"https://api.github.com/users/mattmoor/received_events","type":"User","site_admin":false},"repo":{"id":142188207,"node_id":"MDEwOlJlcG9zaXRvcnkxNDIxODgyMDc=","name":"serving","full_name":"mattmoor/serving","owner":{"login":"mattmoor","id":2442466,"node_id":"MDQ6VXNlcjI0NDI0NjY=","avatar_url":"https://avatars3.githubusercontent.com/u/2442466?v=4","gravatar_id":"","url":"https://api.github.com/users/mattmoor","html_url":"https://github.com/mattmoor","followers_url":"https://api.github.com/users/mattmoor/followers","following_url":"https://api.github.com/users/mattmoor/following{/other_user}","gists_url":"https://api.github.com/users/mattmoor/gists{/gist_id}","starred_url":"https://api.github.com/users/mattmoor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattmoor/subscriptions","organizations_url":"https://api.github.com/users/mattmoor/orgs","repos_url":"https://api.github.com/users/mattmoor/repos","events_url":"https://api.github.com/users/mattmoor/events{/privacy}","received_events_url":"https://api.github.com/users/mattmoor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mattmoor/serving","description":"Kubernetes-based, scale-to-zero, request-driven compute","fork":true,"url":"https://api.github.com/repos/mattmoor/serving","forks_url":"https://api.github.com/repos/mattmoor/serving/forks","keys_url":"https://api.github.com/repos/mattmoor/serving/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mattmoor/serving/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mattmoor/serving/teams","hooks_url":"https://api.github.com/repos/mattmoor/serving/hooks","issue_events_url":"https://api.github.com/repos/mattmoor/serving/issues/events{/number}","events_url":"https://api.github.com/repos/mattmoor/serving/events","assignees_url":"https://api.github.com/repos/mattmoor/serving/assignees{/user}","branches_url":"https://api.github.com/repos/mattmoor/serving/branches{/branch}","tags_url":"https://api.github.com/repos/mattmoor/serving/tags","blobs_url":"https://api.github.com/repos/mattmoor/serving/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mattmoor/serving/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mattmoor/serving/git/refs{/sha}","trees_url":"https://api.github.com/repos/mattmoor/serving/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mattmoor/serving/statuses/{sha}","languages_url":"https://api.github.com/repos/mattmoor/serving/languages","stargazers_url":"https://api.github.com/repos/mattmoor/serving/stargazers","contributors_url":"https://api.github.com/repos/mattmoor/serving/contributors","subscribers_url":"https://api.github.com/repos/mattmoor/serving/subscribers","subscription_url":"https://api.github.com/repos/mattmoor/serving/subscription","commits_url":"https://api.github.com/repos/mattmoor/serving/commits{/sha}","git_commits_url":"https://api.github.com/repos/mattmoor/serving/git/commits{/sha}","comments_url":"https://api.github.com/repos/mattmoor/serving/comments{/number}","issue_comment_url":"https://api.github.com/repos/mattmoor/serving/issues/comments{/number}","contents_url":"https://api.github.com/repos/mattmoor/serving/contents/{+path}","compare_url":"https://api.github.com/repos/mattmoor/serving/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mattmoor/serving/merges","archive_url":"https://api.github.com/repos/mattmoor/serving/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mattmoor/serving/downloads","issues_url":"https://api.github.com/repos/mattmoor/serving/issues{/number}","pulls_url":"https://api.github.com/repos/mattmoor/serving/pulls{/number}","milestones_url":"https://api.github.com/repos/mattmoor/serving/milestones{/number}","notifications_url":"https://api.github.com/repos/mattmoor/serving/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mattmoor/serving/labels{/name}","releases_url":"https://api.github.com/repos/mattmoor/serving/releases{/id}","deployments_url":"https://api.github.com/repos/mattmoor/serving/deployments","created_at":"2018-07-24T16:57:23Z","updated_at":"2018-07-24T16:57:25Z","pushed_at":"2018-08-21T14:35:47Z","git_url":"git://github.com/mattmoor/serving.git","ssh_url":"git@github.com:mattmoor/serving.git","clone_url":"https://github.com/mattmoor/serving.git","svn_url":"https://github.com/mattmoor/serving","homepage":"","size":21613,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"knative:master","ref":"master","sha":"d0c7aeebf2970092db4e599b027395b32a7f0aa0","user":{"login":"knative","id":35583233,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NTgzMjMz","avatar_url":"https://avatars2.githubusercontent.com/u/35583233?v=4","gravatar_id":"","url":"https://api.github.com/users/knative","html_url":"https://github.com/knative","followers_url":"https://api.github.com/users/knative/followers","following_url":"https://api.github.com/users/knative/following{/other_user}","gists_url":"https://api.github.com/users/knative/gists{/gist_id}","starred_url":"https://api.github.com/users/knative/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knative/subscriptions","organizations_url":"https://api.github.com/users/knative/orgs","repos_url":"https://api.github.com/users/knative/repos","events_url":"https://api.github.com/users/knative/events{/privacy}","received_events_url":"https://api.github.com/users/knative/received_events","type":"Organization","site_admin":false},"repo":{"id":118828329,"node_id":"MDEwOlJlcG9zaXRvcnkxMTg4MjgzMjk=","name":"serving","full_name":"knative/serving","owner":{"login":"knative","id":35583233,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NTgzMjMz","avatar_url":"https://avatars2.githubusercontent.com/u/35583233?v=4","gravatar_id":"","url":"https://api.github.com/users/knative","html_url":"https://github.com/knative","followers_url":"https://api.github.com/users/knative/followers","following_url":"https://api.github.com/users/knative/following{/other_user}","gists_url":"https://api.github.com/users/knative/gists{/gist_id}","starred_url":"https://api.github.com/users/knative/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knative/subscriptions","organizations_url":"https://api.github.com/users/knative/orgs","repos_url":"https://api.github.com/users/knative/repos","events_url":"https://api.github.com/users/knative/events{/privacy}","received_events_url":"https://api.github.com/users/knative/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/knative/serving","description":"Kubernetes-based, scale-to-zero, request-driven compute","fork":false,"url":"https://api.github.com/repos/knative/serving","forks_url":"https://api.github.com/repos/knative/serving/forks","keys_url":"https://api.github.com/repos/knative/serving/keys{/key_id}","collaborators_url":"https://api.github.com/repos/knative/serving/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/knative/serving/teams","hooks_url":"https://api.github.com/repos/knative/serving/hooks","issue_events_url":"https://api.github.com/repos/knative/serving/issues/events{/number}","events_url":"https://api.github.com/repos/knative/serving/events","assignees_url":"https://api.github.com/repos/knative/serving/assignees{/user}","branches_url":"https://api.github.com/repos/knative/serving/branches{/branch}","tags_url":"https://api.github.com/repos/knative/serving/tags","blobs_url":"https://api.github.com/repos/knative/serving/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/knative/serving/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/knative/serving/git/refs{/sha}","trees_url":"https://api.github.com/repos/knative/serving/git/trees{/sha}","statuses_url":"https://api.github.com/repos/knative/serving/statuses/{sha}","languages_url":"https://api.github.com/repos/knative/serving/languages","stargazers_url":"https://api.github.com/repos/knative/serving/stargazers","contributors_url":"https://api.github.com/repos/knative/serving/contributors","subscribers_url":"https://api.github.com/repos/knative/serving/subscribers","subscription_url":"https://api.github.com/repos/knative/serving/subscription","commits_url":"https://api.github.com/repos/knative/serving/commits{/sha}","git_commits_url":"https://api.github.com/repos/knative/serving/git/commits{/sha}","comments_url":"https://api.github.com/repos/knative/serving/comments{/number}","issue_comment_url":"https://api.github.com/repos/knative/serving/issues/comments{/number}","contents_url":"https://api.github.com/repos/knative/serving/contents/{+path}","compare_url":"https://api.github.com/repos/knative/serving/compare/{base}...{head}","merges_url":"https://api.github.com/repos/knative/serving/merges","archive_url":"https://api.github.com/repos/knative/serving/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/knative/serving/downloads","issues_url":"https://api.github.com/repos/knative/serving/issues{/number}","pulls_url":"https://api.github.com/repos/knative/serving/pulls{/number}","milestones_url":"https://api.github.com/repos/knative/serving/milestones{/number}","notifications_url":"https://api.github.com/repos/knative/serving/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/knative/serving/labels{/name}","releases_url":"https://api.github.com/repos/knative/serving/releases{/id}","deployments_url":"https://api.github.com/repos/knative/serving/deployments","created_at":"2018-01-24T22:07:44Z","updated_at":"2018-08-21T15:28:06Z","pushed_at":"2018-08-21T15:27:59Z","git_url":"git://github.com/knative/serving.git","ssh_url":"git@github.com:knative/serving.git","clone_url":"https://github.com/knative/serving.git","svn_url":"https://github.com/knative/serving","homepage":"","size":21554,"stargazers_count":640,"watchers_count":640,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":88,"mirror_url":null,"archived":false,"open_issues_count":328,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":88,"open_issues":328,"watchers":640,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/knative/serving/pulls/1906"},"html":{"href":"https://github.com/knative/serving/pull/1906"},"issue":{"href":"https://api.github.com/repos/knative/serving/issues/1906"},"comments":{"href":"https://api.github.com/repos/knative/serving/issues/1906/comments"},"review_comments":{"href":"https://api.github.com/repos/knative/serving/pulls/1906/comments"},"review_comment":{"href":"https://api.github.com/repos/knative/serving/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/knative/serving/pulls/1906/commits"},"statuses":{"href":"https://api.github.com/repos/knative/serving/statuses/636902a8e1c9719bacdeda54db3d2c4dc4f665e0"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"mattmoor"}}