-
Notifications
You must be signed in to change notification settings - Fork 1.8k
cmd/operator-sdk/olmcatalog/gen-csv.go: --write-config to write CSV config to disk #1346
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
cmd/operator-sdk/olmcatalog/gen-csv.go: --write-config to write CSV config to disk #1346
Conversation
b531638
to
bf49c18
Compare
/retest |
After thinking about this further, its probably better to have a |
scaffold directly instead of reading from a file. CSVConfig is now a scaffold-able file. cmd/operator-sdk/olmcatalog: add the --write-csv-config flag so users can write a default CSV config to a default or custom path
…d add notes on flags
…ig in 'olm-catalog gen-csv'
1a8a666
to
b677bd5
Compare
/hold Going to wait on this until we figure out configuration file issues. |
@estroz: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@estroz: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
/remove-lifecycle |
@@ -56,18 +57,18 @@ 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.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") | |||
genCSVCmd.Flags().StringVar(&csvConfigPath, "csv-config", "", "Path to CSV config file. If unset, default file paths are used") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is good to keep the default path in the info.
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
writeCSVConfigOpt = "write-csv-config" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space
i, err := (&catalog.CSVConfig{}).GetInput() | ||
if err != nil { | ||
log.Fatalf("Error retrieving CSV config path: %v", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could not the path be an attribute of the struct and the check be made in the Validate func of it?
return err | ||
} | ||
} | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it creating a new input.Config? Could not it be a NewConfig in its struct, or at least has a more meaningful name?
} | ||
return nil | ||
} | ||
func writeConfig(s *scaffold.Scaffold, cfg *input.Config) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func writeConfig(s *scaffold.Scaffold, cfg *input.Config) error { | |
func writeCSVConfig(s *scaffold.Scaffold, cfg *input.Config) error { |
} else { | ||
log.Info("Using default CSV config.") | ||
csvCfgFile = &catalog.CSVConfigFile{} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could not it be improved?
By default, the default CSVFile be set then if do not find it or the customized one return an error?
Could not the logic be when the new struct is created?
Description of the change:
internal/pkg/scaffold/olm-catalog
: Use aCSVConfigFile
in a CSV scaffold directly instead of reading from a file.CSVConfig
is now a scaffold that contains aCSVConfigFile
with the actual data to write.cmd/operator-sdk/olmcatalog/gen-csv.go
: Add--write-csv-config
flag to botholm-catalog
andolm-catalog gen-csv
so users can write a CSV config to a default path or the one passed to--write-csv-config
.Motivation for the change: #1259 does not directly pertain to the changes here but brought to my attention that CSV config files are not well understood.
--write-config
should help because it creates a default config with all fields populated.