Skip to content

[release-0.20] 🌱 Export envtest.ReadCRDFiles #3131

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/envtest/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func InstallCRDs(config *rest.Config, options CRDInstallOptions) ([]*apiextensio
defaultCRDOptions(&options)

// Read the CRD yamls into options.CRDs
if err := readCRDFiles(&options); err != nil {
if err := ReadCRDFiles(&options); err != nil {
return nil, fmt.Errorf("unable to read CRD files: %w", err)
}

Expand All @@ -115,8 +115,8 @@ func InstallCRDs(config *rest.Config, options CRDInstallOptions) ([]*apiextensio
return options.CRDs, nil
}

// readCRDFiles reads the directories of CRDs in options.Paths and adds the CRD structs to options.CRDs.
func readCRDFiles(options *CRDInstallOptions) error {
// ReadCRDFiles reads the directories of CRDs in options.Paths and adds the CRD structs to options.CRDs.
func ReadCRDFiles(options *CRDInstallOptions) error {
if len(options.Paths) > 0 {
crdList, err := renderCRDs(options)
if err != nil {
Expand Down Expand Up @@ -217,7 +217,7 @@ func (p *poller) poll(ctx context.Context) (done bool, err error) {
// UninstallCRDs uninstalls a collection of CRDs by reading the crd yaml files from a directory.
func UninstallCRDs(config *rest.Config, options CRDInstallOptions) error {
// Read the CRD yamls into options.CRDs
if err := readCRDFiles(&options); err != nil {
if err := ReadCRDFiles(&options); err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/envtest/crd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = Describe("Test", func() {
"testdata/crdv1_original",
},
}
err := readCRDFiles(&opt)
err := ReadCRDFiles(&opt)
Expect(err).NotTo(HaveOccurred())

expectedCRDs := sets.NewString(
Expand Down