Skip to content

Commit 7891136

Browse files
authored
Update wording for host preflights (#772)
* Update wording for host preflights * Change host preflight failure/warning message * Improve host preflight error messaging * Improve host preflight error messaging
1 parent df9066c commit 7891136

File tree

2 files changed

+43
-48
lines changed

2 files changed

+43
-48
lines changed

cmd/embedded-cluster/install.go

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ func runHostPreflights(c *cli.Context, hpf *v1beta2.HostPreflightSpec) error {
109109
}
110110
pb := spinner.Start()
111111
if c.Bool("skip-host-preflights") {
112-
pb.Infof("Skipping host preflights")
112+
pb.Infof("Host preflights skipped")
113113
pb.Close()
114114
return nil
115115
}
116116
pb.Infof("Running host preflights")
117117
output, err := preflights.Run(c.Context, hpf)
118118
if err != nil {
119119
pb.CloseWithError()
120-
return fmt.Errorf("host preflights failed: %w", err)
120+
return fmt.Errorf("host preflights failed to run: %w", err)
121121
}
122122

123123
err = output.SaveToDisk()
@@ -128,32 +128,28 @@ func runHostPreflights(c *cli.Context, hpf *v1beta2.HostPreflightSpec) error {
128128

129129
// Failures found
130130
if output.HasFail() {
131-
s := "failures"
131+
s := "preflights"
132132
if len(output.Fail) == 1 {
133-
s = "failure"
133+
s = "preflight"
134134
}
135-
msg := fmt.Sprintf("Host preflights have %d %s", len(output.Fail), s)
135+
msg := fmt.Sprintf("%d host %s failed", len(output.Fail), s)
136136
if output.HasWarn() {
137-
s = "warnings"
138-
if len(output.Warn) == 1 {
139-
s = "warning"
140-
}
141-
msg += fmt.Sprintf(" and %d %s", len(output.Warn), s)
137+
msg += fmt.Sprintf(" and %d warned", len(output.Warn))
142138
}
143139

144140
pb.Errorf(msg)
145141
pb.CloseWithError()
146142
output.PrintTableWithoutInfo()
147-
return fmt.Errorf("preflights haven't passed on the host")
143+
return fmt.Errorf("host preflight failures detected")
148144
}
149145

150146
// Warnings found
151147
if output.HasWarn() {
152-
s := "warnings"
148+
s := "preflights"
153149
if len(output.Warn) == 1 {
154-
s = "warning"
150+
s = "preflight"
155151
}
156-
pb.Warnf("Host preflights have %d %s", len(output.Warn), s)
152+
pb.Warnf("%d host %s warned", len(output.Warn), s)
157153
if c.Bool("no-prompt") {
158154
// We have warnings but we are not in interactive mode
159155
// so we just print the warnings and continue
@@ -674,7 +670,6 @@ var installCommand = &cli.Command{
674670
}
675671
logrus.Debugf("running host preflights")
676672
if err := RunHostPreflights(c); err != nil {
677-
err := fmt.Errorf("unable to finish preflight checks: %w", err)
678673
metrics.ReportApplyFinished(c, err)
679674
return err
680675
}

pkg/preflights/host-preflight.yaml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,72 +29,72 @@ spec:
2929
command: "ip"
3030
args: ["route"]
3131
analyzers:
32-
- textAnalyze:
33-
checkName: Default route
34-
fileName: host-collectors/run-host/ip-route-table.txt
35-
regex: "default"
32+
- cpu:
33+
checkName: 'CPU'
3634
outcomes:
3735
- fail:
38-
when: "false"
39-
message: "No default route found. A default route is required for cluster initialization."
36+
when: 'count < 2'
37+
message: At least 2 CPU cores are required
4038
- pass:
41-
when: "true"
42-
message: "Host has a default route."
43-
- cpu:
44-
checkName: 'Number of CPUs in the system'
39+
message: At least 2 CPU cores are present
40+
- memory:
41+
checkName: Memory
4542
outcomes:
4643
- fail:
47-
when: 'count < 2'
48-
message: At least 2 CPU cores is required
44+
when: '< 2G'
45+
message: At least 2GB of memory is required
4946
- pass:
50-
message: This node has at least 2 CPU cores
47+
message: At least 2GB of memory is present
5148
- diskUsage:
52-
checkName: embedded-cluster path usage
49+
checkName: Embedded Cluster Disk Space
5350
collectorName: embedded-cluster-path-usage
5451
outcomes:
5552
- fail:
5653
when: 'total < 40Gi'
57-
message: The filesystem at the path /var/lib/embedded-cluster has less than 40Gi of total space
54+
message: The filesystem at /var/lib/embedded-cluster has less than 40Gi of total space
5855
- pass:
59-
message: The filesystem at the path /var/lib/embedded-cluster has sufficient space
56+
message: The filesystem at /var/lib/embedded-cluster has sufficient space
6057
- diskUsage:
61-
checkName: k0s path usage
58+
checkName: k0s Disk Space
6259
collectorName: k0s-path-usage
6360
outcomes:
6461
- fail:
6562
when: 'total < 40Gi'
66-
message: The filesystem at the path /var/lib/k0s has less than 40Gi of total space
63+
message: The filesystem at /var/lib/k0s has less than 40Gi of total space
6764
- fail:
6865
when: 'used/total > 80%'
69-
message: The filesystem at the path /var/lib/k0s is more than 80% full
66+
message: The filesystem at /var/lib/k0s is more than 80% full
7067
- pass:
71-
message: The filesystem at the path /var/lib/k0s has sufficient space
68+
message: The filesystem at /var/lib/k0s has sufficient space
7269
- diskUsage:
73-
checkName: openebs path usage
70+
checkName: OpenEBS Disk Space
7471
collectorName: openebs-path-usage
7572
outcomes:
7673
- fail:
7774
when: 'total < 5Gi'
78-
message: The filesystem at the path /opt/openebs has less than 5Gi of total space
75+
message: The filesystem at /opt/openebs has less than 5Gi of total space
7976
- pass:
80-
message: The filesystem at the path /opt/openebs has sufficient space
77+
message: The filesystem at /opt/openebs has sufficient space
8178
- diskUsage:
82-
checkName: tmp path usage
79+
checkName: tmp Disk Space
8380
collectorName: tmp-path-usage
8481
outcomes:
8582
- fail:
8683
when: 'total < 5Gi'
87-
message: The filesystem at the path /tmp has less than 5Gi of total space
84+
message: The filesystem at /tmp has less than 5Gi of total space
8885
- pass:
89-
message: The filesystem at the path /tmp has sufficient space
90-
- memory:
91-
checkName: Amount of memory on the system
86+
message: The filesystem at /tmp has sufficient space
87+
- textAnalyze:
88+
checkName: Default Route
89+
fileName: host-collectors/run-host/ip-route-table.txt
90+
regex: "default"
9291
outcomes:
9392
- fail:
94-
when: '< 2G'
95-
message: At least 2G of memory is recommended
93+
when: "false"
94+
message: "No default route found. A default route is required."
9695
- pass:
97-
message: The system has at least 2G of memory
96+
when: "true"
97+
message: "Host has a default route"
9898
- ipv4Interfaces:
9999
outcomes:
100100
- fail:
@@ -104,14 +104,14 @@ spec:
104104
when: 'count >= 1'
105105
message: IPv4 interface detected
106106
- time:
107-
checkName: 'Time synchronization'
107+
checkName: System Clock
108108
outcomes:
109109
- fail:
110110
when: 'ntp == unsynchronized+inactive'
111111
message: 'System clock is not synchronized'
112112
- fail:
113113
when: 'ntp == unsynchronized+active'
114-
message: System clock not yet synchronized
114+
message: System clock is not yet synchronized
115115
- pass:
116116
when: 'ntp == synchronized+active'
117117
message: 'System clock is synchronized'

0 commit comments

Comments
 (0)