Kuadrant / Kuadrant/kuadrant-console-plugin

HTTPRoute edit form drops weighted backendRefs, timeouts and other rule fields on save

Open
#835 1 comment 0 reactions 0 assignees View on GitHub
triage/needs-triage
Dominant language
TypeScript
Stars
10
Forks
65
Avg merge
2d 8h
Merged PRs (30d)
44

Description

**Describe the bug**

Editing an existing HTTPRoute through the form view and saving it silently removes parts of the spec that the form doesn't know about. I noticed this with a route that had two weighted backends for a canary split: after opening it in the edit page and saving, only the first backend was left and the weights were gone.

Looking at `src/components/httproute/HTTPRouteCreatePage.tsx`, the form only models one backend per rule. When it loads a route it reads just `rule.backendRefs[0].name` and `rule.backendRefs[0].port` (around line 214), and when it writes YAML back it emits a single `backendRefs` entry with only `name` and `port` (around line 170). Nothing else on the rule is carried through.

As far as I can tell these all get dropped on save:

- any backendRef after the first one, and `weight` on all of them
- `kind`, `group`, `namespace` and per-backend `filters` on backendRefs
- rule-level `timeouts`, `retry`, `sessionPersistence` and `name`

**To Reproduce**

1. Create a route with two weighted backends and a timeout:

```yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: canary-route
namespace: default
spec:
parentRefs:
- name: my-gateway
hostnames:
- canary.example.com
rules:
- matches:
- path:
type: PathPrefix
value: /api
timeouts:
request: 10s
backendRefs:
- name: api-v1
port: 8080
weight: 90
- name: api-v2
port: 8080
weight: 10
```

2. In the console go to the HTTPRoute, choose Edit, leave the form as it is and click Save.
3. `kubectl get httproute canary-route -o yaml`

**Expected behavior**

Fields the form doesn't have UI for should survive an edit unchanged. If that's not practical, the edit page should at least warn that the route contains fields the form can't represent and point the user to the YAML view instead of quietly rewriting the spec.

**Actual behavior**

The saved route has one backendRef (`api-v1`, port 8080, no weight) and no `timeouts` block. There is no warning or indication that anything was removed.

**Additional context**

- `spec.parentRefs`, `hostnames`, matches and filters do round-trip correctly, so this is specific to rule-level fields and backendRefs.
- The Gateway edit form doesn't have this problem for listeners (TLS, options, allowedRoutes are all preserved), so the HTTPRoute form is the odd one out.
- #692 fixed a few other gaps in this form (sectionName being dropped, missing methods) but didn't cover backendRefs or the rule-level fields.

Contributor guide

Open the contributing guide

Research direction

Start in src/components/httproute/HTTPRouteCreatePage.tsx, inspecting the route-loading logic around line 214 and YAML generation around line 170. Reproduce the issue with the weighted canary HTTPRoute and compare kubectl output before and after saving. Done means unsupported backendRef and rule-level fields survive unchanged, or the edit page warns users to use the YAML view.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, typescript
Domain
frontend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.