Skip to content

Commit d23cabc

Browse files
committed
introduce cluster health check subcommand for openshift-tests
1 parent f90f90a commit d23cabc

File tree

3 files changed

+494
-0
lines changed

3 files changed

+494
-0
lines changed

cmd/openshift-tests/openshift-tests.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
collectdiskcertificates "github.com/openshift/origin/pkg/cmd/openshift-tests/collect-disk-certificates"
2323
"github.com/openshift/origin/pkg/cmd/openshift-tests/dev"
2424
"github.com/openshift/origin/pkg/cmd/openshift-tests/disruption"
25+
cluster_health_check "github.com/openshift/origin/pkg/cmd/openshift-tests/health-check"
2526
"github.com/openshift/origin/pkg/cmd/openshift-tests/images"
2627
"github.com/openshift/origin/pkg/cmd/openshift-tests/list"
2728
"github.com/openshift/origin/pkg/cmd/openshift-tests/monitor"
@@ -100,6 +101,7 @@ func main() {
100101
monitor.NewMonitorCommand(ioStreams),
101102
disruption.NewDisruptionCommand(ioStreams),
102103
risk_analysis.NewTestFailureRiskAnalysisCommand(),
104+
cluster_health_check.NewTestFailureClusterHealthCheckCommand(),
103105
run_resource_watch.NewRunResourceWatchCommand(),
104106
timeline.NewTimelineCommand(ioStreams),
105107
run_disruption.NewRunInClusterDisruptionMonitorCommand(ioStreams),
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package healthcheckpkg
2+
3+
import (
4+
healthcheck "github.com/openshift/origin/pkg/health-check"
5+
"github.com/spf13/cobra"
6+
"k8s.io/kubectl/pkg/util/templates"
7+
)
8+
9+
func NewTestFailureClusterHealthCheckCommand() *cobra.Command {
10+
healthCheckOpts := &healthcheck.Options{}
11+
12+
cmd := &cobra.Command{
13+
Use: "health-check",
14+
Short: "Performs health check against the cluster",
15+
Long: templates.LongDesc(`
16+
Check cluster health, including:
17+
all machines should be in Running state;
18+
all nodes should be ready;
19+
ready node count should match or exceed running machine count;
20+
operators health ordered by dependency;
21+
`),
22+
RunE: func(cmd *cobra.Command, args []string) error {
23+
return healthCheckOpts.Run()
24+
},
25+
}
26+
cmd.Flags().StringVar(&healthCheckOpts.JUnitDir,
27+
"junit-dir", healthCheckOpts.JUnitDir,
28+
"The directory where test reports were written, and operators health file will be stored.")
29+
30+
return cmd
31+
}

0 commit comments

Comments
 (0)