Skip to content
Open
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
15 changes: 12 additions & 3 deletions pkg/cli/admin/mustgather/mustgather.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ func (o *MustGatherOptions) completeImages(ctx context.Context) error {
return fmt.Errorf("unable to resolve image stream '%v': %v", imageStream, err)
}
}
// If no images or --all flag is set, use default must-gather image
if len(o.Images) == 0 || o.AllImages {
var image string
var err error
Expand All @@ -284,12 +285,20 @@ func (o *MustGatherOptions) completeImages(ctx context.Context) error {

pluginImages, err = o.annotatedCSVs(ctx)
if err != nil {
return err
return fmt.Errorf("failed to list CSVs: %v", err)
}
for _, csv := range csvs.Items {
ann := csv.GetAnnotations()
if v, ok := ann[mgAnnotation]; ok {
pluginImages[v] = struct{}{}
} else {
o.log("WARNING: CSV operator %s doesn't have the must-gather-image annotation.", csv.GetName())
}
}

cos, err := o.ConfigClient.ConfigV1().ClusterOperators().List(ctx, metav1.ListOptions{})
if err != nil {
return err
return fmt.Errorf("failed to list ClusterOperators: %v", err)
}
for _, item := range cos.Items {
ann := item.GetAnnotations()
Expand All @@ -304,7 +313,7 @@ func (o *MustGatherOptions) completeImages(ctx context.Context) error {
}
}
o.log("Using must-gather plug-in image: %s", strings.Join(o.Images, ", "))

return nil
}

Expand Down