kubeshop / kusk-gateway

Kusk-gateway is an OpenAPI-driven API Gateway for Kubernetes
https://kubeshop.github.io/kusk-gateway/
MIT License
253 stars 21 forks source link

Kusk CLI parsing fails when there's no global upstream #886

Closed aabedraba closed 1 year ago

aabedraba commented 1 year ago

When applying an OpenAPI definition of a path that contains an upstream configuration, Kusk CLI fails to parse:

Example

openapi: 3.0.0
servers:
  - url: http://localhost:8080
info:
  title: simple-api
  version: 0.1.0
  description: A simple API example to test Kusk Gateway with
  license: 
    name: MIT
    url: https://github.com/kubeshop/kusk-gateway/blob/main/LICENSE
paths:
  /hello:
    x-kusk:
      upstream:
        service:
          name: hello-world-svc
          namespace: default
          port: 8080
    get:
      summary: Returns a Hello world to the user
      responses:
        '200':
          description: A simple hello world!
          content:
            application/json; charset=utf-8:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message

Command fail example:

kusk deploy -i openapi.yaml
❌ no upstream or mocking configuration found for path GET/hello
kylehodgetts commented 1 year ago

Closing as non-issue:

$ cat api.yaml

openapi: 3.0.0
servers:
  - url: http://localhost:8080
info:
  title: simple-api
  version: 0.1.0
  description: A simple API example to test Kusk Gateway with
  license:
    name: MIT
    url: https://github.com/kubeshop/kusk-gateway/blob/main/LICENSE
paths:
  /hello:
    x-kusk:
      upstream:
        service:
          name: hello-world-svc
          namespace: default
          port: 8080
    get:
      summary: Returns a Hello world to the user
      responses:
        '200':
          description: A simple hello world!
          content:
            application/json; charset=utf-8:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
$ kusk deploy -i api.yaml

🎉 successfully parsed api.yaml
✅ initiallizing deployment to fleet kusk-gateway-envoy-fleet
api.gateway.kusk.io/simple-api created