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 +161,22 @@ We are proposing to add a new endpoint, /statusz on all core Kubernetes componen
158
161
159
162
We will prioritize inclusion of only essential diagnostic and monitoring data that aligns with the intended purpose of the z-page.
160
163
161
-
3.**Premature Dependency on Unstable Format**
164
+
3.**API Stability and Evolution**
162
165
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
166
+
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.
167
+
168
+
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
169
165
170
## Design Details
166
171
167
172
### Data Format and versioning
168
173
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.
174
+
The `/statusz` endpoint uses content negotiation via the `Accept` header to serve different response formats. The default response format is `text/plain`, which is intended for human consumption and backward compatibility.
175
+
176
+
For programmatic access, a structured, versioned JSON response is available. Clients can request the structured format by specifying the appropriate `Accept` header:
177
+
`Accept: application/json;v=v1`
178
+
179
+
If the `Accept` header is omitted or set to `text/plain`, the endpoint will return the default plain text response. This approach allows for a stable, machine-readable API while preserving the simple text-based output.
170
180
171
181
### Authz and authn
172
182
@@ -189,14 +199,6 @@ rules:
189
199
190
200
### Endpoint Response Format
191
201
192
-
#### Data format : text
193
-
194
-
#### Request
195
-
* Method: **GET**
196
-
* Endpoint: **/statusz**
197
-
* Header: `Content-Type: text/plain`
198
-
* Body: empty
199
-
200
202
#### Response fields
201
203
* **Start Time**: The exact date and time when the component process was initiated
202
204
* **Uptime**: The duration for which the component has been running continuously
@@ -206,7 +208,17 @@ rules:
206
208
* **Minimum Compatibility Version**: The minimum Kubernetes API version with which the component is designed to work seamlessly
207
209
* **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
210
209
-
#### Sample response
211
+
#### Data format: text (default)
212
+
213
+
This format is the default and is intended for human readability and backward compatibility.
214
+
215
+
##### Request
216
+
* Method: **GET**
217
+
* Endpoint: **/statusz**
218
+
* Header: `Accept: text/plain` (or no Accept header)
219
+
* Body: empty
220
+
221
+
##### Sample response
210
222
211
223
```
212
224
Started: Fri Sep 6 06:19:51 UTC 2024
@@ -225,6 +237,38 @@ metrics:/metrics
225
237
readyz:/readyz
226
238
sli metrics:/metrics/slis
227
239
```
240
+
241
+
#### Data format: JSON (v1)
242
+
243
+
This is the preferred format for programmatic access.
-`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
285
241
286
##### Integration tests
242
287
288
+
- 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
289
244
290
##### e2e tests
245
291
246
-
- Ensure existence of the /statusz endpoint
292
+
- E2E tests will be added to query the `/statusz` endpoint for each core component and validate the following:
293
+
- The endpoint is reachable and returns a `200 OK` status.
294
+
- Requesting with the `Accept` header for `application/json;v=v1` returns a valid JSON object.
295
+
- The JSON response can be successfully unmarshalled.
296
+
- Requesting with `text/plain` or no `Accept` header returns the non-empty plain text format.
247
297
248
298
### Graduation Criteria
249
299
250
300
#### Alpha
251
301
252
-
- Feature implemented behind a feature flag
253
-
- Feature implemented for apiserver
254
-
- Ensure proper tests are in place.
302
+
- Feature implemented behind a feature flag (`ComponentStatusz`).
303
+
- Feature implemented for apiserver.
304
+
- Initial implementation provides a plain text response.
305
+
- Basic unit tests are in place.
255
306
256
307
#### Beta
257
308
258
-
- Gather feedback from developers
259
-
- Feature implemented for other Kubernetes Components
309
+
- Feature gate `ComponentStatusz` is enabled by default.
310
+
- Structured, versioned JSON response format is implemented.
311
+
- Plain text format is maintained for backward compatibility.
312
+
- Feature is implemented for all core Kubernetes components (kube-apiserver, kube-controller-manager, kube-scheduler, kubelet, kube-proxy).
313
+
- Integration and e2e tests are added for the JSON response format.
314
+
- Gather feedback from users and developers on the structured format.
260
315
261
316
#### GA
262
317
263
-
- Several cycles of bake-time
318
+
- The versioned JSON response is considered stable.
319
+
- Several cycles of bake-time to ensure API stability and usefulness.
0 commit comments