Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-74572

OpenAPI v2 -> v3 conversion for aggregated apiserver: Broken $ref links in components/parameters

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • 4.20
    • kube-apiserver
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • Moderate
    • None
    • x86_64
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      When accessing the OpenAPI v3 spec path for OCP Virtualization subresources  (e.g., via /openapi/v3/apis/subresources.kubevirt.io/v1 (aggregated api server - only open api v2 spec is provided, the v2 -> v3 conversion is done probably by kube-aggregator)), the resulting manifest contains invalid references. Specifically, the paths section uses $ref to point to parameters in components.parameters., but the components.parameters section is entirely missing from the document.
      
      The /openapi/v2 output remains valid, suggesting an issue with how the Kubernetes API server aggregates or converts the v2 definitions into v3.
      I created example aggregated api - https://github.com/ksimon1/aggregated-api, just to reproduce the behaviour and it hits the same issue.

      Version-Release number of selected component (if applicable):

          4.20

      How reproducible:

          100%

      Steps to Reproduce:

          1.Deploy Kubevirt or OCP Virtualization or the reproducer https://github.com/ksimon1/aggregated-api - I can help with that
          2.Access <cluster-api>/openapi/v3/apis/subresources.kubevirt.io/ e.g. with curl -i -H "Accept: application/json, application/yaml" -H "Content-type: application/json" -v --request GET -k --header "Authorization: Bearer <token>" "https://<api-url>/openapi/v3/apis/subresources.kubevirt.io/v1" 
          OR
          oc get --raw /openapi/v2 > apiv2
          oc get --raw /openapi/v3/apis/example.aggregated.io/v1 > apiv3
           3.Generated manifest does not contain parameters component. So the parameters in paths are pointing to nowhere
          

      Actual results:

          Returned V3 open api manifest does not contains parameters component which makes parameters $ref unresolvable

      Expected results:

          Returned V3 open api manifest does contains parameters component, which makes the $ref resolvable

      Additional info:

          

              Unassigned Unassigned
              ksimon@redhat.com Karel Simon
              None
              None
              Ke Wang Ke Wang
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: