Skip to content

Commit

Permalink
Better results
Browse files Browse the repository at this point in the history
  • Loading branch information
marccampbell committed Jul 19, 2019
1 parent a96e172 commit 33a08ff
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 43 deletions.
18 changes: 16 additions & 2 deletions cmd/preflight/cli/interactive_results.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func drawHeader(preflightName string) {
termWidth, _ := ui.TerminalDimensions()

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

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

Expand Down Expand Up @@ -272,3 +272,17 @@ func showSaved(filename string) {

isShowingSaved = true
}

func appName(preflightName string) string {
words := strings.Split(strings.Title(strings.Replace(preflightName, "-", " ", -1)), " ")
casedWords := []string{}
for _, word := range words {
if strings.ToLower(word) == "ai" {
casedWords = append(casedWords, "AI")
} else {
casedWords = append(casedWords, word)
}
}

return strings.Join(casedWords, " ")
}
54 changes: 13 additions & 41 deletions config/samples/troubleshoot_v1beta1_preflight.yaml
Original file line number Diff line number Diff line change
@@ -1,68 +1,40 @@
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Preflight
metadata:
name: sample-app
name: shiny-new-ai
spec:
analyzers:
- clusterVersion:
outcomes:
- fail:
when: "< 1.14.0"
message: Sorry, this application requires at least Kubernetes 1.14.0. Please update your Kubernetes cluster before installing.
uri: https://help.replicated.com/kubernetes-version
when: "< 1.13.0"
message: Sorry, ShinyNew.ai requires at least Kubernetes 1.14.0. Please update your Kubernetes cluster before installing.
uri: https://enterprise.shinynew.ai/install/requirements/kubernetes
- warn:
when: "< 1.15.0"
message: You have barely enough kubernetes
uri: https://help.replicated.com/kubernetes-version
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.
uri: https://enterprise.shinynew.ai/install/requirements/kubernetes
- pass:
message: Good job keeping k8s current
message: The version of Kubernetes you have installed meets the required and recommended versions.
- storageClass:
checkName: Required storage classes
storageClassName: "microk8s-hostpath"
outcomes:
- fail:
message: The micr0k8s storage class thing was not found
message: The required storage class was not found in the cluster.
- pass:
message: The required storage class was found in the cluster.
- secret:
checkName: PG URI
secretName: postgres
namespace: default
key: uri
outcomes:
- fail:
message: You don't have a pg uri secret
- pass:
message: Probably a green light connecting to pg

# - manifests:
# - secret:
# namespace: default
# name: shhh
# key: top-secret
# fail:
# message: The top secret secret is missing
# pass:
# message: You know the secret
- ingress:
namespace: default
ingressName: connect-to-me
ingressName: my-app-ingress
outcomes:
- fail:
message: The ingress isn't ingressing
message: Expected to find an ingress named "my-app-ingress".
- pass:
message: All systems ok on ingress
# - imagePullSecret:
# name: replicated
# namespace: my-app
# fail:
# message: Can't pull the images
# pass:
# message: Connected to docker registry
- customResourceDefinition:
message: Expected ingress was found.
customResourceDefinitionName: rook
outcomes:
- fail:
message: You don't have rook installed
message: Rook is required for ShinyNew.ai. Rook was not found in the cluster.
- pass:
message: Found rook!
message: Found a supported version of Rook installed and running in the cluster.

0 comments on commit 33a08ff

Please sign in to comment.