Skip to content

Conversation

yongruilin
Copy link
Contributor

  • One-line PR description:
    This PR adds Beta criteria of statusz with versioned structured response.
  • Other comments:

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. labels Sep 22, 2025
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 22, 2025
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 22, 2025
@yongruilin
Copy link
Contributor Author

/assign @richabanker
/cc @liggitt

For programmatic access, a structured, versioned JSON response is available. Clients can request the structured format by specifying the appropriate `Accept` header:
`Accept: application/json;v=v1`

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would want to make a structured, versioned format the default for the z-pages endpoints. Defaulting to an unversioned plain text response has the possibility of inadvertently breaking clients that may (despite our warning headers) parse it as the schema evolves.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if we were to make a versioned endpoint as the default, then we might want to also put in place a deprecation policy for this endpoint. We could do something similar to what we do for Kubernetes APIs/metrics today. For example, when we decide to deprecate an old version of the JSON response (e.g., v1) after a new one (v2) is introduced, we could:

  1. Announce Deprecation: Mark v1 as deprecated in the release notes and have the endpoint return a Warning header for any v1 requests
  2. Deprecation Window: Keep the v1 endpoint functional for at least 3 releases to give consumers ample time to migrate
  3. Removal: After the deprecation window, make v2 the default and maybe consider removing v1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I updated to default return JSON and the deprecation policy, following the similar pattern as https://kubernetes.io/docs/reference/using-api/api-concepts/ and https://kubernetes.io/docs/reference/using-api/deprecation-policy/

"emulationVersion": "1.31.0-beta.0.981",
"minimumCompatibilityVersion": "1.30.0",
"usefulLinks": {
"configz": "/configz",
Copy link
Contributor

@richabanker richabanker Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having this as a key-value map seems redundant... The current implementation returns a list of available paths as described in this PR description, maybe just having this as an array of strings is ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM, updated.

"binaryVersion": "1.31.0-beta.0.981+c6be932655a03b-dirty",
"emulationVersion": "1.31.0-beta.0.981",
"minimumCompatibilityVersion": "1.30.0",
"usefulLinks": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this is implemented to return Paths (instead of useful_links) currently.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: yongruilin
Once this PR has been reviewed and has the lgtm label, please ask for approval from richabanker. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

metrics:/metrics
readyz:/readyz
sli metrics:/metrics/slis
configz: /configz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesnt match with the JSON formatted response. Remove the keys from here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is what current KEP has. I've updated to match what we implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants