@@ -90,6 +90,10 @@ const (
9090
9191// InstallCRDs installs a collection of CRDs into a cluster by reading the crd yaml files from a directory.
9292func InstallCRDs (config * rest.Config , options CRDInstallOptions ) ([]* apiextensionsv1.CustomResourceDefinition , error ) {
93+ if config == nil {
94+ return nil , fmt .Errorf ("must provide non-nil rest.Config to InstallCRDs" )
95+ }
96+
9397 defaultCRDOptions (& options )
9498
9599 // Read the CRD yamls into options.CRDs
@@ -142,6 +146,10 @@ func defaultCRDOptions(o *CRDInstallOptions) {
142146
143147// WaitForCRDs waits for the CRDs to appear in discovery.
144148func WaitForCRDs (config * rest.Config , crds []* apiextensionsv1.CustomResourceDefinition , options CRDInstallOptions ) error {
149+ if config == nil {
150+ return fmt .Errorf ("must provide non-nil rest.Config to WaitForCRDs" )
151+ }
152+
145153 // Add each CRD to a map of GroupVersion to Resource
146154 waitingFor := map [schema.GroupVersion ]* sets.Set [string ]{}
147155 for _ , crd := range crds {
@@ -215,6 +223,10 @@ func (p *poller) poll(ctx context.Context) (done bool, err error) {
215223
216224// UninstallCRDs uninstalls a collection of CRDs by reading the crd yaml files from a directory.
217225func UninstallCRDs (config * rest.Config , options CRDInstallOptions ) error {
226+ if config == nil {
227+ return fmt .Errorf ("must provide non-nil rest.Config to UninstallCRDs" )
228+ }
229+
218230 // Read the CRD yamls into options.CRDs
219231 if err := ReadCRDFiles (& options ); err != nil {
220232 return err
@@ -242,6 +254,10 @@ func UninstallCRDs(config *rest.Config, options CRDInstallOptions) error {
242254
243255// CreateCRDs creates the CRDs.
244256func CreateCRDs (config * rest.Config , crds []* apiextensionsv1.CustomResourceDefinition ) error {
257+ if config == nil {
258+ return fmt .Errorf ("must provide non-nil rest.Config to CreateCRDs" )
259+ }
260+
245261 cs , err := client .New (config , client.Options {})
246262 if err != nil {
247263 return fmt .Errorf ("unable to create client: %w" , err )
0 commit comments