Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1883378

Summary: Openapi spec is missing for prometheus-adapter aggregated api-resources
Product: OpenShift Container Platform Reporter: Abhishek <aabhishe>
Component: MonitoringAssignee: Arunprasad Rajkumar <arajkuma>
Status: CLOSED ERRATA QA Contact: Junqi Zhao <juzhao>
Severity: low Docs Contact:
Priority: low    
Version: 4.6CC: anpicker, erooth, hongyli, juzhao, lcosic, pnair, spasquie
Target Milestone: ---Keywords: Reopened
Target Release: 4.9.0Flags: arajkuma: needinfo-
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-18 17:28:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 1 Junqi Zhao 2020-09-30 02:37:35 UTC
did not find podmetrics resource
# oc api-resources | grep podmetrics
no result

# oc api-resources | grep monitoring.coreos.com
alertmanagers                                          monitoring.coreos.com                 true         Alertmanager
podmonitors                                            monitoring.coreos.com                 true         PodMonitor
probes                                                 monitoring.coreos.com                 true         Probe
prometheuses                                           monitoring.coreos.com                 true         Prometheus
prometheusrules                                        monitoring.coreos.com                 true         PrometheusRule
servicemonitors                                        monitoring.coreos.com                 true         ServiceMonitor
thanosrulers                                           monitoring.coreos.com                 true         ThanosRuler

Comment 6 Junqi Zhao 2020-11-17 02:55:36 UTC
tested with 4.7.0-0.nightly-2020-11-16-070925, still reproduced
# oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.7.0-0.nightly-2020-11-16-070925   True        False         18h     Cluster version is 4.7.0-0.nightly-2020-11-16-070925

# oc api-resources --api-group=metrics.k8s.io
NAME    SHORTNAMES   APIGROUP         NAMESPACED   KIND
nodes                metrics.k8s.io   false        NodeMetrics
pods                 metrics.k8s.io   true         PodMetrics
# oc explain pods --api-version=metrics.k8s.io
error: couldn't find resource for "/metrics.k8s.io, Kind=Pod"
# oc explain PodMetrics
error: couldn't find resource for "metrics.k8s.io/v1beta1, Kind=PodMetrics"

Comment 11 Damien Grisonnet 2021-02-08 15:32:52 UTC
We recently fixed OpenAPI for custom and external metrics, but it's indeed still missing for resource metrics. That being said, we have higher high priority bugzillas to tackle this sprint and won't be able to allocate much time to this ticket.

For now I opened this upstream issue: https://github.com/kubernetes-sigs/prometheus-adapter/issues/369

Comment 16 Arunprasad Rajkumar 2021-07-29 06:51:21 UTC
All the necessary upstream PRs are merged and it will be rolled out as part of next prometheus-adapter. Hence closing this bug.

Comment 19 Junqi Zhao 2021-08-23 11:28:38 UTC
checked with 4.9.0-0.nightly-2021-08-22-070405, prometheus-operator version is 0.9.0, but no explanation for metadata and window
see the description for other resources, example
# oc explain configmaps
...
   metadata	<Object>
     Standard object's metadata. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
...
# oc api-resources --api-group=metrics.k8s.io
NAME    SHORTNAMES   APIVERSION               NAMESPACED   KIND
nodes                metrics.k8s.io/v1beta1   false        NodeMetrics
pods                 metrics.k8s.io/v1beta1   true         PodMetrics

# oc explain PodMetrics 
KIND:     PodMetrics
VERSION:  metrics.k8s.io/v1beta1

DESCRIPTION:
     PodMetrics sets resource usage metrics of a pod.

FIELDS:
   apiVersion	<string>
     APIVersion defines the versioned schema of this representation of an
     object. Servers should convert recognized schemas to the latest internal
     value, and may reject unrecognized values. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources

   containers	<[]Object> -required-
     Metrics for all containers are collected within the same time window.

   kind	<string>
     Kind is a string value representing the REST resource this object
     represents. Servers may infer this from the endpoint the client submits
     requests to. Cannot be updated. In CamelCase. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

   metadata	<Object>

   timestamp	<string> -required-
     The following fields define time interval from which metrics were collected
     from the interval [Timestamp-Window, Timestamp].

   window	<string> -required-

Comment 20 Junqi Zhao 2021-08-24 01:07:05 UTC
(In reply to Junqi Zhao from comment #19)
> checked with 4.9.0-0.nightly-2021-08-22-070405, prometheus-operator version
> is 0.9.0
typo, should be prometheus-adapter version is 0.9.0

Comment 21 Arunprasad Rajkumar 2021-08-26 17:54:05 UTC
(In reply to Junqi Zhao from comment #19)
> 
>    metadata	<Object>
> 

Agreed, it should be fixed in k8s upstream[1]., but I don't think we should hold this bug until we fix it in k8s upstream.

[1] https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/metrics/pkg/apis/metrics/v1beta1/types.go#L33

>    timestamp	<string> -required-
>      The following fields define time interval from which metrics were
> collected
>      from the interval [Timestamp-Window, Timestamp].
> 
>    window	<string> -required-

Description for "timestamp" field describes about "window" as well. So the description should be collectively interpreted.

Comment 29 errata-xmlrpc 2021-10-18 17:28:52 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 (Moderate: OpenShift Container Platform 4.9.0 bug fix and security 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/RHSA-2021:3759