Skip to content

Commit aebf0a6

Browse files
Merge pull request #28285 from soltysh/use_mirrored_images
Properly default --from-repository in run-monitor
2 parents 88b5c9e + 541cdb4 commit aebf0a6

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

cmd/openshift-tests/openshift-tests.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ import (
1414
"github.com/openshift/origin/pkg/cmd/openshift-tests/disruption"
1515
"github.com/openshift/origin/pkg/cmd/openshift-tests/images"
1616
"github.com/openshift/origin/pkg/cmd/openshift-tests/monitor"
17-
run2 "github.com/openshift/origin/pkg/cmd/openshift-tests/monitor/run"
17+
run_monitor "github.com/openshift/origin/pkg/cmd/openshift-tests/monitor/run"
1818
"github.com/openshift/origin/pkg/cmd/openshift-tests/monitor/timeline"
1919
risk_analysis "github.com/openshift/origin/pkg/cmd/openshift-tests/risk-analysis"
2020
"github.com/openshift/origin/pkg/cmd/openshift-tests/run"
2121
run_disruption "github.com/openshift/origin/pkg/cmd/openshift-tests/run-disruption"
2222
run_test "github.com/openshift/origin/pkg/cmd/openshift-tests/run-test"
2323
run_upgrade "github.com/openshift/origin/pkg/cmd/openshift-tests/run-upgrade"
24-
"github.com/openshift/origin/pkg/resourcewatch/cmd"
24+
run_resourcewatch "github.com/openshift/origin/pkg/resourcewatch/cmd"
2525
testginkgo "github.com/openshift/origin/pkg/test/ginkgo"
2626
exutil "github.com/openshift/origin/test/extended/util"
2727
"github.com/sirupsen/logrus"
@@ -79,11 +79,11 @@ func main() {
7979
images.NewImagesCommand(),
8080
run_test.NewRunTestCommand(ioStreams),
8181
dev.NewDevCommand(),
82-
run2.NewRunMonitorCommand(ioStreams),
82+
run_monitor.NewRunMonitorCommand(ioStreams),
8383
monitor.NewMonitorCommand(ioStreams),
8484
disruption.NewDisruptionCommand(ioStreams),
8585
risk_analysis.NewTestFailureRiskAnalysisCommand(),
86-
cmd.NewRunResourceWatchCommand(),
86+
run_resourcewatch.NewRunResourceWatchCommand(),
8787
timeline.NewTimelineCommand(ioStreams),
8888
run_disruption.NewRunInClusterDisruptionMonitorCommand(ioStreams),
8989
)

pkg/cmd/openshift-tests/monitor/run/run_monitor_command.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
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

5355
func 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

9497
func (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.
150155
func (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

Comments
 (0)