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 +162,32 @@ We are proposing to add a new endpoint, /statusz on all core Kubernetes componen
158
162
159
163
We will prioritize inclusion of only essential diagnostic and monitoring data that aligns with the intended purpose of the z-page.
160
164
161
-
3.**Premature Dependency on Unstable Format**
165
+
3.**API Stability and Evolution**
162
166
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
167
+
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.
168
+
169
+
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
170
165
171
## Design Details
166
172
167
173
### Data Format and versioning
168
174
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.
175
+
The `/statusz` endpoint defaults to a `text/plain` response format, which is intended for human consumption and should not be parsed by automated tools.
176
+
177
+
Beginning in Beta, a structured, versioned JSON format is available for programmatic access. This will follow the standard Kubernetes content negotiation mechanism, requiring a group, version, and kind.
178
+
179
+
-**Group**: `component.k8s.io`
180
+
-**Version**: `v1alpha1` (initial version, subject to change)
181
+
-**Kind**: `ComponentStatus`
182
+
183
+
To receive the structured JSON response, a client **must** explicitly request it using an `Accept` header specifying these parameters. For example:
This negotiation mechanism ensures clients are explicit about the exact API they want, preventing accidental dependencies on unstable or incorrect formats. If a client requests `application/json` without the required parameters, the server will respond with a `406 Not Acceptable` error.
170
191
171
192
### Authz and authn
172
193
@@ -189,24 +210,19 @@ rules:
189
210
190
211
### Endpoint Response Format
191
212
192
-
#### Data format : text
213
+
The `/statusz` endpoint supports both plain text and structured JSON formats. The default format is `text/plain`.
214
+
215
+
#### Data format: text
216
+
217
+
This format is the default and is intended for human readability.
193
218
194
-
#### Request
195
-
* Method: **GET**
219
+
##### Request
220
+
* Method: **GET**
196
221
* Endpoint: **/statusz**
197
-
* Header: `Content-Type: text/plain`
222
+
* Header: `Accept: text/plain` (or no Accept header)
198
223
* Body: empty
199
224
200
-
#### Response fields
201
-
* **Start Time**: The exact date and time when the component process was initiated
202
-
* **Uptime**: The duration for which the component has been running continuously
203
-
* **Go Version**: The specific version of the Go programming language used to build the component's binary
204
-
* **Binary Version**: The version of the component's binary, helpful for compatibility checks and troubleshooting
205
-
* **Emulation Version**: The Kubernetes API version which this component is emulating as
206
-
* **Minimum Compatibility Version**: The minimum Kubernetes API version with which the component is designed to work seamlessly
207
-
* **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
-
209
-
#### Sample response
225
+
##### Sample response
210
226
211
227
```
212
228
Started: Fri Sep 6 06:19:51 UTC 2024
@@ -225,6 +241,88 @@ metrics:/metrics
225
241
readyz:/readyz
226
242
sli metrics:/metrics/slis
227
243
```
244
+
245
+
#### Data format: JSON (v1alpha1)
246
+
247
+
This format is available starting in Beta for programmatic access and must be explicitly requested. It is considered an alpha-level format and is subject to change.
The versioned `/statusz` endpoint will follow a deprecation policy to ensure a predictable lifecycle for consumers as the API evolves.
317
+
318
+
The deprecation policy for a given API version (e.g., `v1`) is as follows:
319
+
- 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.
320
+
321
+
The deprecation process will be as follows:
322
+
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.
323
+
2.**Deprecation Window**: The deprecated API version will be supported for the duration of the deprecation window (at least 12 months or 3 releases).
324
+
3.**Removal**: After the deprecation window has passed, the deprecated API version may be removed in a future Kubernetes release.
325
+
228
326
### Test Plan
229
327
230
328
[x] I/we understand the owners of the involved components may require updates to
@@ -233,34 +331,46 @@ to implement this enhancement.
233
331
234
332
##### Prerequisite testing updates
235
333
334
+
N/A
335
+
236
336
##### Unit tests
237
337
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
339
241
340
##### Integration tests
242
341
342
+
- 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
343
244
344
##### e2e tests
245
345
246
-
- Ensure existence of the /statusz endpoint
346
+
- E2E tests will be added to query the `/statusz` endpoint for each core component and validate the following:
347
+
- The endpoint is reachable and returns a `200 OK` status.
348
+
- Requesting with the `Accept` header for `application/json;as=ComponentStatus;v=v1alpha1;g=component.k8s.io` returns a valid `ComponentStatus` JSON object.
349
+
- The JSON response can be successfully unmarshalled into the `ComponentStatus` struct.
350
+
- Requesting with `text/plain` or no `Accept` header returns the non-empty plain text format.
247
351
248
352
### Graduation Criteria
249
353
250
354
#### Alpha
251
355
252
-
- Feature implemented behind a feature flag
253
-
- Feature implemented for apiserver
254
-
- Ensure proper tests are in place.
356
+
- Feature implemented behind a feature flag (`ComponentStatusz`), disabled by default.
357
+
- Feature implemented for at least one component (e.g., kube-apiserver).
358
+
- The endpoint provides a `text/plain` response only.
359
+
- Unit and integration tests are in place for the plain text format.
255
360
256
361
#### Beta
257
362
258
-
- Gather feedback from developers
259
-
- Feature implemented for other Kubernetes Components
363
+
- Feature gate `ComponentStatusz` is enabled by default.
364
+
- A structured JSON response (`component.k8s.io/v1alpha1`) is introduced for feedback.
365
+
- The `v1alpha1` JSON format is explicitly marked as alpha-quality and subject to change.
366
+
- Feature is implemented for all core Kubernetes components (kube-apiserver, kube-controller-manager, kube-scheduler, kubelet, kube-proxy).
367
+
- E2E tests are added for both plain text and the new JSON response format.
368
+
- Gather feedback from users and developers on the structured format.
260
369
261
370
#### GA
262
371
263
-
- Several cycles of bake-time
372
+
- The JSON response API is promoted to `component.k8s.io/v1` and is considered stable after bake-in.
373
+
- Conformance tests are in place for the endpoint.
0 commit comments