You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -158,15 +163,26 @@ We are proposing to add a new endpoint, /statusz on all core Kubernetes componen
158
163
159
164
We will prioritize inclusion of only essential diagnostic and monitoring data that aligns with the intended purpose of the z-page.
160
165
161
-
3.**Premature Dependency on Unstable Format**
166
+
3.**API Stability and Evolution**
162
167
163
-
The alpha release will explicitly support plain text format only, making it clear that the output is not intended for parsing or automated monitoring. The feature will be secured behind a feature gate that is disabled by default, ensuring users opt-in consciously. Also, the endpoint will support specifying a version as a query parameter to facilitate future transitions to structured schema changes without breaking existing integrations, once the usage patterns and requirements are better understood
168
+
The alpha release will explicitly support plain text format only, making it clear that the output is not intended for parsing or automated monitoring. The feature will be secured behind a feature gate that is disabled by default, ensuring users opt-in consciously.
169
+
170
+
For Beta, to provide a stable contract for consumers, we are introducing a versioned JSON response available via content negotiation (`Accept: application/json;v=v1`). The plain text format remains the default for human consumption and backward compatibility.
164
171
165
172
## Design Details
166
173
167
174
### Data Format and versioning
168
175
169
-
Initially, the statusz 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 /statusz?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.
176
+
The `/statusz` endpoint will provide a structured, versioned response by default to ensure stability and a clear contract for consumers. The initial version will be `v1`.
177
+
178
+
The default response format will be `application/json`. Clients can explicitly request the plain text format for human readability by sending an `Accept: text/plain` header.
179
+
180
+
Clients can request a specific version and format using the `Accept` header, following standard Kubernetes API content negotiation practices. For example:
181
+
182
+
-**Default (JSON):**`GET /statusz` or `GET /statusz` with `Accept: application/json;v=v1`
183
+
-**Plain Text:**`GET /statusz` with `Accept: text/plain`
184
+
185
+
This approach allows us to evolve the API in the future by introducing new versions (e.g., `v2`, `v3`) without breaking existing clients.
170
186
171
187
### Authz and authn
172
188
@@ -189,15 +205,13 @@ rules:
189
205
190
206
### Endpoint Response Format
191
207
192
-
#### Data format : text
208
+
The `/statusz` endpoint supports both structured JSON and plain text formats, with JSON being the default.
193
209
194
-
#### Request
195
-
* Method: **GET**
196
-
* Endpoint: **/statusz**
197
-
* Header: `Content-Type: text/plain`
198
-
* Body: empty
210
+
#### Response Fields
211
+
The following fields are exposed in the response:
199
212
200
-
#### Response fields
213
+
* **apiVersion**: The version of the response schema (JSON only).
214
+
* **componentName**: The name of the Kubernetes component.
201
215
* **Start Time**: The exact date and time when the component process was initiated
202
216
* **Uptime**: The duration for which the component has been running continuously
203
217
* **Go Version**: The specific version of the Go programming language used to build the component's binary
@@ -206,25 +220,105 @@ rules:
206
220
* **Minimum Compatibility Version**: The minimum Kubernetes API version with which the component is designed to work seamlessly
207
221
* **Useful Links**: Relative URLs to other essential endpoints, such as /healthz, /livez, /readyz, and /metrics, for deeper insights into the component's health, readiness, and performance metrics
208
222
209
-
#### Sample response
223
+
#### Data format: JSON (v1)
224
+
225
+
This is the default and preferred format for programmatic access.
226
+
227
+
##### Request
228
+
* Method: **GET**
229
+
* Endpoint: **/statusz**
230
+
* Header: `Accept: application/json;v=v1` (or no Accept header)
231
+
* Body: empty
232
+
233
+
##### Response Body
234
+
235
+
The response is a JSON object with the following structure:
The versioned `/statusz` endpoint will follow a deprecation policy to ensure a predictable lifecycle for consumers as the API evolves.
313
+
314
+
The deprecation policy for a given API version (e.g., `v1`) is as follows:
315
+
- A deprecated API version must continue to be served for no less than **12 months or 3 releases** (whichever is longer) after the deprecation is announced.
316
+
317
+
The deprecation process will be as follows:
318
+
1. **Announce Deprecation**: When a new API version is introduced (e.g., `v2`), the older version (e.g., `v1`) will be marked as deprecated. This will be communicated in the official release notes, and requests to the deprecated API version will return a `Warning` header.
319
+
2. **Deprecation Window**: The deprecated API version will be supported for the duration of the deprecation window (at least 12 months or 3 releases).
320
+
3. **Removal**: After the deprecation window has passed, the deprecated API version may be removed in a future Kubernetes release.
321
+
228
322
### Test Plan
229
323
230
324
[x] I/we understand the owners of the involved components may require updates to
@@ -233,34 +327,46 @@ to implement this enhancement.
233
327
234
328
##### Prerequisite testing updates
235
329
330
+
N/A
331
+
236
332
##### Unit tests
237
333
238
-
- There will addition of new tests in the following packages
- `staging/src/k8s.io/component-base/zpages/statusz`: Unit tests will be added to cover both the plain text and structured JSON output, including serialization and content negotiation logic.
240
335
241
336
##### Integration tests
242
337
338
+
- Integration tests will be added for each component to verify that the `/statusz` endpoint is correctly registered and serves both `text/plain` and the versioned `application/json` content types.
243
339
244
340
##### e2e tests
245
341
246
-
- Ensure existence of the /statusz endpoint
342
+
- E2E tests will be added to query the `/statusz` endpoint for each core component and validate the following:
343
+
- The endpoint is reachable and returns a `200 OK` status.
344
+
- Requesting with the `Accept` header for `application/json;v=v1` returns a valid JSON object.
345
+
- The JSON response can be successfully unmarshalled.
346
+
- Requesting with `text/plain` or no `Accept` header returns the non-empty plain text format.
247
347
248
348
### Graduation Criteria
249
349
250
350
#### Alpha
251
351
252
-
- Feature implemented behind a feature flag
253
-
- Feature implemented for apiserver
254
-
- Ensure proper tests are in place.
352
+
- Feature implemented behind a feature flag (`ComponentStatusz`).
353
+
- Feature implemented for apiserver.
354
+
- Initial implementation provides a plain text response.
355
+
- Basic unit tests are in place.
255
356
256
357
#### Beta
257
358
258
-
- Gather feedback from developers
259
-
- Feature implemented for other Kubernetes Components
359
+
- Feature gate `ComponentStatusz` is enabled by default.
360
+
- Structured, versioned JSON response format is implemented.
361
+
- Plain text format is maintained for backward compatibility.
362
+
- Feature is implemented for all core Kubernetes components (kube-apiserver, kube-controller-manager, kube-scheduler, kubelet, kube-proxy).
363
+
- Integration and e2e tests are added for the JSON response format.
364
+
- Gather feedback from users and developers on the structured format.
260
365
261
366
#### GA
262
367
263
-
- Several cycles of bake-time
368
+
- The versioned JSON response is considered stable.
369
+
- Several cycles of bake-time to ensure API stability and usefulness.
0 commit comments