diff --git a/cmd/operator-sdk/olmcatalog/gen-csv.go b/cmd/operator-sdk/olmcatalog/gen-csv.go index 720f60d5232..1638d37675a 100644 --- a/cmd/operator-sdk/olmcatalog/gen-csv.go +++ b/cmd/operator-sdk/olmcatalog/gen-csv.go @@ -32,10 +32,12 @@ import ( ) var ( - csvVersion string - fromVersion string - csvConfigPath string - updateCRDs bool + csvVersion string + fromVersion string + csvConfigPath string + updateCRDs bool + absProjectPath = projutil.MustGetwd() + projectName = filepath.Base(absProjectPath) ) func newGenCSVCmd() *cobra.Command { @@ -54,6 +56,7 @@ Configure CSV generation by writing a config file 'deploy/olm-catalog/csv-config } genCSVCmd.Flags().StringVar(&csvVersion, "csv-version", "", "Semantic version of the CSV") + genCSVCmd.Flags().StringVar(&projectName, "project-name", projectName, "Operator name to use while generating CSV") genCSVCmd.MarkFlagRequired("csv-version") genCSVCmd.Flags().StringVar(&fromVersion, "from-version", "", "Semantic version of an existing CSV to use as a base") genCSVCmd.Flags().StringVar(&csvConfigPath, "csv-config", "", "Path to CSV config file. Defaults to deploy/olm-catalog/csv-config.yaml") @@ -71,10 +74,9 @@ func genCSVFunc(cmd *cobra.Command, args []string) error { return err } - absProjectPath := projutil.MustGetwd() cfg := &input.Config{ AbsProjectPath: absProjectPath, - ProjectName: filepath.Base(absProjectPath), + ProjectName: projectName, } if projutil.IsOperatorGo() { cfg.Repo = projutil.CheckAndGetProjectGoPkg()