Make OpenAPIGetter tolerant of nil

Kubernetes-commit: 0da29848c538813bba8f9aa2e23542456105caa8
This commit is contained in:
Jefftree 2023-12-15 13:44:54 -05:00 committed by Kubernetes Publisher
parent 854aec7697
commit 778ed2b489
1 changed files with 1 additions and 1 deletions

View File

@ -156,7 +156,7 @@ func (p *Patcher) patchSimple(obj runtime.Object, modified []byte, namespace, na
}
}
if patch == nil {
if patch == nil && p.OpenAPIGetter != nil {
if openAPISchema, err := p.OpenAPIGetter.OpenAPISchema(); err == nil && openAPISchema != nil {
// if openapischema is used, we'll try to get required patch type for this GVK from Open API.
// if it fails or could not find any patch type, fall back to baked-in patch type determination.