Skip to content

Commit c8e8da7

Browse files
committed
KEP-4828: flagz endpoint with versioned structured response
1 parent 47f9f93 commit c8e8da7

File tree

1 file changed

+43
-10
lines changed
  • keps/sig-instrumentation/4828-component-flagz

1 file changed

+43
-10
lines changed

keps/sig-instrumentation/4828-component-flagz/README.md

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ tags, and then generate with `hack/update-toc.sh`.
2525
- [Data Format and versioning](#data-format-and-versioning)
2626
- [Authz and authn](#authz-and-authn)
2727
- [Endpoint Response Format](#endpoint-response-format)
28-
- [Data format : text](#data-format--text)
29-
- [Request](#request)
30-
- [Response fields](#response-fields)
31-
- [Sample response](#sample-response)
28+
- [Data format : text (Alpha, Beta, GA)](#data-format--text-alpha-beta-ga)
29+
- [Request](#request)
30+
- [Response fields](#response-fields)
31+
- [Sample response](#sample-response)
32+
- [Data format : json (v1) (Targeted for Beta)](#data-format--json-v1-targeted-for-beta)
33+
- [Request](#request-1)
34+
- [Sample response](#sample-response-1)
3235
- [Test Plan](#test-plan)
3336
- [Prerequisite testing updates](#prerequisite-testing-updates)
3437
- [Unit tests](#unit-tests)
@@ -149,27 +152,34 @@ We are proposing to add a new endpoint, /flagz on all core Kubernetes components
149152

150153
### Data Format and versioning
151154

152-
Initially, the flagz page will exclusively support a plain text format for responses. In future, when we have established a structured schema for the response, we can support specifying a version param, like /flagz?version=2, to ensure future compatibility. Through this, we can evolve the endpoint and introduce changes to the response schema without impacting clients relying on previous versions, ensuring backward compatibility.
155+
The `flagz` endpoint will use content negotiation via the `Accept` header. The default response format is `text/plain`.
156+
157+
- **Alpha**: The endpoint will only serve the `text/plain` format. Any `Accept` header requesting a different format will be ignored, and the response will default to `text/plain`.
158+
- **Beta**: The endpoint will be enhanced to serve a structured `application/json` format in addition to `text/plain`. Clients will be able to request a specific version of the JSON response (e.g., `application/json;v=v1`).
159+
160+
This phased approach ensures that the initial implementation is simple and focused on human-readability, while providing a clear path for machine-readable, versioned responses in the future.
153161

154162
### Authz and authn
155163

156164
Access to the endpoint will be limited to members of the `system:monitoring group` ([ref](https://github.com/kubernetes/kubernetes/blob/release-1.31/staging/src/k8s.io/apiserver/pkg/authentication/user/user.go#L73)), which is how paths like /healthz, /livez, /readyz are restricted today.
157165

158166
### Endpoint Response Format
159167

160-
#### Data format : text
168+
#### Data format : text (Alpha, Beta, GA)
169+
170+
This is the default format.
161171

162-
#### Request
172+
##### Request
163173
* Method: **GET**
164174
* Endpoint: **/flagz**
165-
* Header: `Content-Type: text/plain`
175+
* Header: `Accept: text/plain` (or omitted)
166176
* Body: empty
167177

168-
#### Response fields
178+
##### Response fields
169179
* **Flag Name**: The name of the command-line flag or configuration option
170180
* **Value**: The current value assigned to the flag at runtime
171181

172-
#### Sample response
182+
##### Sample response
173183

174184
```
175185
----------------------------
@@ -183,6 +193,28 @@ enable-garbage-collector=true
183193
encryption-provider-config-automatic-reload=false
184194
...
185195
```
196+
197+
#### Data format : json (v1) (Targeted for Beta)
198+
199+
##### Request
200+
* Method: **GET**
201+
* Endpoint: **/flagz**
202+
* Header: `Accept: application/json;v=v1`
203+
* Body: empty
204+
205+
##### Sample response
206+
207+
```json
208+
{
209+
"apiVersion": "v1",
210+
"flags": {
211+
"default-watch-cache-size": "100",
212+
"delete-collection-workers": "1",
213+
"enable-garbage-collector": "true",
214+
"encryption-provider-config-automatic-reload": "false"
215+
}
216+
}
217+
```
186218
### Test Plan
187219

188220
[x] I/we understand the owners of the involved components may require updates to
@@ -214,6 +246,7 @@ to implement this enhancement.
214246

215247
- Gather feedback from developers
216248
- Feature implemented for other Kubernetes Components
249+
- Introduce a versioned, structured JSON response format.
217250

218251
#### GA
219252

0 commit comments

Comments
 (0)