solo-io / gloo-portal-issues

Public tracker for issues related to Gloo Portal
https://docs.solo.io/gloo-portal/latest/
1 stars 3 forks source link

APIProduct's route field unknown #4

Closed asaintsever closed 3 years ago

asaintsever commented 4 years ago

Env

Issue

Try deploy APIProduct below:

apiVersion: devportal.solo.io/v1alpha1
kind: APIProduct
metadata:
  name: app-ns1-product
spec:
  apis:
  - apiDoc:
      name: petstore-schema
      namespace: app-ns1
    openApi:
      operations:
      - id: addPet
        route:
          inlineRoute:
            backends:
            - kube:
                name: petstore
                namespace: app-ns1
                port: 8080
      - id: deletePet
        route:
          inlineRoute:
            backends:
            - kube:
                name: petstore
                namespace: app-ns1
                port: 8080
      - id: findPetById
        route:
          inlineRoute:
            backends:
            - kube:
                name: petstore
                namespace: app-ns1
                port: 8080
      - id: findPets
        route:
          inlineRoute:
            backends:
            - kube:
                name: petstore
                namespace: app-ns1
                port: 8080

  displayInfo:
    title: "Talend App NS1 product"
    description: "APIs from Talend App NS1"
    version: "1"

  domains:
  - api.app-ns1.com

  publishRoutes: true

It will fail with error (log from dev-portal pod):

2020-09-15T08:23:09.227Z    ERROR   pkg/mod/k8s.io/client-go@v0.17.1/tools/cache/reflector.go:105: Failed to list *v1alpha1.APIProduct: v1alpha1.APIProductList.ListMeta: v1.ListMeta.TypeMeta: Kind: Items: []v1alpha1.APIProduct: v1alpha1.APIProduct.Spec: unmarshalerDecoder: unknown field "route" in v1alpha1.OpenAPIOperationSelector_OpenAPIOperation, error found in #10 byte of ...|tes":true}}],"kind":|..., bigger context ...|domains":["api.app-ns1.com"],"publishRoutes":true}}],"kind":"APIProductList","metadata":{"continue":|...
k8s.io/klog.ErrorDepth
    /go/pkg/mod/github.com/stefanprodan/klog@v0.0.0-20190418165334-9cbb78b20423/klog.go:218
k8s.io/apimachinery/pkg/util/runtime.logError
    /go/pkg/mod/k8s.io/apimachinery@v0.17.1/pkg/util/runtime/runtime.go:114
k8s.io/apimachinery/pkg/util/runtime.HandleError
    /go/pkg/mod/k8s.io/apimachinery@v0.17.1/pkg/util/runtime/runtime.go:108
k8s.io/client-go/tools/cache.(*Reflector).Run.func1
    /go/pkg/mod/k8s.io/client-go@v0.17.1/tools/cache/reflector.go:153
k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1
    /go/pkg/mod/k8s.io/apimachinery@v0.17.1/pkg/util/wait/wait.go:152
k8s.io/apimachinery/pkg/util/wait.JitterUntil
    /go/pkg/mod/k8s.io/apimachinery@v0.17.1/pkg/util/wait/wait.go:153
k8s.io/apimachinery/pkg/util/wait.Until
    /go/pkg/mod/k8s.io/apimachinery@v0.17.1/pkg/util/wait/wait.go:88
k8s.io/client-go/tools/cache.(*Reflector).Run
    /go/pkg/mod/k8s.io/client-go@v0.17.1/tools/cache/reflector.go:151
k8s.io/apimachinery/pkg/util/wait.(*Group).StartWithChannel.func1
    /go/pkg/mod/k8s.io/apimachinery@v0.17.1/pkg/util/wait/wait.go:54
k8s.io/apimachinery/pkg/util/wait.(*Group).Start.func1
    /go/pkg/mod/k8s.io/apimachinery@v0.17.1/pkg/util/wait/wait.go:71

This route field is documented here: https://docs.solo.io/dev-portal/latest/reference/api/apiproduct/#openapioperationselector-openapioperation

marcogschmidt commented 4 years ago

Hi @asaintsever, the API reference docs seem to be out-of-date, sorry about that. We are currently working on improving the docs site to fix this and other issues.

In the meantime, this is the new format to specify inline route information:

apiVersion: devportal.solo.io/v1alpha1
kind: APIProduct
metadata:
  name: app-ns1-product
spec:
  apis:
  - apiDoc:
      name: petstore-schema
      namespace: app-ns1
    openApi:
      operations:
      - id: addPet
        gatewayConfig:
          route:
            inlineRoute:
              backends:
              - kube:
                  name: petstore
                  namespace: app-ns1
                  port: 8080
# ...
asaintsever commented 4 years ago

Works fine. Thanks!

marcogschmidt commented 4 years ago

We are working on fixing the generation of the API reference docs. I will close this issue once that is done.