From 9d1829c33ac457d2c803ff900f67df03af50fa94 Mon Sep 17 00:00:00 2001 From: Jefftree Date: Fri, 15 Dec 2023 13:44:54 -0500 Subject: [PATCH] Make OpenAPIGetter tolerant of nil --- staging/src/k8s.io/kubectl/pkg/cmd/apply/patcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/apply/patcher.go b/staging/src/k8s.io/kubectl/pkg/cmd/apply/patcher.go index 111cf57e1d1..cbe3b0307df 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/apply/patcher.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/apply/patcher.go @@ -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.