Skip to content

Commit

Permalink
Merge pull request #1610 from replicatedhq/92865
Browse files Browse the repository at this point in the history
Clarify options for defining preflights
  • Loading branch information
paigecalvert authored Nov 16, 2023
2 parents 4ab4efb + 39bae0e commit a577c50
Show file tree
Hide file tree
Showing 40 changed files with 943 additions and 715 deletions.
7 changes: 2 additions & 5 deletions docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,10 @@ pagination_next: null
<p>Define and verify installation environment requirements.</p>
</li>
<li>
<a href="vendor/preflight-helm-defining">Define preflights for Helm charts</a>
<a href="vendor/preflight-defining">Define preflight checks</a>
</li>
<li>
<a href="vendor/preflight-kots-defining">Define preflights for KOTS installations</a>
</li>
<li>
<a href="vendor/preflight-running">Run preflight checks for Helm installations</a>
<a href="vendor/preflight-running">Run preflight checks for Helm CLI installations</a>
</li>
<li>
<a href="https://play.instruqt.com/embed/replicated/tracks/avoiding-installation-pitfalls?token=em_gJjtIzzTTtdd5RFG">Preflight checks lab in Instruqt</a>
Expand Down
24 changes: 24 additions & 0 deletions docs/partials/preflights/_http-requests-cr.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
```yaml
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: preflight-checks
spec:
collectors:
- http:
collectorName: slack
get:
url: https://api.slack.com/methods/api.test
analyzers:
- textAnalyze:
checkName: Slack Accessible
fileName: slack.json
regex: '"status": 200,'
outcomes:
- pass:
when: "true"
message: "Can access the Slack API"
- fail:
when: "false"
message: "Cannot access the Slack API. Check that the server can reach the internet and check [status.slack.com](https://status.slack.com)."
```
32 changes: 32 additions & 0 deletions docs/partials/preflights/_http-requests-secret.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
```yaml
apiVersion: v1
kind: Secret
metadata:
labels:
troubleshoot.sh/kind: preflight
name: "{{ .Release.Name }}-preflight-config"
stringData:
preflight.yaml: |
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: preflight-sample
spec:
collectors:
- http:
collectorName: slack
get:
url: https://api.slack.com/methods/api.test
analyzers:
- textAnalyze:
checkName: Slack Accessible
fileName: slack.json
regex: '"status": 200,'
outcomes:
- pass:
when: "true"
message: "Can access the Slack API"
- fail:
when: "false"
message: "Cannot access the Slack API. Check that the server can reach the internet and check [status.slack.com](https://status.slack.com)."
```
37 changes: 37 additions & 0 deletions docs/partials/preflights/_k8s-distro-cr.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
```yaml
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: my-app
spec:
analyzers:
- distribution:
checkName: Kubernetes distribution
outcomes:
- fail:
when: "== docker-desktop"
message: The application does not support Docker Desktop Clusters
- fail:
when: "== microk8s"
message: The application does not support Microk8s Clusters
- fail:
when: "== minikube"
message: The application does not support Minikube Clusters
- pass:
when: "== eks"
message: EKS is a supported distribution
- pass:
when: "== gke"
message: GKE is a supported distribution
- pass:
when: "== aks"
message: AKS is a supported distribution
- pass:
when: "== kurl"
message: KURL is a supported distribution
- pass:
when: "== digitalocean"
message: DigitalOcean is a supported distribution
- warn:
message: Unable to determine the distribution of Kubernetes
```
45 changes: 45 additions & 0 deletions docs/partials/preflights/_k8s-distro-secret.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
```yaml
apiVersion: v1
kind: Secret
metadata:
labels:
troubleshoot.sh/kind: preflight
name: "{{ .Release.Name }}-preflight-config"
stringData:
preflight.yaml: |
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: preflight-sample
spec:
analyzers:
- distribution:
checkName: Kubernetes distribution
outcomes:
- fail:
when: "== docker-desktop"
message: The application does not support Docker Desktop Clusters
- fail:
when: "== microk8s"
message: The application does not support Microk8s Clusters
- fail:
when: "== minikube"
message: The application does not support Minikube Clusters
- pass:
when: "== eks"
message: EKS is a supported distribution
- pass:
when: "== gke"
message: GKE is a supported distribution
- pass:
when: "== aks"
message: AKS is a supported distribution
- pass:
when: "== kurl"
message: KURL is a supported distribution
- pass:
when: "== digitalocean"
message: DigitalOcean is a supported distribution
- warn:
message: Unable to determine the distribution of Kubernetes
```
20 changes: 20 additions & 0 deletions docs/partials/preflights/_k8s-version-cr.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```yaml
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: my-app
spec:
analyzers:
- clusterVersion:
outcomes:
- fail:
when: "< 1.25.0"
message: The application requires Kubernetes 1.25.0 or later, and recommends 1.28.0.
uri: https://www.kubernetes.io
- warn:
when: "< 1.28.0"
message: Your cluster meets the minimum version of Kubernetes, but we recommend you update to 1.28.0 or later.
uri: https://kubernetes.io
- pass:
message: Your cluster meets the recommended and required versions of Kubernetes.
```
28 changes: 28 additions & 0 deletions docs/partials/preflights/_k8s-version-secret.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
```yaml
apiVersion: v1
kind: Secret
metadata:
labels:
troubleshoot.sh/kind: preflight
name: "{{ .Release.Name }}-preflight-config"
stringData:
preflight.yaml: |
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: preflight-sample
spec:
analyzers:
- clusterVersion:
outcomes:
- fail:
when: "< 1.25.0"
message: The application requires Kubernetes 1.25.0 or later, and recommends 1.28.0.
uri: https://www.kubernetes.io
- warn:
when: "< 1.28.0"
message: Your cluster meets the minimum version of Kubernetes, but we recommend you update to 1.28.0 or later.
uri: https://kubernetes.io
- pass:
message: Your cluster meets the recommended and required versions of Kubernetes.
```
26 changes: 26 additions & 0 deletions docs/partials/preflights/_mysql-cr.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```yaml
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: my-app
spec:
collectors:
- mysql:
collectorName: mysql
uri: 'repl{{ ConfigOption "db_user" }}:repl{{ConfigOption "db_password" }}@tcp(repl{{ ConfigOption "db_host" }}:repl{{ConfigOption "db_port" }})/repl{{ ConfigOption "db_name" }}'
analyzers:
- mysql:
# `strict: true` prevents installation from continuing if the preflight check fails
strict: true
checkName: Must be MySQL 8.x or later
collectorName: mysql
outcomes:
- fail:
when: connected == false
message: Cannot connect to MySQL server
- fail:
when: version < 8.x
message: The MySQL server must be at least version 8
- pass:
message: The MySQL server is ready
```
36 changes: 36 additions & 0 deletions docs/partials/preflights/_mysql-secret.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
```yaml
apiVersion: v1
kind: Secret
metadata:
labels:
troubleshoot.sh/kind: preflight
name: "{{ .Release.Name }}-preflight-config"
stringData:
preflight.yaml: |
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: preflight-sample
spec:
{{ if eq .Values.global.mysql.enabled true }}
collectors:
- mysql:
collectorName: mysql
uri: '{{ .Values.global.externalDatabase.user }}:{{ .Values.global.externalDatabase.password }}@tcp({{ .Values.global.externalDatabase.host }}:{{ .Values.global.externalDatabase.port }})/{{ .Values.global.externalDatabase.database }}?tls=false'
{{ end }}
analyzers:
{{ if eq .Values.global.mysql.enabled true }}
- mysql:
checkName: Must be MySQL 8.x or later
collectorName: mysql
outcomes:
- fail:
when: connected == false
message: Cannot connect to MySQL server
- fail:
when: version < 8.x
message: The MySQL server must be at least version 8
- pass:
message: The MySQL server is ready
{{ end }}
```
Empty file.
24 changes: 24 additions & 0 deletions docs/partials/preflights/_node-count-secret.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
```yaml
apiVersion: v1
kind: Secret
metadata:
labels:
troubleshoot.sh/kind: preflight
name: "{{ .Release.Name }}-preflight-config"
stringData:
preflight.yaml: |
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: preflight-sample
spec:
analyzers:
- nodeResources:
checkName: Node Count Check
outcomes:
- fail:
when: 'count() > {{ .Values.global.maxNodeCount }}'
message: "The cluster has more than {{ .Values.global.maxNodeCount }} nodes."
- pass:
message: You have the correct number of nodes.
```
17 changes: 17 additions & 0 deletions docs/partials/preflights/_node-cpu-cr.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```yaml
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: my-app
spec:
analyzers:
- nodeResources:
checkName: Total CPU Cores in the cluster is 4 or greater
outcomes:
- fail:
when: "sum(cpuCapacity) < 4"
message: The cluster must contain at least 4 cores
uri: https://kurl.sh/docs/install-with-kurl/system-requirements
- pass:
message: There are at least 4 cores in the cluster
```
25 changes: 25 additions & 0 deletions docs/partials/preflights/_node-cpu-secret.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
```yaml
apiVersion: v1
kind: Secret
metadata:
labels:
troubleshoot.sh/kind: preflight
name: "{{ .Release.Name }}-preflight-config"
stringData:
preflight.yaml: |
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: preflight-sample
spec:
analyzers:
- nodeResources:
checkName: Total CPU Cores in the cluster is 4 or greater
outcomes:
- fail:
when: "sum(cpuCapacity) < 4"
message: The cluster must contain at least 4 cores
uri: https://kurl.sh/docs/install-with-kurl/system-requirements
- pass:
message: There are at least 4 cores in the cluster
```
21 changes: 21 additions & 0 deletions docs/partials/preflights/_node-ephem-storage-cr.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```yaml
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: my-app
spec:
analyzers:
- nodeResources:
checkName: Every node in the cluster must have at least 40 GB of ephemeral storage, with 100 GB recommended
outcomes:
- fail:
when: "min(ephemeralStorageCapacity) < 40Gi"
message: All nodes must have at least 40 GB of ephemeral storage.
uri: https://kurl.sh/docs/install-with-kurl/system-requirements
- warn:
when: "min(ephemeralStorageCapacity) < 100Gi"
message: All nodes are recommended to have at least 100 GB of ephemeral storage.
uri: https://kurl.sh/docs/install-with-kurl/system-requirements
- pass:
message: All nodes have at least 100 GB of ephemeral storage.
```
Loading

0 comments on commit a577c50

Please sign in to comment.