From dc80733397b56d334c7ea684157e059d216091cf Mon Sep 17 00:00:00 2001 From: GraysonNull Date: Mon, 13 Jul 2020 15:35:38 +0000 Subject: [PATCH 1/2] update sample preflight and support bundles, update diretory name --- .github/workflows/build-test-deploy.yaml | 4 +- Makefile | 4 +- examples/preflight/sample-preflight.yaml | 119 +++++++++++++----- .../sample-analyzers.yaml | 0 .../sample-collectors.yaml | 0 .../support-bundle/sample-supportbundle.yaml | 100 +++++++++++++++ .../troubleshoot/sample-supportbundle.yaml | 20 --- 7 files changed, 195 insertions(+), 52 deletions(-) rename examples/{troubleshoot => support-bundle}/sample-analyzers.yaml (100%) rename examples/{troubleshoot => support-bundle}/sample-collectors.yaml (100%) create mode 100644 examples/support-bundle/sample-supportbundle.yaml delete mode 100644 examples/troubleshoot/sample-supportbundle.yaml diff --git a/.github/workflows/build-test-deploy.yaml b/.github/workflows/build-test-deploy.yaml index 5527798b5..74c3bb4f1 100644 --- a/.github/workflows/build-test-deploy.yaml +++ b/.github/workflows/build-test-deploy.yaml @@ -89,8 +89,8 @@ jobs: path: bin/ - uses: engineerd/setup-kind@v0.2.0 - run: chmod +x bin/support-bundle - - run: ./bin/support-bundle ./examples/troubleshoot/sample-collectors.yaml - - run: ./bin/support-bundle ./examples/troubleshoot/sample-supportbundle.yaml + - run: ./bin/support-bundle ./examples/support-bundle/sample-collectors.yaml + - run: ./bin/support-bundle ./examples/support-bundle/sample-supportbundle.yaml - run: ./bin/support-bundle https://kots.io goreleaser: diff --git a/Makefile b/Makefile index a3afeaa3e..39508760c 100644 --- a/Makefile +++ b/Makefile @@ -128,8 +128,8 @@ run-preflight: preflight .PHONY: run-troubleshoot run-troubleshoot: support-bundle - ./bin/support-bundle ./examples/troubleshoot/sample-supportbundle.yaml + ./bin/support-bundle ./examples/support-bundle/sample-supportbundle.yaml .PHONY: run-analyze run-analyze: analyze - ./bin/analyze --analyzers ./examples/troubleshoot/sample-analyzers.yaml ./support-bundle.tar.gz + ./bin/analyze --analyzers ./examples/support-bundle/sample-analyzers.yaml ./support-bundle.tar.gz diff --git a/examples/preflight/sample-preflight.yaml b/examples/preflight/sample-preflight.yaml index 3c48ecf2b..943e2ab10 100644 --- a/examples/preflight/sample-preflight.yaml +++ b/examples/preflight/sample-preflight.yaml @@ -1,20 +1,14 @@ apiVersion: troubleshoot.replicated.com/v1beta1 kind: Preflight metadata: - name: example-preflight-checks + name: example-preflight-check spec: - collectors: - - secret: - name: myapp-postgres - namespace: default - key: uri - includeValue: false analyzers: - clusterVersion: outcomes: - fail: when: "< 1.13.0" - message: The application requires at Kubernetes 1.13.0 or later, and recommends 1.15.0. + message: This application requires at Kubernetes 1.13.0 or later, and recommends 1.15.0. uri: https://www.kubernetes.io - warn: when: "< 1.15.0" @@ -24,32 +18,101 @@ spec: when: ">= 1.15.0" message: Your cluster meets the recommended and required versions of Kubernetes. - customResourceDefinition: - customResourceDefinitionName: constrainttemplates.templates.gatekeeper.sh - checkName: Gatekeeper policy runtime + customResourceDefinitionName: ingressroutes.contour.heptio.com outcomes: - fail: - message: Gatekeeper is required for the application, but not found in the cluster. - uri: https://enterprise.support.io/installing/gatekeeper + message: IngressRoutes CRD not found! - pass: - message: Found a supported version of Gatekeeper installed and running in the cluster. - - imagePullSecret: - checkName: Registry credentials for Quay.io - registryName: quay.io + message: IngressRoutes CRD found! + - containerRuntime: outcomes: + - pass: + when: "== docker" + message: Docker container runtime was found. + - fail: + message: Did not find Docker container runtime. + - storageClass: + checkName: Required storage classes + storageClassName: "default" + outcomes: + - fail: + message: Could not find a storage class called default. + - pass: + message: All good on storage classes + - 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: - message: | - Cannot pull from quay.io. An image pull secret should be deployed to the cluster that has credentials to pull the images. To obtain this secret, please contact your support rep. - uri: https://enterprise.support.io/installing/registry-credentials + when: "== minikube" + message: The application does not support Minikube Clusters - pass: - message: Found credentials to pull from quay.io - - secret: - checkName: Postgres connection string - secretName: myapp-postgres - namespace: default - key: uri + 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 + # Will be supported in the future + - 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 + - nodeResources: + checkName: Must have at least 3 nodes in the cluster, with 5 recommended + outcomes: + - fail: + when: "count() < 3" + message: This application requires at least 3 nodes. + uri: https://kurl.sh/docs/install-with-kurl/adding-nodes + - warn: + when: "count() < 5" + message: This application recommends at last 5 nodes. + uri: https://kurl.sh/docs/install-with-kurl/adding-nodes + - pass: + message: This cluster has enough nodes. + - nodeResources: + checkName: Every node in the cluster must have at least 10 GB of memory, with 32 GB recommended + outcomes: + - fail: + when: "min(memoryCapacity) < 10Gi" + message: All nodes must have at least 10 GB of memory. + uri: https://kurl.sh/docs/install-with-kurl/system-requirements + - warn: + when: "min(memoryCapacity) < 32Gi" + message: All nodes are recommended to have at least 32 GB of memory. + uri: https://kurl.sh/docs/install-with-kurl/system-requirements + - pass: + message: All nodes have at least 32 GB of memory. + - nodeResources: + checkName: Total CPU Cores in the cluster is 4 or greater outcomes: - fail: - message: A secret named "myapp-postgres" must be deployed with a "uri" key - uri: https://enterprise.support.io/installing/postgres + 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: Found a valid postgres connection string + message: There are at least 4 cores in the cluster + - 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. \ No newline at end of file diff --git a/examples/troubleshoot/sample-analyzers.yaml b/examples/support-bundle/sample-analyzers.yaml similarity index 100% rename from examples/troubleshoot/sample-analyzers.yaml rename to examples/support-bundle/sample-analyzers.yaml diff --git a/examples/troubleshoot/sample-collectors.yaml b/examples/support-bundle/sample-collectors.yaml similarity index 100% rename from examples/troubleshoot/sample-collectors.yaml rename to examples/support-bundle/sample-collectors.yaml diff --git a/examples/support-bundle/sample-supportbundle.yaml b/examples/support-bundle/sample-supportbundle.yaml new file mode 100644 index 000000000..7668046a6 --- /dev/null +++ b/examples/support-bundle/sample-supportbundle.yaml @@ -0,0 +1,100 @@ +apiVersion: troubleshoot.replicated.com/v1beta1 +kind: SupportBundle +metadata: + name: example-support-bundle +spec: + analyzers: + - clusterVersion: + outcomes: + - fail: + when: "< 1.16.0" + message: The application requires at Kubernetes 1.16.0 or later + uri: https://kubernetes.io + - warn: + when: "< 1.17.0" + message: Your cluster meets the minimum version of Kubernetes, but we recommend you update to 1.17.0 or later. + uri: https://kubernetes.io + - pass: + message: Your cluster meets the recommended and required versions of Kubernetes. + - customResourceDefinition: + customResourceDefinitionName: rook + outcomes: + - fail: + message: The Rook CRD was not found in the cluster. + - pass: + message: Rook is installed and available. + - containerRuntime: + outcomes: + - fail: + when: "== docker" + message: The application does not support docker + - pass: + message: A supported container runtime was found + - storageClass: + checkName: Required storage classes + storageClassName: "microk8s-hostpath" + outcomes: + - fail: + message: The microk8s storage class thing was not found + - pass: + message: All good on storage classes + - nodeResources: + checkName: Must have at least 3 nodes in the cluster + outcomes: + - fail: + when: "count() < 3" + message: This application requires at least 3 nodes + - warn: + when: "count() < 5" + message: This application recommends at last 5 nodes. + - pass: + message: This cluster has enough nodes. + - 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 + - pass: + message: There are at least 4 cores in the cluster + - nodeResources: + checkName: Each node must have at least 40 GB of ephemeral storage + outcomes: + - fail: + when: "min(ephemeralStorageCapacity) < 40Gi" + message: Noees in this cluster do not have at least 40 GB of ephemeral storage. + uri: https://kurl.sh/docs/install-with-kurl/system-requirements + - warn: + when: "min(ephemeralStorageCapacity) < 100Gi" + message: Nodes in this cluster are recommended to have at least 100 GB of ephemeral storage. + uri: https://kurl.sh/docs/install-with-kurl/system-requirements + - pass: + message: The nodes in this cluster have enough ephemeral storage. + - ingress: + namespace: default + ingressName: connect-to-me + outcomes: + - fail: + message: The ingress isn't ingressing + - pass: + message: All systems ok on ingress + - deploymentStatus: + name: api + namespace: default + outcomes: + - fail: + when: "< 1" + message: The API deployment does not have any ready replicas. + - warn: + when: "= 1" + message: The API deployment has only a single ready replica. + - pass: + message: There are multiple replicas of the API deployment ready. + - logs: + selector: + - app=example + - component=nginx + namespace: repl{{ Namespace }} + limits: + maxAge: 30d + maxLines: 10000 \ No newline at end of file diff --git a/examples/troubleshoot/sample-supportbundle.yaml b/examples/troubleshoot/sample-supportbundle.yaml deleted file mode 100644 index c85a3c45d..000000000 --- a/examples/troubleshoot/sample-supportbundle.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 -kind: SupportBundle -metadata: - name: supportbundle-sample -spec: - collectors: [] - analyzers: - - clusterVersion: - outcomes: - - fail: - when: "< 1.13.0" - message: The application requires at Kubernetes 1.13.0 or later, and recommends 1.15.0. - uri: https://www.kubernetes.io - - warn: - when: "< 1.15.0" - message: Your cluster meets the minimum version of Kubernetes, but we recommend you update to 1.15.0 or later. - uri: https://kubernetes.io - - pass: - when: ">= 1.15.0" - message: Your cluster meets the recommended and required versions of Kubernetes. From 4b1852c3e1355af9d0c17cfb53bf893392f470c3 Mon Sep 17 00:00:00 2001 From: GraysonNull Date: Mon, 13 Jul 2020 16:45:46 +0000 Subject: [PATCH 2/2] updates from feedback --- examples/preflight/sample-preflight.yaml | 9 +++++---- examples/support-bundle/sample-supportbundle.yaml | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/preflight/sample-preflight.yaml b/examples/preflight/sample-preflight.yaml index 943e2ab10..019c383c2 100644 --- a/examples/preflight/sample-preflight.yaml +++ b/examples/preflight/sample-preflight.yaml @@ -1,14 +1,14 @@ apiVersion: troubleshoot.replicated.com/v1beta1 kind: Preflight metadata: - name: example-preflight-check + name: example spec: analyzers: - clusterVersion: outcomes: - fail: when: "< 1.13.0" - message: This application requires at Kubernetes 1.13.0 or later, and recommends 1.15.0. + message: This application requires at least Kubernetes 1.13.0 or later, and recommends 1.15.0. uri: https://www.kubernetes.io - warn: when: "< 1.15.0" @@ -18,12 +18,13 @@ spec: when: ">= 1.15.0" message: Your cluster meets the recommended and required versions of Kubernetes. - customResourceDefinition: + checkName: Ingress customResourceDefinitionName: ingressroutes.contour.heptio.com outcomes: - fail: - message: IngressRoutes CRD not found! + message: Contour ingress not found! - pass: - message: IngressRoutes CRD found! + message: Contour ingress found! - containerRuntime: outcomes: - pass: diff --git a/examples/support-bundle/sample-supportbundle.yaml b/examples/support-bundle/sample-supportbundle.yaml index 7668046a6..06f670413 100644 --- a/examples/support-bundle/sample-supportbundle.yaml +++ b/examples/support-bundle/sample-supportbundle.yaml @@ -1,14 +1,14 @@ apiVersion: troubleshoot.replicated.com/v1beta1 kind: SupportBundle metadata: - name: example-support-bundle + name: example spec: analyzers: - clusterVersion: outcomes: - fail: when: "< 1.16.0" - message: The application requires at Kubernetes 1.16.0 or later + message: The application requires at least Kubernetes 1.16.0 or later uri: https://kubernetes.io - warn: when: "< 1.17.0"