Bug 2030697

Summary: api request counts for current hour are incorrect
Product: OpenShift Container Platform Reporter: OpenShift BugZilla Robot <openshift-bugzilla-robot>
Component: kube-apiserverAssignee: Luis Sanchez <sanchezl>
Status: CLOSED ERRATA QA Contact: Ke Wang <kewang>
Severity: high Docs Contact:
Priority: high    
Version: 4.8CC: andbartl, aos-bugs, mfojtik, oarribas, wking, xxia
Target Milestone: ---Keywords: FastFix
Target Release: 4.9.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2032325 (view as bug list) Environment:
Last Closed: 2022-01-04 18:41:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2021629    
Bug Blocks: 2032325    

Comment 1 Ke Wang 2021-12-13 15:29:48 UTC
1. On a 4.9 cluster launched by bot with the PR, use a deprecated API,
$ oc get clusterversion
NAME      VERSION                                                  AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.9.0-0.ci.test-2021-12-13-111902-ci-ln-yjsq6b2-latest   True        False         10m     Cluster version is 4.9.0-0.ci.test-2021-12-13-111902-ci-ln-yjsq6b2-latest

2. Get current apirequestcount of horizontalpodautoscalers.v2beta1.autoscaling:
$ oc get apirequestcount/horizontalpodautoscalers.v2beta1.autoscaling
NAME                                           REMOVEDINRELEASE   REQUESTSINCURRENTHOUR   REQUESTSINLAST24H
horizontalpodautoscalers.v2beta1.autoscaling                      1                       4

3. Try to access the deprecated API horizontalpodautoscalers.v2beta1.autoscaling ...
$ oc get horizontalpodautoscalers.v2beta1.autoscaling
W1213 20:08:53.430912 1614951 warnings.go:70] autoscaling/v2beta1 HorizontalPodAutoscaler is deprecated in v1.22+, unavailable in v1.25+; use autoscaling/v2beta2 HorizontalPodAutoscaler
No resources found in default namespace.

----------------------------------
4. After 1 hour(s) later, check the deprecated apirequestcount of horizontalpodautoscalers.v2beta1.autoscaling, no longer has count > 0 for the deprecated API.
$ oc get apirequestcount/horizontalpodautoscalers.v2beta1.autoscaling
NAME                                           REMOVEDINRELEASE   REQUESTSINCURRENTHOUR   REQUESTSINLAST24H
horizontalpodautoscalers.v2beta1.autoscaling                      0                       12

----------------------------------
After 2 hour(s) later, check the deprecated apirequestcount of horizontalpodautoscalers.v2beta1.autoscaling ...
$ oc get apirequestcount/horizontalpodautoscalers.v2beta1.autoscaling
NAME                                           REMOVEDINRELEASE   REQUESTSINCURRENTHOUR   REQUESTSINLAST24H
horizontalpodautoscalers.v2beta1.autoscaling                      0                       20

----------------------------------
5. Delete apiresourcecounts/horizontalpodautoscalers.v2beta1.autoscaling . Observe that it does not get recreated. (wait at least 5 min)
Mon 13 Dec 2021 10:09:04 PM CST
$ oc delete apirequestcount/horizontalpodautoscalers.v2beta1.autoscaling
apirequestcount.apiserver.openshift.io "horizontalpodautoscalers.v2beta1.autoscaling" deleted

Mon 13 Dec 2021 10:19:05 PM CST
Waiting 10 mins, check horizontalpodautoscalers.v2beta1.autoscaling again,
$ oc get apirequestcount | grep "horizontalpodautoscalers.v2beta1.autoscaling"
horizontalpodautoscalers.v2beta1.autoscaling                      1                       1

6. Invoke the deprecated API again and confirm apirequestcount/horizontalpodautoscalers.v2beta1.autoscaling gets recreated.
Mon 13 Dec 2021 10:19:11 PM CST
NAME                                           REMOVEDINRELEASE   REQUESTSINCURRENTHOUR   REQUESTSINLAST24H
$ oc get apirequestcount/horizontalpodautoscalers.v2beta1.autoscaling
horizontalpodautoscalers.v2beta1.autoscaling                      1                       1

Above step 4 and 5 doesn't as expected.

Comment 2 Luis Sanchez 2021-12-13 16:25:41 UTC
@kewang 

Looks good. The horizontalpodautoscalers.v2beta1.autoscaling API, while deprecated, is still in use:

  - In step 2, we see that the API, though deprecated, is in use by someone.
  - In step 3, we see that the API will not be removed for another 3 releases, so it's OK that someone is using it.[1]
  - In step 6, most likely whoever was using the API as shown in step 2, is still using it. 

As such, your verification results are as expected for the horizontalpodautoscalers.v2beta1.autoscaling API.

Comment 7 errata-xmlrpc 2022-01-04 18:41:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.9.12 bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:5214