@@ -10,6 +10,7 @@ import (
1010
1111 "github.com/openshift/origin/pkg/monitortestframework"
1212
13+ "github.com/openshift/origin/pkg/clioptions/imagesetup"
1314 "github.com/openshift/origin/pkg/monitor/monitorapi"
1415 "github.com/openshift/origin/test/extended/util/image"
1516
@@ -26,7 +27,6 @@ import (
2627type RunMonitorFlags struct {
2728 ArtifactDir string
2829 DisplayFromNow bool
29- FromRepository string
3030
3131 genericclioptions.IOStreams
3232}
@@ -77,7 +77,6 @@ func newRunCommand(name string, streams genericclioptions.IOStreams) *cobra.Comm
7777func (f * RunMonitorFlags ) BindFlags (flags * pflag.FlagSet ) {
7878 flags .StringVar (& f .ArtifactDir , "artifact-dir" , f .ArtifactDir , "The directory where monitor events will be stored." )
7979 flags .BoolVar (& f .DisplayFromNow , "display-from-now" , f .DisplayFromNow , "Only display intervals from at or after this comand was started." )
80- flags .StringVar (& f .FromRepository , "from-repository" , f .FromRepository , "A container image repository to retrieve test images from." )
8180}
8281
8382func (f * RunMonitorFlags ) ToOptions () (* RunMonitorOptions , error ) {
@@ -96,27 +95,23 @@ func (f *RunMonitorFlags) ToOptions() (*RunMonitorOptions, error) {
9695 ArtifactDir : f .ArtifactDir ,
9796 DisplayFilterFn : displayFilterFn ,
9897 IOStreams : f .IOStreams ,
99- FromRepository : f .FromRepository ,
10098 }, nil
10199}
102100
103101type RunMonitorOptions struct {
104102 ArtifactDir string
105103 DisplayFilterFn monitorapi.EventIntervalMatchesFunc
106- FromRepository string
107104
108105 genericclioptions.IOStreams
109106}
110107
111108// Run starts monitoring the cluster by invoking Start, periodically printing the
112109// events accumulated to Out. When the user hits CTRL+C or signals termination the
113110// condition intervals (all non-instantaneous events) are reported to Out.
114- func (o * RunMonitorOptions ) Run () error {
115- // set globals so that helpers will create pods with the mapped images if we create them from this process.
116- image .InitializeImages (o .FromRepository )
117-
118- fmt .Fprintf (o .Out , "Starting the monitor.\n " )
111+ func (f * RunMonitorOptions ) Run () error {
112+ fmt .Fprintf (f .Out , "Starting the monitor.\n " )
119113
114+ image .InitializeImages (imagesetup .DefaultTestImageMirrorLocation )
120115 restConfig , err := monitor .GetMonitorRESTConfig ()
121116 if err != nil {
122117 return err
@@ -127,12 +122,12 @@ func (o *RunMonitorOptions) Run() error {
127122 abortCh := make (chan os.Signal , 2 )
128123 go func () {
129124 <- abortCh
130- fmt .Fprintf (o .ErrOut , "Interrupted, terminating\n " )
125+ fmt .Fprintf (f .ErrOut , "Interrupted, terminating\n " )
131126 sampler .TearDownInClusterMonitors (restConfig )
132127 cancelFn ()
133128
134129 sig := <- abortCh
135- fmt .Fprintf (o .ErrOut , "Interrupted twice, exiting (%s)\n " , sig )
130+ fmt .Fprintf (f .ErrOut , "Interrupted twice, exiting (%s)\n " , sig )
136131 switch sig {
137132 case syscall .SIGINT :
138133 os .Exit (130 )
@@ -145,21 +140,21 @@ func (o *RunMonitorOptions) Run() error {
145140 monitorTestInfo := monitortestframework.MonitorTestInitializationInfo {
146141 ClusterStabilityDuringTest : monitortestframework .Stable ,
147142 }
148- recorder := monitor .WrapWithJSONLRecorder (monitor .NewRecorder (), o .Out , o .DisplayFilterFn )
143+ recorder := monitor .WrapWithJSONLRecorder (monitor .NewRecorder (), f .Out , f .DisplayFilterFn )
149144 m := monitor .NewMonitor (
150145 recorder ,
151146 restConfig ,
152- o .ArtifactDir ,
147+ f .ArtifactDir ,
153148 defaultmonitortests .NewMonitorTestsFor (monitorTestInfo ),
154149 )
155150 if err := m .Start (ctx ); err != nil {
156151 return err
157152 }
158- fmt .Fprintf (o .Out , "Monitor started, waiting for ctrl+C to stop...\n " )
153+ fmt .Fprintf (f .Out , "Monitor started, waiting for ctrl+C to stop...\n " )
159154
160155 <- ctx .Done ()
161156
162- fmt .Fprintf (o .Out , "Monitor shutting down, this may take up to five minutes...\n " )
157+ fmt .Fprintf (f .Out , "Monitor shutting down, this may take up to five minutes...\n " )
163158
164159 cleanupContext , cleanupCancel := context .WithTimeout (context .Background (), 5 * time .Minute )
165160 defer cleanupCancel ()
0 commit comments