Skip to content
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

fix: Improve kamel get to enable specifying integration name #897

Merged
merged 1 commit into from
Aug 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions pkg/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ func newCmdGet(rootCmdOptions *RootCmdOptions) *cobra.Command {
RootCmdOptions: rootCmdOptions,
}
cmd := cobra.Command{
Use: "get",
Short: "Get all integrations deployed on Kubernetes",
Long: `Get the status of all integrations deployed on on Kubernetes.`,
Use: "get [integration]",
Short: "Get integrations deployed on Kubernetes",
Long: `Get the status of integrations deployed on on Kubernetes.`,
RunE: options.run,
}

return &cmd
}

func (o *getCmdOptions) run(_ *cobra.Command, _ []string) error {
func (o *getCmdOptions) run(_ *cobra.Command, args []string) error {
c, err := o.GetCmdClient()
if err != nil {
return err
Expand All @@ -62,7 +62,14 @@ func (o *getCmdOptions) run(_ *cobra.Command, _ []string) error {

namespace := o.Namespace

err = c.List(o.Context, &k8sclient.ListOptions{Namespace: namespace}, &integrationList)
options := k8sclient.ListOptions{Namespace: namespace}
if len(args) == 1 {
if err := options.SetFieldSelector("metadata.name=" + args[0]); err != nil {
return err
}
}

err = c.List(o.Context, &options, &integrationList)
if err != nil {
return err
}
Expand Down