Skip to content

Commit 6d1dc62

Browse files
committed
get must-gather image from imagestream
1 parent 5089636 commit 6d1dc62

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

pkg/oc/cli/admin/mustgather/mustgather.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import (
2020
"k8s.io/kubernetes/pkg/kubectl/scheme"
2121
"k8s.io/kubernetes/pkg/kubectl/util/templates"
2222

23+
"github.com/openshift/client-go/image/clientset/versioned/typed/image/v1"
24+
25+
"github.com/openshift/origin/pkg/image/util"
2326
"github.com/openshift/origin/pkg/oc/cli/rsync"
2427
)
2528

@@ -91,8 +94,18 @@ func (o *MustGatherOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, arg
9194
o.DestDir = fmt.Sprintf("must-gather.local.%06d", rand.Int63())
9295
}
9396
if len(o.Image) == 0 {
94-
// TODO lookup cluster specific default
95-
o.Image = "quay.io/openshift/origin-must-gather:v4.0"
97+
imageClient, err := v1.NewForConfig(o.Config)
98+
if err != nil {
99+
return err
100+
}
101+
imageStream, err := imageClient.ImageStreams("openshift").Get("must-gather", metav1.GetOptions{})
102+
if err != nil {
103+
return err
104+
}
105+
var ok bool
106+
if o.Image, ok = util.ResolveLatestTaggedImage(imageStream, "latest"); !ok {
107+
return fmt.Errorf("unable to to resolve must-gather image")
108+
}
96109
}
97110
o.PrinterCreated, err = printers.NewTypeSetter(scheme.Scheme).WrapToPrinter(&printers.NamePrinter{Operation: "created"}, nil)
98111
if err != nil {

0 commit comments

Comments
 (0)