Skip to content

Commit 6eae7d8

Browse files
committed
fix loading CRDs from multiple directories in envtests
1 parent 3f265c3 commit 6eae7d8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pkg/envtest/crd.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,6 @@ func CreateCRDs(config *rest.Config, crds []*apiextensionsv1.CustomResourceDefin
278278

279279
// renderCRDs iterate through options.Paths and extract all CRD files.
280280
func renderCRDs(options *CRDInstallOptions) ([]*apiextensionsv1.CustomResourceDefinition, error) {
281-
var (
282-
err error
283-
info os.FileInfo
284-
files []string
285-
)
286-
287281
type GVKN struct {
288282
GVK schema.GroupVersionKind
289283
Name string
@@ -292,7 +286,12 @@ func renderCRDs(options *CRDInstallOptions) ([]*apiextensionsv1.CustomResourceDe
292286
crds := map[GVKN]*apiextensionsv1.CustomResourceDefinition{}
293287

294288
for _, path := range options.Paths {
295-
var filePath = path
289+
var (
290+
err error
291+
info os.FileInfo
292+
files []string
293+
filePath = path
294+
)
296295

297296
// Return the error if ErrorIfPathMissing exists
298297
if info, err = os.Stat(path); os.IsNotExist(err) {

0 commit comments

Comments
 (0)