Disable P&F for watch requests
Kubernetes-commit: 763e6d1dbb6371c66b62e4ea4c1fcbee1c113bda
This commit is contained in:
		
							parent
							
								
									a5bd3b4739
								
							
						
					
					
						commit
						f578e7708d
					
				|  | @ -41,6 +41,12 @@ const ( | |||
| ) | ||||
| 
 | ||||
| func (e *mutatingWorkEstimator) estimate(r *http.Request) WorkEstimate { | ||||
| 	// TODO(wojtekt): Remove once we tune the algorithm to not fail
 | ||||
| 	// scalability tests.
 | ||||
| 	return WorkEstimate{ | ||||
| 		InitialSeats: 1, | ||||
| 	} | ||||
| 
 | ||||
| 	requestInfo, ok := apirequest.RequestInfoFrom(r.Context()) | ||||
| 	if !ok { | ||||
| 		// no RequestInfo should never happen, but to be on the safe side
 | ||||
|  | @ -51,7 +57,6 @@ func (e *mutatingWorkEstimator) estimate(r *http.Request) WorkEstimate { | |||
| 			AdditionalLatency: eventAdditionalDuration, | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	watchCount := e.countFn(requestInfo) | ||||
| 
 | ||||
| 	// The cost of the request associated with the watchers of that event
 | ||||
|  |  | |||
|  | @ -252,132 +252,136 @@ func TestWorkEstimator(t *testing.T) { | |||
| 			countErr:             errors.New("unknown error"), | ||||
| 			initialSeatsExpected: maximumSeats, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:       "request verb is create, no watches", | ||||
| 			requestURI: "http://server/apis/foo.bar/v1/foos", | ||||
| 			requestInfo: &apirequest.RequestInfo{ | ||||
| 				Verb:     "create", | ||||
| 				APIGroup: "foo.bar", | ||||
| 				Resource: "foos", | ||||
| 		// TODO(wojtekt): Reenable these tests after tuning algorithm to
 | ||||
| 		// not fail scalability tests.
 | ||||
| 		/* | ||||
| 			{ | ||||
| 				name:       "request verb is create, no watches", | ||||
| 				requestURI: "http://server/apis/foo.bar/v1/foos", | ||||
| 				requestInfo: &apirequest.RequestInfo{ | ||||
| 					Verb:     "create", | ||||
| 					APIGroup: "foo.bar", | ||||
| 					Resource: "foos", | ||||
| 				}, | ||||
| 				initialSeatsExpected:      1, | ||||
| 				finalSeatsExpected:        0, | ||||
| 				additionalLatencyExpected: 0, | ||||
| 			}, | ||||
| 			initialSeatsExpected:      1, | ||||
| 			finalSeatsExpected:        0, | ||||
| 			additionalLatencyExpected: 0, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:       "request verb is create, watches registered", | ||||
| 			requestURI: "http://server/apis/foo.bar/v1/foos", | ||||
| 			requestInfo: &apirequest.RequestInfo{ | ||||
| 				Verb:     "create", | ||||
| 				APIGroup: "foo.bar", | ||||
| 				Resource: "foos", | ||||
| 			{ | ||||
| 				name:       "request verb is create, watches registered", | ||||
| 				requestURI: "http://server/apis/foo.bar/v1/foos", | ||||
| 				requestInfo: &apirequest.RequestInfo{ | ||||
| 					Verb:     "create", | ||||
| 					APIGroup: "foo.bar", | ||||
| 					Resource: "foos", | ||||
| 				}, | ||||
| 				watchCount:                29, | ||||
| 				initialSeatsExpected:      1, | ||||
| 				finalSeatsExpected:        3, | ||||
| 				additionalLatencyExpected: 5 * time.Millisecond, | ||||
| 			}, | ||||
| 			watchCount:                29, | ||||
| 			initialSeatsExpected:      1, | ||||
| 			finalSeatsExpected:        3, | ||||
| 			additionalLatencyExpected: 5 * time.Millisecond, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:       "request verb is create, watches registered, no additional latency", | ||||
| 			requestURI: "http://server/apis/foo.bar/v1/foos", | ||||
| 			requestInfo: &apirequest.RequestInfo{ | ||||
| 				Verb:     "create", | ||||
| 				APIGroup: "foo.bar", | ||||
| 				Resource: "foos", | ||||
| 			{ | ||||
| 				name:       "request verb is create, watches registered, no additional latency", | ||||
| 				requestURI: "http://server/apis/foo.bar/v1/foos", | ||||
| 				requestInfo: &apirequest.RequestInfo{ | ||||
| 					Verb:     "create", | ||||
| 					APIGroup: "foo.bar", | ||||
| 					Resource: "foos", | ||||
| 				}, | ||||
| 				watchCount:                5, | ||||
| 				initialSeatsExpected:      1, | ||||
| 				finalSeatsExpected:        0, | ||||
| 				additionalLatencyExpected: 0, | ||||
| 			}, | ||||
| 			watchCount:                5, | ||||
| 			initialSeatsExpected:      1, | ||||
| 			finalSeatsExpected:        0, | ||||
| 			additionalLatencyExpected: 0, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:       "request verb is create, watches registered, maximum is exceeded", | ||||
| 			requestURI: "http://server/apis/foo.bar/v1/foos", | ||||
| 			requestInfo: &apirequest.RequestInfo{ | ||||
| 				Verb:     "create", | ||||
| 				APIGroup: "foo.bar", | ||||
| 				Resource: "foos", | ||||
| 			{ | ||||
| 				name:       "request verb is create, watches registered, maximum is exceeded", | ||||
| 				requestURI: "http://server/apis/foo.bar/v1/foos", | ||||
| 				requestInfo: &apirequest.RequestInfo{ | ||||
| 					Verb:     "create", | ||||
| 					APIGroup: "foo.bar", | ||||
| 					Resource: "foos", | ||||
| 				}, | ||||
| 				watchCount:                199, | ||||
| 				initialSeatsExpected:      1, | ||||
| 				finalSeatsExpected:        20, | ||||
| 				additionalLatencyExpected: 5 * time.Millisecond, | ||||
| 			}, | ||||
| 			watchCount:                199, | ||||
| 			initialSeatsExpected:      1, | ||||
| 			finalSeatsExpected:        20, | ||||
| 			additionalLatencyExpected: 5 * time.Millisecond, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:       "request verb is update, no watches", | ||||
| 			requestURI: "http://server/apis/foo.bar/v1/foos/myfoo", | ||||
| 			requestInfo: &apirequest.RequestInfo{ | ||||
| 				Verb:     "update", | ||||
| 				APIGroup: "foo.bar", | ||||
| 				Resource: "foos", | ||||
| 			{ | ||||
| 				name:       "request verb is update, no watches", | ||||
| 				requestURI: "http://server/apis/foo.bar/v1/foos/myfoo", | ||||
| 				requestInfo: &apirequest.RequestInfo{ | ||||
| 					Verb:     "update", | ||||
| 					APIGroup: "foo.bar", | ||||
| 					Resource: "foos", | ||||
| 				}, | ||||
| 				initialSeatsExpected:      1, | ||||
| 				finalSeatsExpected:        0, | ||||
| 				additionalLatencyExpected: 0, | ||||
| 			}, | ||||
| 			initialSeatsExpected:      1, | ||||
| 			finalSeatsExpected:        0, | ||||
| 			additionalLatencyExpected: 0, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:       "request verb is update, watches registered", | ||||
| 			requestURI: "http://server/apis/foor.bar/v1/foos/myfoo", | ||||
| 			requestInfo: &apirequest.RequestInfo{ | ||||
| 				Verb:     "update", | ||||
| 				APIGroup: "foo.bar", | ||||
| 				Resource: "foos", | ||||
| 			{ | ||||
| 				name:       "request verb is update, watches registered", | ||||
| 				requestURI: "http://server/apis/foor.bar/v1/foos/myfoo", | ||||
| 				requestInfo: &apirequest.RequestInfo{ | ||||
| 					Verb:     "update", | ||||
| 					APIGroup: "foo.bar", | ||||
| 					Resource: "foos", | ||||
| 				}, | ||||
| 				watchCount:                29, | ||||
| 				initialSeatsExpected:      1, | ||||
| 				finalSeatsExpected:        3, | ||||
| 				additionalLatencyExpected: 5 * time.Millisecond, | ||||
| 			}, | ||||
| 			watchCount:                29, | ||||
| 			initialSeatsExpected:      1, | ||||
| 			finalSeatsExpected:        3, | ||||
| 			additionalLatencyExpected: 5 * time.Millisecond, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:       "request verb is patch, no watches", | ||||
| 			requestURI: "http://server/apis/foo.bar/v1/foos/myfoo", | ||||
| 			requestInfo: &apirequest.RequestInfo{ | ||||
| 				Verb:     "patch", | ||||
| 				APIGroup: "foo.bar", | ||||
| 				Resource: "foos", | ||||
| 			{ | ||||
| 				name:       "request verb is patch, no watches", | ||||
| 				requestURI: "http://server/apis/foo.bar/v1/foos/myfoo", | ||||
| 				requestInfo: &apirequest.RequestInfo{ | ||||
| 					Verb:     "patch", | ||||
| 					APIGroup: "foo.bar", | ||||
| 					Resource: "foos", | ||||
| 				}, | ||||
| 				initialSeatsExpected:      1, | ||||
| 				finalSeatsExpected:        0, | ||||
| 				additionalLatencyExpected: 0, | ||||
| 			}, | ||||
| 			initialSeatsExpected:      1, | ||||
| 			finalSeatsExpected:        0, | ||||
| 			additionalLatencyExpected: 0, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:       "request verb is patch, watches registered", | ||||
| 			requestURI: "http://server/apis/foo.bar/v1/foos/myfoo", | ||||
| 			requestInfo: &apirequest.RequestInfo{ | ||||
| 				Verb:     "patch", | ||||
| 				APIGroup: "foo.bar", | ||||
| 				Resource: "foos", | ||||
| 			{ | ||||
| 				name:       "request verb is patch, watches registered", | ||||
| 				requestURI: "http://server/apis/foo.bar/v1/foos/myfoo", | ||||
| 				requestInfo: &apirequest.RequestInfo{ | ||||
| 					Verb:     "patch", | ||||
| 					APIGroup: "foo.bar", | ||||
| 					Resource: "foos", | ||||
| 				}, | ||||
| 				watchCount:                29, | ||||
| 				initialSeatsExpected:      1, | ||||
| 				finalSeatsExpected:        3, | ||||
| 				additionalLatencyExpected: 5 * time.Millisecond, | ||||
| 			}, | ||||
| 			watchCount:                29, | ||||
| 			initialSeatsExpected:      1, | ||||
| 			finalSeatsExpected:        3, | ||||
| 			additionalLatencyExpected: 5 * time.Millisecond, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:       "request verb is delete, no watches", | ||||
| 			requestURI: "http://server/apis/foo.bar/v1/foos/myfoo", | ||||
| 			requestInfo: &apirequest.RequestInfo{ | ||||
| 				Verb:     "delete", | ||||
| 				APIGroup: "foo.bar", | ||||
| 				Resource: "foos", | ||||
| 			{ | ||||
| 				name:       "request verb is delete, no watches", | ||||
| 				requestURI: "http://server/apis/foo.bar/v1/foos/myfoo", | ||||
| 				requestInfo: &apirequest.RequestInfo{ | ||||
| 					Verb:     "delete", | ||||
| 					APIGroup: "foo.bar", | ||||
| 					Resource: "foos", | ||||
| 				}, | ||||
| 				initialSeatsExpected:      1, | ||||
| 				finalSeatsExpected:        0, | ||||
| 				additionalLatencyExpected: 0, | ||||
| 			}, | ||||
| 			initialSeatsExpected:      1, | ||||
| 			finalSeatsExpected:        0, | ||||
| 			additionalLatencyExpected: 0, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:       "request verb is delete, watches registered", | ||||
| 			requestURI: "http://server/apis/foo.bar/v1/foos/myfoo", | ||||
| 			requestInfo: &apirequest.RequestInfo{ | ||||
| 				Verb:     "delete", | ||||
| 				APIGroup: "foo.bar", | ||||
| 				Resource: "foos", | ||||
| 			{ | ||||
| 				name:       "request verb is delete, watches registered", | ||||
| 				requestURI: "http://server/apis/foo.bar/v1/foos/myfoo", | ||||
| 				requestInfo: &apirequest.RequestInfo{ | ||||
| 					Verb:     "delete", | ||||
| 					APIGroup: "foo.bar", | ||||
| 					Resource: "foos", | ||||
| 				}, | ||||
| 				watchCount:                29, | ||||
| 				initialSeatsExpected:      1, | ||||
| 				finalSeatsExpected:        3, | ||||
| 				additionalLatencyExpected: 5 * time.Millisecond, | ||||
| 			}, | ||||
| 			watchCount:                29, | ||||
| 			initialSeatsExpected:      1, | ||||
| 			finalSeatsExpected:        3, | ||||
| 			additionalLatencyExpected: 5 * time.Millisecond, | ||||
| 		}, | ||||
| 		*/ | ||||
| 	} | ||||
| 
 | ||||
| 	for _, test := range tests { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue