allow it to disable CRD creation
This commit is contained in:
		| @@ -40,6 +40,7 @@ type Config struct { | |||||||
| 	InCluster      bool   `json:"inCluster"` | 	InCluster      bool   `json:"inCluster"` | ||||||
| 	KubeConfigFile string `json:"kubeConfigFile"` | 	KubeConfigFile string `json:"kubeConfigFile"` | ||||||
| 	UseTPR         bool   `json:"useTPR"` // Flag option to use TPRs instead of CRDs | 	UseTPR         bool   `json:"useTPR"` // Flag option to use TPRs instead of CRDs | ||||||
|  | 	NoCrdCreation  bool   `json:"noCrdCreation"` // Flag to disable creation of CRDs at cluster level | ||||||
| } | } | ||||||
|  |  | ||||||
| // Open returns a storage using Kubernetes third party resource. | // Open returns a storage using Kubernetes third party resource. | ||||||
| @@ -85,7 +86,7 @@ func (c *Config) open(logger logrus.FieldLogger, waitForResources bool) (*client | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	ctx, cancel := context.WithCancel(context.Background()) | 	ctx, cancel := context.WithCancel(context.Background()) | ||||||
|  | 	if !c.NoCrdCreation { | ||||||
| 		logger.Info("creating custom Kubernetes resources") | 		logger.Info("creating custom Kubernetes resources") | ||||||
| 		if !cli.registerCustomResources(c.UseTPR) { | 		if !cli.registerCustomResources(c.UseTPR) { | ||||||
| 			if waitForResources { | 			if waitForResources { | ||||||
| @@ -118,6 +119,7 @@ func (c *Config) open(logger logrus.FieldLogger, waitForResources bool) (*client | |||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	// If the client is closed, stop trying to create resources. | 	// If the client is closed, stop trying to create resources. | ||||||
| 	cli.cancel = cancel | 	cli.cancel = cancel | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user