Skip to content

Commit f7899bc

Browse files
authored
Merge pull request #48464 from benluddy/dev-1.32-kep-4222
Document API support for CBOR encoding
2 parents 86ed3f5 + a262986 commit f7899bc

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: CBORServingAndStorage
3+
content_type: feature_gate
4+
_build:
5+
list: never
6+
render: false
7+
8+
stages:
9+
- stage: alpha
10+
defaultValue: false
11+
fromVersion: "1.32"
12+
---
13+
Enables CBOR as a [supported encoding for requests and
14+
responses](/docs/reference/using-api/api-concepts/#cbor-encoding), and as the preferred storage
15+
encoding for custom resources.

content/en/docs/reference/using-api/api-concepts.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,36 @@ For example:
331331
Accept: application/vnd.kubernetes.protobuf, application/json
332332
```
333333

334+
### CBOR resource encoding {#cbor-encoding}
335+
336+
{{< feature-state feature_gate_name="CBORServingAndStorage" >}}
337+
338+
With the `CBORServingAndStorage` [feature
339+
gate](/docs/reference/command-line-tools-reference/feature-gates/) enabled, request and response
340+
bodies for all built-in resource types and all resources defined by a {{< glossary_tooltip
341+
term_id="CustomResourceDefinition" text="CustomResourceDefinition" >}} may be encoded to the
342+
[CBOR](https://www.rfc-editor.org/rfc/rfc8949) binary data format. CBOR is also supported at the {{<
343+
glossary_tooltip text="aggregation layer" term_id="aggregation-layer" >}} if it is enabled in
344+
individual aggregated API servers.
345+
346+
Clients should indicate the IANA media type `application/cbor` in the `Content-Type` HTTP request
347+
header when the request body contains a single CBOR [encoded data
348+
item](https://www.rfc-editor.org/rfc/rfc8949.html#section-1.2-4.2), and in the `Accept` HTTP request
349+
header when prepared to accept a CBOR encoded data item in the response. API servers will use
350+
`application/cbor` in the `Content-Type` HTTP response header when the response body contains a
351+
CBOR-encoded object.
352+
353+
If an API server encodes its response to a [watch request](#efficient-detection-of-changes) using
354+
CBOR, the response body will be a [CBOR Sequence](https://www.rfc-editor.org/rfc/rfc8742) and the
355+
`Content-Type` HTTP response header will use the IANA media type `application/cbor-seq`. Each entry
356+
of the sequence (if any) is a single CBOR-encoded watch event.
357+
358+
In addition to the existing `application/apply-patch+yaml` media type for YAML-encoded [server-side
359+
apply configurations](#patch-and-apply), API servers that enable CBOR will accept the
360+
`application/apply-patch+cbor` media type for CBOR-encoded server-side apply configurations. There
361+
is no supported CBOR equivalent for `application/json-patch+json` or `application/merge-patch+json`,
362+
or `application/strategic-merge-patch+json`.
363+
334364
## Efficient detection of changes
335365

336366
The Kubernetes API allows clients to make an initial request for an object or a

0 commit comments

Comments
 (0)