Skip to content

Compatiblity fix: Always use OpenAPIModelName() functions if they are avalable - #564

Merged
k8s-ci-robot merged 3 commits into
kubernetes:masterfrom
jpbetz:backward-compat-model-names
Sep 10, 2025
Merged

k8s-ci-robot merged 3 commits into
kubernetes:masterfrom
jpbetz:backward-compat-model-names

Conversation

@jpbetz

@jpbetz jpbetz commented Sep 10, 2025 •

Copy link
Copy Markdown
Contributor

I discovered in k/k that #563 is not fully backward compatible. Before migrating sample-apiserver to use the new model names approach, it's openapi serving was broken.

The problem was once OpenAPIModelName() functions were generated for the core types, sample-apiserver's openapi had a mix of types with OpenAPIModelName() functions (the core types) and without (the sample-apiserver types).

So to be fully compatible, this PR detects OpenAPIModelName() functions and always uses them when available so that projects that import types from core or other projects continue to work even when not using +k8s:openapi-model-package for their own types.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 10, 2025
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 10, 2025
@jpbetz
jpbetz force-pushed the backward-compat-model-names branch from 398aeff to ad5ab13 Compare September 10, 2025 16:43
@jpbetz

jpbetz commented Sep 10, 2025

Copy link
Copy Markdown
Contributor Author

@Jefftree @thockin I missed an edge and need a fast follow.

@Jefftree

Copy link
Copy Markdown
Member

Looks like the CI failure is legitimate. Do the golden files need to be updated?

@jpbetz

jpbetz commented Sep 10, 2025

Copy link
Copy Markdown
Contributor Author

Looks like the CI failure is legitimate. Do the golden files need to be updated?

Ah, yes, I added some comments last minute and they show up as description fields.

Fixed.

@jpbetz
jpbetz force-pushed the backward-compat-model-names branch from 7088feb to 87d33b5 Compare September 10, 2025 17:29
@jpbetz
jpbetz force-pushed the backward-compat-model-names branch from 87d33b5 to 62a9a4e Compare September 10, 2025 17:34
@jpbetz
jpbetz force-pushed the backward-compat-model-names branch from 62a9a4e to 2a895cc Compare September 10, 2025 17:45
@Jefftree

Copy link
Copy Markdown
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 10, 2025
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Jefftree, jpbetz

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

The pull request process is described here

Details 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

@k8s-ci-robot
k8s-ci-robot merged commit 589584f into kubernetes:master Sep 10, 2025
@timuthy

timuthy commented Feb 3, 2026 •

Copy link
Copy Markdown

Just came across this PR, as we're facing exactly this issue when upgrading the Kubernetes dependencies of our aggregated API server to 1.35 (github.com/gardener/gardener).

I’ve used an openapi-gen version that includes this fix, but the issue of broken OpenAPI serving still occurs.

@jpbetz do you have any hints or examples where you got this working? I couldn't find this mixed setup in the sample-apiserver project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

4 participants