-
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
Open
ankitathomas
wants to merge
2
commits into
operator-framework:main
Choose a base branch
from
ankitathomas:search
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+693
−1
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package olmv1 | ||
|
|
||
| import ( | ||
| "os" | ||
|
|
||
| "github.com/operator-framework/kubectl-operator/internal/cmd/internal/log" | ||
| v1action "github.com/operator-framework/kubectl-operator/internal/pkg/v1/action" | ||
| "github.com/operator-framework/kubectl-operator/pkg/action" | ||
| "github.com/spf13/cobra" | ||
| "github.com/spf13/pflag" | ||
| ) | ||
|
|
||
| // NewCatalogInstalledGetCmd handles get commands in the form of: | ||
| // catalog(s) [catalog_name] - this will either list all the installed operators | ||
| // if no catalog_name has been provided or display the details of the specific | ||
| // one otherwise | ||
| func NewCatalogSearchCmd(cfg *action.Configuration) *cobra.Command { | ||
| i := v1action.NewCatalogSearch(cfg) | ||
| i.Logf = log.Printf | ||
|
|
||
| cmd := &cobra.Command{ | ||
| Use: "catalog", | ||
| Aliases: []string{"catalogs"}, | ||
| Args: cobra.RangeArgs(0, 1), | ||
| Short: "Search catalogs for installable operators matching parameters", | ||
| Run: func(cmd *cobra.Command, args []string) { | ||
| catalogContents, err := i.Run(cmd.Context()) | ||
| if err != nil { | ||
| log.Fatalf("failed querying catalog(s): %v", err) | ||
| } | ||
| switch i.OutputFormat { | ||
| case "", "table": | ||
| printFormattedDeclCfg(os.Stdout, catalogContents, i.ListVersions) | ||
| case "json": | ||
| printDeclCfgJSON(os.Stdout, catalogContents) | ||
| case "yaml": | ||
| printDeclCfgYAML(os.Stdout, catalogContents) | ||
| default: | ||
| log.Fatalf("unsupported output format %s: allwed formats are (json|yaml|table)", i.OutputFormat) | ||
| } | ||
| }, | ||
| } | ||
| bindCatalogSearchFlags(cmd.Flags(), i) | ||
|
|
||
| return cmd | ||
| } | ||
|
|
||
| func bindCatalogSearchFlags(fs *pflag.FlagSet, i *v1action.CatalogSearch) { | ||
| fs.StringVar(&i.Catalog, "catalog", "", "Catalog to search on. If not provided, all available catalogs are searched.") | ||
| fs.StringVarP(&i.Selector, "selector", "l", "", "Selector (label query) to filter catalogs on, supports '=', '==', and '!='") | ||
| fs.StringVarP(&i.OutputFormat, "output", "o", "", "output format. One of: (yaml|json)") | ||
| fs.BoolVar(&i.ListVersions, "list-versions", false, "List all versions available for each package") | ||
| fs.StringVar(&i.Package, "package", "", "Search for package by name. If empty, all available packages will be listed") | ||
| fs.StringVar(&i.CatalogdNamespace, "catalogd-namespace", "olmv1-system", "Namespace for the catalogd controller") | ||
| fs.StringVar(&i.Timeout, "timeout", "5m", "Timeout for fetching catalog contents") | ||
| // installable vs uninstallable, all versions, channels | ||
| // fs.StringVar(&i.showAll, "image", "", "Image reference for the catalog source. Leave unset to retain the current image.") | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.