99 "syscall"
1010 "time"
1111
12+ "github.com/openshift/origin/pkg/clioptions/imagesetup"
1213 "github.com/openshift/origin/pkg/monitortestframework"
1314
14- "github.com/openshift/origin/pkg/clioptions/imagesetup"
1515 "github.com/openshift/origin/pkg/monitor/monitorapi"
1616 "github.com/openshift/origin/test/extended/util/image"
1717
@@ -30,14 +30,16 @@ type RunMonitorFlags struct {
3030 DisplayFromNow bool
3131 ExactMonitorTests []string
3232 DisableMonitorTests []string
33+ FromRepository string
3334
3435 genericclioptions.IOStreams
3536}
3637
37- func NewRunMonitorOptions (streams genericclioptions.IOStreams ) * RunMonitorFlags {
38+ func NewRunMonitorOptions (streams genericclioptions.IOStreams , fromRepository string ) * RunMonitorFlags {
3839 return & RunMonitorFlags {
3940 DisplayFromNow : true ,
4041 IOStreams : streams ,
42+ FromRepository : fromRepository ,
4143 }
4244}
4345
@@ -51,7 +53,7 @@ func NewRunCommand(streams genericclioptions.IOStreams) *cobra.Command {
5153}
5254
5355func newRunCommand (name string , streams genericclioptions.IOStreams ) * cobra.Command {
54- f := NewRunMonitorOptions (streams )
56+ f := NewRunMonitorOptions (streams , imagesetup . DefaultTestImageMirrorLocation )
5557
5658 cmd := & cobra.Command {
5759 Use : name ,
@@ -89,6 +91,7 @@ func (f *RunMonitorFlags) BindFlags(flags *pflag.FlagSet) {
8991 flags .StringSliceVar (& f .ExactMonitorTests , "monitor" , f .ExactMonitorTests ,
9092 fmt .Sprintf ("list of exactly which monitors to enable. All others will be disabled. Current monitors are: [%s]" , strings .Join (monitorNames , ", " )))
9193 flags .StringSliceVar (& f .DisableMonitorTests , "disable-monitor" , f .DisableMonitorTests , "list of monitors to disable. Defaults for others will be honored." )
94+ flags .StringVar (& f .FromRepository , "from-repository" , f .FromRepository , "A container image repository to retrieve test images from." )
9295}
9396
9497func (f * RunMonitorFlags ) ToOptions () (* RunMonitorOptions , error ) {
@@ -113,6 +116,7 @@ func (f *RunMonitorFlags) ToOptions() (*RunMonitorOptions, error) {
113116 DisplayFilterFn : displayFilterFn ,
114117 MonitorTests : monitorTestRegistry ,
115118 IOStreams : f .IOStreams ,
119+ FromRepository : f .FromRepository ,
116120 }, nil
117121}
118122
@@ -140,6 +144,7 @@ type RunMonitorOptions struct {
140144 ArtifactDir string
141145 DisplayFilterFn monitorapi.EventIntervalMatchesFunc
142146 MonitorTests monitortestframework.MonitorTestRegistry
147+ FromRepository string
143148
144149 genericclioptions.IOStreams
145150}
@@ -148,9 +153,11 @@ type RunMonitorOptions struct {
148153// events accumulated to Out. When the user hits CTRL+C or signals termination the
149154// condition intervals (all non-instantaneous events) are reported to Out.
150155func (o * RunMonitorOptions ) Run () error {
156+ // set globals so that helpers will create pods with the mapped images if we create them from this process.
157+ image .InitializeImages (o .FromRepository )
158+
151159 fmt .Fprintf (o .Out , "Starting the monitor.\n " )
152160
153- image .InitializeImages (imagesetup .DefaultTestImageMirrorLocation )
154161 restConfig , err := monitor .GetMonitorRESTConfig ()
155162 if err != nil {
156163 return err
@@ -176,12 +183,15 @@ func (o *RunMonitorOptions) Run() error {
176183 }()
177184 signal .Notify (abortCh , syscall .SIGINT , syscall .SIGTERM )
178185
186+ monitorTestInfo := monitortestframework.MonitorTestInitializationInfo {
187+ ClusterStabilityDuringTest : monitortestframework .Stable ,
188+ }
179189 recorder := monitor .WrapWithJSONLRecorder (monitor .NewRecorder (), o .Out , o .DisplayFilterFn )
180190 m := monitor .NewMonitor (
181191 recorder ,
182192 restConfig ,
183193 o .ArtifactDir ,
184- o . MonitorTests ,
194+ defaultmonitortests . NewMonitorTestsFor ( monitorTestInfo ) ,
185195 )
186196 if err := m .Start (ctx ); err != nil {
187197 return err
0 commit comments