fix(apiserver): register OpenAPI v2 spec for aggregation#1803
Merged
praveenrewar merged 2 commits intocarvel-dev:developfrom Apr 6, 2026
Merged
fix(apiserver): register OpenAPI v2 spec for aggregation#1803praveenrewar merged 2 commits intocarvel-dev:developfrom
praveenrewar merged 2 commits intocarvel-dev:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Registers an OpenAPI v2 spec for kapp-controller’s aggregated API server so Kubernetes (v1.30+) API aggregation can successfully sync both OpenAPI v2 and v3 without spamming kube-apiserver logs with 404 retries.
Changes:
- Adds
serverConfig.OpenAPIConfig(OpenAPI v2) alongside the existingOpenAPIV3Config. - Sets OpenAPI v2
Infometadata (Title/Version) for the aggregated API server.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aroradaman
approved these changes
Apr 3, 2026
Signed-off-by: Himanshu Singh <himansh.singh3@gmail.com>
…3 version This commit addresses OpenAPI spec generation issues by ensuring both V2 and V3 configurations are instantiated before calling 'recommendedOptions.ApplyTo(serverConfig)'. This allows the authentication wiring to properly decorate the OpenAPI security definitions. Additionally, it explicitly sets the V3 spec 'Info.Version' to 'v1alpha1' to satisfy strict OpenAPI schema requirements. Signed-off-by: Himanshu Singh <himansh.singh3@gmail.com>
b5aabc8 to
15ece02
Compare
praveenrewar
approved these changes
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
In Kubernetes v1.30+, the API Aggregation Controller inside the kube-apiserver is designed to synchronize discovery information for both OpenAPI v2 and v3 to ensure compatibility with all client types. Previously, kapp-controller only registered the OpenAPIV3Config for its aggregated API server (v1alpha1.data.packaging.carvel.dev).
Because the v2 spec was missing, the main kube-apiserver failed with a resource not found (404) error when attempting to fetch it during its aggregation sync loop. Consequently, the control plane logs were flooded with continuous retry errors (failed to download v1alpha1.data.packaging.carvel.dev: resource not found), even though functional package reconciliation was unaffected.
This PR registers the OpenAPI v2 configuration using genericapiserver.DefaultOpenAPIConfig to satisfy the K8s Aggregation Controller, successfully eliminating the 404 errors in the kube-apiserver logs.
Ref: https://kubernetes.io/docs/concepts/overview/kubernetes-api/#openapi-interface-definition:~:text=Kubernetes%20serves%20both%20OpenAPI%20v2.0%20and%20OpenAPI%20v3.0.
Which issue(s) this PR fixes:
Fixes #1703
Does this PR introduce a user-facing change?
Additional Notes for your reviewer:
Testing Done:
Spun up a fresh Minikube cluster (K8s v1.35+) and deployed kapp-controller built from this branch.
Verified that the APIService object v1alpha1.data.packaging.carvel.dev successfully reaches the Available: True state.
❯ kubectl get apiservices v1alpha1.data.packaging.carvel.dev ○ minikube
NAME SERVICE AVAILABLE AGE
v1alpha1.data.packaging.carvel.dev kapp-controller/packaging-api True 15m
❯
❯ kubectl logs -n kube-system -l component=kube-apiserver --since=5m | grep "failed to download v1alpha1.data.packaging.carvel.dev"
❯
Review Checklist:
a link to that PR
change
Additional documentation e.g., Proposal, usage docs, etc.: