Drop version from static openapi json file#84654
Drop version from static openapi json file#84654k8s-ci-robot merged 1 commit intokubernetes:masterfrom
Conversation
|
Do we need to re-inject this later? Will it impact anything? |
fc9da70 to
b44d7c8
Compare
|
cc @lavalamp xref discussion in #37055 (comment) The presence of this means we can't fast-forward release branches while they're still tracking master, which is really unfortunate, and requires a build/update-openapi-spec invocation just to fast forward the branch :-/ |
|
/lgtm /hold /sig release |
|
/priority important-soon |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justaugustus, liggitt The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/test pull-kubernetes-e2e-gce-device-plugin-gpu |
|
Same question as @cblecker -- why is this here? Do we need to add it back in some later step in some pipeline? |
|
It's used at https://github.com/kubernetes-sigs/reference-docs/blob/master/gen-apidocs/generators/api/open_api.go#L161, which is really unfortunate, because it is misleading/inaccurate (for example, the current swagger.json at master claims it is for v1.18.0, and the currently published docs for 1.16 claim they are for v1.17.0) |
|
can we update the release branch once when we cut the branch or to make easier when we stop doing the branchff ? |
…4-upstream-release-1.16 Automated cherry pick of #84654: Drop version from static openapi json file
…4-upstream-release-1.15 Automated cherry pick of #84654: Drop version from static openapi json file
…4-upstream-release-1.17 Automated cherry pick of #84654: Drop version from static openapi json file
|
@liggitt Sorry for jumping in too late, hopefully not toooo late? We will check the API reference doc generation logic if necessary -- maybe we were using the wrong branch/tag in the Makefile/script?. However, tagging the version as "unversioned" may make tracking the changes from one version to another version very difficult. I'm wondering if there are some compelling reasons to do this other than the API reference docs? I'm more inclined to have the API spec versioned. The version string doesn't look to me like the major blocker for fast forwarding? If there are changes to the API spec, we are supposed update the version string anyway. If there is no change to the API spec, why are we blaming the version string? |
|
That file is the only difference between master and the release branch when we're in the fast forward period of a release, because as soon as the release branch is created, its swagger file contains 1.x.y, and master's contains 1.x.y+1. This was the only reason we could not simply fast forward the release branch with git before lifting code freeze on master. The current swagger generation does not base the version on whether there was an API change or not, but on the nearest tag. API changes can merge during development and do not modify the version in the static swagger file. |
|
@liggitt Thanks for the response. If API changes can be merged without modifying the version in the swagger file, where is the source of truth then? It means we cannot tell which version a swagger file is for; it means my 1.17.1 spec may differ from your 1.17.1. |
the git commits/tags are the source of truth |
|
for example, to see the diff between 1.16.0 and 1.17.0: diff \
<(git show v1.16.0:./api/openapi-spec/swagger.json | jq .definitions) \
<(git show v1.17.0:./api/openapi-spec/swagger.json | jq .definitions) |
|
Okay. The incorrect API version string on the website was introduced in kubernetes/website#16569, for some unknown reasons. I'm fixing it in kubernetes/website#18587. |
sounds good, thanks |
|
@liggitt Even with PRs submitted to fix the version for 1.16, I'm still against tagging the swagger spec as "unversioned". An API spec must have its own version, which is independent of the git tag. We must have other ways to address this. |
|
The reason for this PR is that it deduplicates information that is already available via git tags, and fixes the issue with master/release branch fast forwarding.
When fetched from a running API server (which is the recommended way to obtain the openapi schema for a particular cluster), the openapi document contains the server's version, and is appropriate to make use of. The static file checked in here is for convenience only, and the git sha/tag should be used to determine what version the file is for. |
|
@liggitt Revisiting this statement: It's entirely possible that there shouldn't be a user impact, but there clearly is. I'm curious: how did you arrive at this assessment? Did you reach out to other SIGs to assess impact? Given the timing of KubeCon and the holidays, it's possible SIG Docs could have missed any outreach. I want to make sure we're not missing collaboration attempts.
EDIT: No need to revert prior to thoroughly excavating the docs generation process, which is admittedly brittle. |
|
That was oriented at users consuming Kubernetes releases. This does not change the behavior of the API server or other components, or any APIs we produce. |
|
Hi, @liggitt ,
Would this be the easiest way (eliminate guesswork so that this can be automated) to generate a valid Open Api spec that corresponds to a tagged release version? |
The easiest way to get the generated spec for a tagged release version is to fetch the file at that tag, e.g.
The release branch, e.g.
We have a verification script that ensure the definitions/schemas/operations/etc in the committed file matches the output of the server at that sha. |
|
@liggitt . Thanks for the reply. Still digesting the info and previous history. |
Making them exactly the same causes the various problems described above (and in the PR that introduced the version to the static file):
To summarize:
|
|
Got it. Saving the release-tagged spec is helpful (not sure who/what uses this file besides docs), but perhaps providing a build target, to generate the spec (run the API server), is all that is needed. The file can be generated on demand and with the correct version state. |
|
@liggitt I've noticed that latest tags has the version undefined, for example: $ curl -s https://raw.githubusercontent.com/kubernetes/kubernetes/v1.15.9/api/openapi-spec/swagger.json | jq .info.version
"unversioned"so I guess this static spec will always be "unversioned" (in branches and tags) and we have to update version using the tag name. Correct? BTW, kubernetes-client/* are probably affected. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
This changes the version tag in the static commited openapi json file back to what it was prior to #37055 (comment).
Consumers of the actual openapi spec from live API servers are unaffected.
The presence of this branch-specific version in a CI-verified file is preventing release branches from fast-forwarding while they are tracking master. That means release branches end up with large merge commits, fast-forwarding the branch requires a build and openapi generation (see kubernetes/sig-release#845), and commit SHAs don't match.
Does this PR introduce a user-facing change?:
/cc @justaugustus @Katharine