Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X-kuadrant section is not required #96

Open
pehala opened this issue Jun 28, 2024 · 0 comments
Open

X-kuadrant section is not required #96

pehala opened this issue Jun 28, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@pehala
Copy link

pehala commented Jun 28, 2024

Version: 0.2.4-alpha
If you use OAS from previous version (x-kuadrant), the x-kuadrant section will be missing and thus is will generate invalid HTTPRoute without name, which will get rejected by Kubernetes Server. Correct behaviour would be to make x-kuadrant section required and throw error in OAS parsing.

Current behavior makes it hard to deduce what is wrong.

apply returned an error: error: error when retrieving current configuration of:
Resource: "gateway.networking.k8s.io/v1, Resource=httproutes", GroupVersionKind: "gateway.networking.k8s.io/v1, Kind=HTTPRoute"
Name: "", Namespace: "kuadrant"
from server for: "STDIN": resource name may not be empty

Reproducer:

Input:

info:
  title: Httpbin
  version: 0.0.51
  x-kuadrant:
    route:
      hostnames:
      - hostname-phala--qwvt.test.com
      name: route-phala--b6zk
      parentRefs:
      - group: gateway.networking.k8s.io
        kind: Gateway
        name: gw-phala--dnfu
        namespace: kuadrant
openapi: 3.1.0
paths:
  /anything:
    get:
      operationId: get_anything
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
          description: Successful Response
    put:
      operationId: put_anything
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
          description: Successful Response
  /get:
    get:
      operationId: get_get
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
          description: Successful Response

Output:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  creationTimestamp: null
spec:
  rules:
  - backendRefs:
    - group: ""
      kind: Service
      name: httpbin-phala--cxfq
      namespace: kuadrant
      port: 8080
    matches:
    - method: GET
      path:
        type: Exact
        value: /get
    matches:
    - method: GET
      path:
        type: Exact
        value: /anything
    matches:
    - method: PUT
      path:
        type: Exact
        value: /anything
status:
  parents: null
@pehala pehala added the enhancement New feature or request label Jun 28, 2024
@pehala pehala added this to Kuadrant Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

1 participant