mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #97470 from roycaihw/crd/optimize-create-event-handler
crd create event: skip storage teardown if the crd info doesn't change
This commit is contained in:
commit
b476f7087c
@ -468,6 +468,16 @@ func (r *crdHandler) createCustomResourceDefinition(obj interface{}) {
|
|||||||
r.customStorageLock.Lock()
|
r.customStorageLock.Lock()
|
||||||
defer r.customStorageLock.Unlock()
|
defer r.customStorageLock.Unlock()
|
||||||
// this could happen if the create event is merged from create-update events
|
// this could happen if the create event is merged from create-update events
|
||||||
|
storageMap := r.customStorage.Load().(crdStorageMap)
|
||||||
|
oldInfo, found := storageMap[crd.UID]
|
||||||
|
if !found {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if apiequality.Semantic.DeepEqual(&crd.Spec, oldInfo.spec) && apiequality.Semantic.DeepEqual(&crd.Status.AcceptedNames, oldInfo.acceptedNames) {
|
||||||
|
klog.V(6).Infof("Ignoring customresourcedefinition %s create event because a storage with the same spec and accepted names exists",
|
||||||
|
crd.Name)
|
||||||
|
return
|
||||||
|
}
|
||||||
r.removeStorage_locked(crd.UID)
|
r.removeStorage_locked(crd.UID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user