-
Notifications
You must be signed in to change notification settings - Fork 43
clustercatalog content discovery for packages and bundle versions #239
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ankita Thomas <ankithom@redhat.com>
| "github.com/spf13/pflag" | ||
| ) | ||
|
|
||
| // NewCatalogInstalledGetCmd handles get commands in the form of: |
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.
| // NewCatalogInstalledGetCmd handles get commands in the form of: | |
| // NewCatalogSearchCmd handles get commands in the form of: |
| Short: "Search for packages", | ||
| Long: "Search one or all available catalogs for packages or versions", | ||
| } | ||
| searchCmd.AddCommand(olmv1.NewCatalogSearchCmd(cfg)) |
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.
As this command is for searching through one or more catalogs and also users might type catalogs plural, we could considering add an alias:
searchCmd.Aliases = []string{"catalogs"}
| } | ||
|
|
||
| if len(i.Timeout) > 0 { | ||
| if catalogListTimeout, err := time.ParseDuration(i.Timeout); err == 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.
Errors from time.ParseDuration(i.Timeout) are silently ignored here. We should add an error check here to indicate an invalid timeout.
| Others: []declcfg.Meta{}, | ||
| } | ||
| for _, p := range dcfg.Packages { | ||
| if p.Name == packageName { |
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.
We should also add an error here when a package isn't found as we risk giving back empty results.
| } | ||
| } | ||
| for _, e := range dcfg.Channels { | ||
| if e.Package == packageName { |
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.
Same comment as above for returning error when a package with the name specified isn't found.
| readyAddresses = append(readyAddresses, subset.Addresses...) | ||
| } | ||
|
|
||
| randAddress := rand.Int31n(int32(len(readyAddresses))) |
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.
This will panic if readyAddresses is empty. So we should add a check before this to ensure readyAddresses is non-empty
| } | ||
| baseURL, err := url.Parse(cc.Status.URLs.Base) | ||
| if err != nil { | ||
| return nil, 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.
| return nil, err | |
| return nil, fmt.Errorf("failed to parse ClusterCatalog URL %q: %w", cc.Status.URLs.Base, err) | |
Adds a new command to list contents of available, healthy ClusterCatalogs.
Addresses operator-framework/operator-controller#1768
By default, the command lists all available packages and channels from all catalogs present on cluster.
--timeoutcan be modified to support listing large catalogs.The queried catalogs can be restricted via a label selector, specified by
--selector, and the output can be restricted to a specific package with--package.Currently supports yaml and json outputs for the catalog FBC, in addition to the table output.