apps API: Accept with protobuf first and JSON as a fallback gets 406 instead of JSON
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with TestAppsAPIContentNegotiation in pkg/cmd/server/apiserver_surface_test.go, then trace the apps API serializer setup in pkg/apiserver and how it advertises media types. The issue leaves the behavior open pending a maintainer decision, so first confirm which option is accepted; done means the test and API negotiation match that decision, including the protobuf-only client case.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
A client that prefers protobuf and accepts JSON as a fallback gets 406 Not Acceptable from the apps API instead of a JSON answer. GET on an Application with Accept: application/vnd.kubernetes.protobuf, application/json;q=0.9 returns 406. With application/cbor, application/json;q=0.9 the same request returns JSON. TestAppsAPIContentNegotiation in pkg/cmd/server/apiserver_surface_test.go (#4869) pins both answers as they are today.
The cause is that the apps API advertises a media type it cannot encode. pkg/apiserver serves through serializer.NewCodecFactory(Scheme), wrapped in kindPreservingSerializer, and that factory lists protobuf among its supported media types. Negotiation in k8s.io/apiserver picks the best match from that list, so protobuf wins over the JSON fallback. Encoding then fails because the Application types do not implement the protobuf marshalling interface. The protobuf serializer reports that as errNotMarshalable, whose status is 406 (k8s.io/apimachinery pkg/runtime/serializer/protobuf/protobuf.go), and the response never goes back to JSON. CBOR is not in the factory's list, so negotiation skips it and the fallback works.
Upstream custom resources behave the same way. apiextensions-apiserver also lists protobuf for them, because some objects it returns, like Status, do support it. So this is not specific to cozystack, but the result still breaks the Accept header's promise: JSON was acceptable and the server had it.
Two ways to handle it:
- Drop protobuf from the media types the apps group negotiates, so a fallback in Accept is honoured. Objects like Status that the apps API returns would then be served as JSON too, which needs checking against clients that send protobuf only.
- Keep the upstream behaviour and treat the pinned 406 as the contract. The test already describes the mechanism, so only this issue would close.
I'd go with the first, but it is a change to what the API advertises, so it needs a maintainer decision.
- Ngôn ngữ chính
- Go
- Star
- 2.2k
- Fork
- 209
- Merge trung bình
- 4 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 140
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cozystack/cozystack
-
triage/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
cozystack/cozystack#5464 · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
test(kubernetes-nodes): stop hand-typing the default Talos version in tests that are not about itĐang mởarea/testing kind/cleanup triage/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
cozystack/cozystack#5456 · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
area/testing kind/cleanup triage/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
cozystack/cozystack#5447 · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
area/kubernetes kind/bug triage/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
cozystack/cozystack#5445 · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
kind/bug triage/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
cozystack/cozystack#5438 · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của cozystack/cozystack
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Correct local module testing instructions for Go sample contributorsCó thể đã có người làm @slievrly đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
internal/core: cleanAttachmentName splits a rune at the 255-byte cap and stores invalid UTF-8Có thể đã có người làm @pacwestnobody đã nhận hôm nay. Đang mởgo good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Podiom/Podiom#427 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TestLaunchGolden spends about 98 seconds on fake-agent exit delays under -raceCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
factory:subtask
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
Maintainer thường phản hồi trong vòng 1 ngày