Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make apiservices.apiregistration.k8s.io discoverable in openapi/v3 #118879

Merged
merged 3 commits into from
Jul 6, 2023

Conversation

atiratree
Copy link
Member

@atiratree atiratree commented Jun 26, 2023

What type of PR is this?

/kind bug
/kind regression
/sig api-machinery

What this PR does / why we need it:

make apiservices.apiregistration.k8s.io discoverable in openapi/v3

Which issue(s) this PR fixes:

Fixes #118878

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fixes a regression exposed in 1.27 by kubectl switching to openapi v3 by making apiregistration.k8s.io discoverable in openapi/v3 

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/regression Categorizes issue or PR as related to a regression from a prior release. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jun 26, 2023
@atiratree
Copy link
Member Author

side topic: do we want kubectl get apiservices.apiregistration.k8s.io to be self referential? That is if we should include v1.apiregistration.k8s.io as a local service? Not sure if it is a good idea, just asking out of curiosity.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 26, 2023
Copy link
Member

@Jefftree Jefftree left a comment

Choose a reason for hiding this comment

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

Thanks for bringing this up and fixing it. A couple small comments otherwise LGTM

@@ -239,3 +290,20 @@ func sendReq(t *testing.T, handler http.Handler, path string) []byte {
handler.ServeHTTP(writer, req)
return writer.data
}

func testGetOpenAPIDefinitions(_ openapicommon.ReferenceCallback) map[string]openapicommon.OpenAPIDefinition {
Copy link
Member

Choose a reason for hiding this comment

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

nit: Rename to something to indicate that this is returning and APIService definition? Same for buildTestOpenAPIDefinition().

Copy link
Member Author

Choose a reason for hiding this comment

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

using APIService prefix now

}
aggregatorWebServicesHandler.UpdateGroupVersion(gv, spec)
}
apiServiceName := fmt.Sprintf(localDelegateChainNamePattern, i)
Copy link
Member

Choose a reason for hiding this comment

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

This isn't really a delegation handler in the traditional sense. The aggregator serves the path, can we use a constant name for this to not affect the local delegation numbers?

Copy link
Member Author

Choose a reason for hiding this comment

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

renamed to k8s_internal_local_kube_aggregator_types to at least have the same prefix as the delegation handlers

@Jefftree
Copy link
Member

Actually this is a duplicate of #118884

@alexzielenski
Copy link
Contributor

wow @atiratree I was reviewing your other PR for other resources that fail with kubectl explain and ended up fixing this independently. Looks like our fixes are the same, but you got a bit farther with writing tests. Feel free to take any implementation from my PR #118884. Will close in favor of this

@atiratree
Copy link
Member Author

@alexzielenski ow, what a coincidence. Sorry about that. Will take a look at your PR.

@alexzielenski
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 27, 2023
@atiratree atiratree force-pushed the fix-openapi-apiservices branch 3 times, most recently from 2ef4dd8 to b4aa9fa Compare June 27, 2023 19:39
@atiratree
Copy link
Member Author

@Jefftree updated the PR, using @alexzielenski simpler implementation now

@ardaguclu
Copy link
Member

/triage accepted
/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 3, 2023
@Jefftree
Copy link
Member

Jefftree commented Jul 5, 2023

/lgtm
/assign @deads2k

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 5, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: a793d00d337a250799f0f9fd6dca21cd35b4f8ca

@deads2k
Copy link
Contributor

deads2k commented Jul 6, 2023

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: atiratree, deads2k

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 6, 2023
@k8s-ci-robot k8s-ci-robot merged commit 40956a7 into kubernetes:master Jul 6, 2023
12 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.28 milestone Jul 6, 2023
@atiratree
Copy link
Member Author

I have opened a cherry-pick into 1.27 #119841. Not sure if we should backport this further back, but we should at least do 1.27, since the OpenAPIV3 feature has been graduated to stable.

k8s-ci-robot added a commit that referenced this pull request Sep 7, 2023
…18879-upstream-release-1.27

Automated cherry pick of #118879: expose apiregistration.k8s.io into OpenAPIV3
alexzielenski added a commit to alexzielenski/kubectl-validate that referenced this pull request Apr 17, 2024
was not being published until mid 1.27 release cycle

kubernetes/kubernetes#118879
alexzielenski added a commit to alexzielenski/kubectl-validate that referenced this pull request Apr 17, 2024
was not being published until mid 1.27 release cycle

kubernetes/kubernetes#118879
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. kind/bug Categorizes issue or PR as related to a bug. kind/regression Categorizes issue or PR as related to a regression from a prior release. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

apiregistration.k8s.io is not available in openapi/v3 endpoint and discovery
6 participants