Kuadrant / Kuadrant/kuadrantctl

X-kuadrant section is not required

Open
#96 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
8
Forks
18
PR merge metrics
No merged PRs in 30d

Description

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:
```yaml
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:
```yaml
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
```

Contributor guide

Open the contributing guide

Research direction

Start with the OAS parsing path that consumes the x-kuadrant section and reproduce the missing-section case using the YAML in this issue. The work is done when an OAS without x-kuadrant is rejected with a clear parsing error before an invalid HTTPRoute is generated.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes, openapi
Domain
backend-api-design, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.