-
Notifications
You must be signed in to change notification settings - Fork 40.9k
WIP: apiextensions: skip creating storages for unserved versions #129709
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
base: master
Are you sure you want to change the base?
WIP: apiextensions: skip creating storages for unserved versions #129709
Conversation
Signed-off-by: Dr. Stefan Schimanski <[email protected]>
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sttts 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 |
/retest |
@sttts: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Integration test issues might be real. To be investigated. |
definitely
|
@@ -647,6 +647,10 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd | |||
|
|||
structuralSchemas := map[string]*structuralschema.Structural{} | |||
for _, v := range crd.Spec.Versions { | |||
if !v.Served { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is why tests are failing ... we need to fully construct structuralSchemas
for all versions even if they're not being served so we have schema info for defaulting reading from storage
dropping this short-circuit for the schema constructing loop should resolve failing tests
if !v.Served { | ||
continue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also not short-circuit here... managed field info for all versions is needed even when serving for different versions
@@ -720,6 +728,10 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd | |||
} | |||
|
|||
for _, v := range crd.Spec.Versions { | |||
if !v.Served { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we move this to just before we actually construct the storages[v.Name] = customresource.NewStorage(
?
other possibly impactful things are done in this loop I'm not sure we should skip, like registering equivalent kinds for webhooks, etc... skipping that has visible impact
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also need to construct storage if this is the storage version, this assumes we have constructed storage for it:
kubernetes/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/customresource_handler.go
Lines 601 to 606 in 9f26291
func (r *crdHandler) GetCustomResourceListerCollectionDeleter(crd *apiextensionsv1.CustomResourceDefinition) (finalizer.ListerCollectionDeleter, error) { | |
info, err := r.getOrCreateServingInfoFor(crd.UID, crd.Name) | |
if err != nil { | |
return nil, err | |
} | |
return info.storages[info.storageVersion].CustomResource, nil |
Currently, this would panic if you had an unserved version which was the storage version
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
cc @jpbetz |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
What type of PR is this?
/kind bug
What this PR does / why we need it:
CRD versions can be set as
served: false
. They are only used to decode objects from etcd. The loopthat creates storages (including a watch cache) did not skip those version though, although it could. As a result objects read from etcd were also converted to those unserved versions, potentially calling a webhook. This is unexpected and unnecessary.
Thanks to @fabriziopandini and @sbueringer for finding and debugging this issue.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: