Skip to content

Commit 33a08ff

Browse files
committed
Better results
1 parent a96e172 commit 33a08ff

File tree

2 files changed

+29
-43
lines changed

2 files changed

+29
-43
lines changed

cmd/preflight/cli/interactive_results.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func drawHeader(preflightName string) {
9393
termWidth, _ := ui.TerminalDimensions()
9494

9595
title := widgets.NewParagraph()
96-
title.Text = fmt.Sprintf("%s Preflight Checks", strings.Title(strings.Replace(preflightName, "-", " ", -1)))
96+
title.Text = fmt.Sprintf("%s Preflight Checks", appName(preflightName))
9797
title.TextStyle.Fg = ui.ColorWhite
9898
title.TextStyle.Bg = ui.ColorClear
9999
title.TextStyle.Modifier = ui.ModifierBold
@@ -223,7 +223,7 @@ func save(preflightName string, analyzeResults []*analyzerunner.AnalyzeResult) (
223223
os.Remove(filename)
224224
}
225225

226-
results := fmt.Sprintf("%s Preflight Checks\n\n", strings.Title(strings.Replace(preflightName, "-", " ", -1)))
226+
results := fmt.Sprintf("%s Preflight Checks\n\n", appName(preflightName))
227227
for _, analyzeResult := range analyzeResults {
228228
result := ""
229229

@@ -272,3 +272,17 @@ func showSaved(filename string) {
272272

273273
isShowingSaved = true
274274
}
275+
276+
func appName(preflightName string) string {
277+
words := strings.Split(strings.Title(strings.Replace(preflightName, "-", " ", -1)), " ")
278+
casedWords := []string{}
279+
for _, word := range words {
280+
if strings.ToLower(word) == "ai" {
281+
casedWords = append(casedWords, "AI")
282+
} else {
283+
casedWords = append(casedWords, word)
284+
}
285+
}
286+
287+
return strings.Join(casedWords, " ")
288+
}
Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,40 @@
11
apiVersion: troubleshoot.replicated.com/v1beta1
22
kind: Preflight
33
metadata:
4-
name: sample-app
4+
name: shiny-new-ai
55
spec:
66
analyzers:
77
- clusterVersion:
88
outcomes:
99
- fail:
10-
when: "< 1.14.0"
11-
message: Sorry, this application requires at least Kubernetes 1.14.0. Please update your Kubernetes cluster before installing.
12-
uri: https://help.replicated.com/kubernetes-version
10+
when: "< 1.13.0"
11+
message: Sorry, ShinyNew.ai requires at least Kubernetes 1.14.0. Please update your Kubernetes cluster before installing.
12+
uri: https://enterprise.shinynew.ai/install/requirements/kubernetes
1313
- warn:
1414
when: "< 1.15.0"
15-
message: You have barely enough kubernetes
16-
uri: https://help.replicated.com/kubernetes-version
15+
message: The version of Kubernetes you are running meets the minimum requirements to run ShineyNew.ai. It's recommended to run Kubernetes 1.15.0 or later.
16+
uri: https://enterprise.shinynew.ai/install/requirements/kubernetes
1717
- pass:
18-
message: Good job keeping k8s current
18+
message: The version of Kubernetes you have installed meets the required and recommended versions.
1919
- storageClass:
2020
checkName: Required storage classes
2121
storageClassName: "microk8s-hostpath"
2222
outcomes:
2323
- fail:
24-
message: The micr0k8s storage class thing was not found
24+
message: The required storage class was not found in the cluster.
2525
- pass:
2626
message: The required storage class was found in the cluster.
27-
- secret:
28-
checkName: PG URI
29-
secretName: postgres
30-
namespace: default
31-
key: uri
32-
outcomes:
33-
- fail:
34-
message: You don't have a pg uri secret
35-
- pass:
36-
message: Probably a green light connecting to pg
37-
38-
# - manifests:
39-
# - secret:
40-
# namespace: default
41-
# name: shhh
42-
# key: top-secret
43-
# fail:
44-
# message: The top secret secret is missing
45-
# pass:
46-
# message: You know the secret
4727
- ingress:
4828
namespace: default
49-
ingressName: connect-to-me
29+
ingressName: my-app-ingress
5030
outcomes:
5131
- fail:
52-
message: The ingress isn't ingressing
32+
message: Expected to find an ingress named "my-app-ingress".
5333
- pass:
54-
message: All systems ok on ingress
55-
# - imagePullSecret:
56-
# name: replicated
57-
# namespace: my-app
58-
# fail:
59-
# message: Can't pull the images
60-
# pass:
61-
# message: Connected to docker registry
62-
- customResourceDefinition:
34+
message: Expected ingress was found.
6335
customResourceDefinitionName: rook
6436
outcomes:
6537
- fail:
66-
message: You don't have rook installed
38+
message: Rook is required for ShinyNew.ai. Rook was not found in the cluster.
6739
- pass:
68-
message: Found rook!
40+
message: Found a supported version of Rook installed and running in the cluster.

0 commit comments

Comments
 (0)