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