|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * updating/updating-cluster-prepare.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="update-preparing-evaluate-apirequestcount_{context}"] |
| 7 | += Using APIRequestCount to identify uses of removed APIs |
| 8 | + |
| 9 | +You can use the `APIRequestCount` API to track API requests and review whether any of them are using one of the removed APIs. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* You must have access to the cluster as a user with the `cluster-admin` role. |
| 14 | +
|
| 15 | +.Procedure |
| 16 | + |
| 17 | +* Run the following command and examine the `REMOVEDINRELEASE` column of the output to identify the removed APIs that are currently in use: |
| 18 | ++ |
| 19 | +[source,terminal] |
| 20 | +---- |
| 21 | +$ oc get apirequestcounts |
| 22 | +---- |
| 23 | ++ |
| 24 | +.Example output |
| 25 | +[source,terminal] |
| 26 | +---- |
| 27 | +NAME REMOVEDINRELEASE REQUESTSINCURRENTHOUR REQUESTSINLAST24H |
| 28 | +... |
| 29 | +poddisruptionbudgets.v1.policy 391 8114 |
| 30 | +poddisruptionbudgets.v1beta1.policy 1.25 2 23 |
| 31 | +podmonitors.v1.monitoring.coreos.com 3 70 |
| 32 | +podnetworkconnectivitychecks.v1alpha1.controlplane.operator.openshift.io 612 11748 |
| 33 | +pods.v1 1531 38634 |
| 34 | +podsecuritypolicies.v1beta1.policy 1.25 3 39 |
| 35 | +podtemplates.v1 2 79 |
| 36 | +preprovisioningimages.v1alpha1.metal3.io 2 39 |
| 37 | +priorityclasses.v1.scheduling.k8s.io 12 248 |
| 38 | +prioritylevelconfigurations.v1beta1.flowcontrol.apiserver.k8s.io 1.26 3 86 |
| 39 | +... |
| 40 | +---- |
| 41 | ++ |
| 42 | +[IMPORTANT] |
| 43 | +==== |
| 44 | +You can safely ignore the following entries that appear in the results: |
| 45 | +
|
| 46 | +* The `system:serviceaccount:kube-system:generic-garbage-collector` and the `system:serviceaccount:kube-system:namespace-controller` users might appear in the results because these services invoke all registered APIs when searching for resources to remove. |
| 47 | +* The `system:kube-controller-manager` and `system:cluster-policy-controller` users might appear in the results because they walk through all resources while enforcing various policies. |
| 48 | +==== |
| 49 | ++ |
| 50 | +You can also use `-o jsonpath` to filter the results: |
| 51 | ++ |
| 52 | +[source,terminal] |
| 53 | +---- |
| 54 | +$ oc get apirequestcounts -o jsonpath='{range .items[?(@.status.removedInRelease!="")]}{.status.removedInRelease}{"\t"}{.metadata.name}{"\n"}{end}' |
| 55 | +---- |
| 56 | ++ |
| 57 | +.Example output |
| 58 | +[source,terminal] |
| 59 | +---- |
| 60 | +1.26 flowschemas.v1beta1.flowcontrol.apiserver.k8s.io |
| 61 | +1.26 horizontalpodautoscalers.v2beta2.autoscaling |
| 62 | +1.25 poddisruptionbudgets.v1beta1.policy |
| 63 | +1.25 podsecuritypolicies.v1beta1.policy |
| 64 | +1.26 prioritylevelconfigurations.v1beta1.flowcontrol.apiserver.k8s.io |
| 65 | +---- |
0 commit comments