Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix collectors and analyzer examples and commands #1025

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ gradient: "blueToBlue"
---

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Preflight
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: check-kubernetes-version
spec:
Expand Down
4 changes: 2 additions & 2 deletions content/docs/troubleshoot/kubernetes/analysis/crd.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ gradient: "blueToBlue"
---

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Preflight
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: preflight-sample
spec:
Expand Down
97 changes: 49 additions & 48 deletions content/docs/troubleshoot/kubernetes/analysis/defining-analyzers.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ gradient: "blueToBlue"
All analyzers are specified in a single YAML file. To build a set of analyzers, start with a Kubernetes YAML file:

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Analyzer
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: my-application-name
spec: []
Expand All @@ -28,53 +28,54 @@ To add additional analyzers, read the docs in this section to understand each on
For example, a complete spec might be:

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Analyzer
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: my-application-name
spec:
- imagePullSecret:
checkName: Has Access to Quay.io
registryName: quay.io
outcomes:
- fail:
message: Cannot pull from quay.io
- pass:
message: Found credentials to pull from quay.io
- clusterVersion:
outcomes:
- fail:
when: "< 1.13.0"
message: Sorry, my-application-name requires at least Kubernetes 1.14.0. Please update your Kubernetes cluster before installing.
uri: https://enterprise.my-application.com/install/requirements/kubernetes
- warn:
when: "< 1.15.0"
message: The version of Kubernetes you are running meets the minimum requirements to run my-application-name. It's recommended to run Kubernetes 1.15.0 or later.
uri: https://enterprise.my-application.com/install/requirements/kubernetes
- pass:
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 required storage class was not found in the cluster.
- pass:
message: The required storage class was found in the cluster.
- ingress:
namespace: default
ingressName: my-app-ingress
outcomes:
- fail:
message: Expected to find an ingress named "my-app-ingress".
- pass:
message: Expected ingress was found.
- customResourceDefinition:
customResourceDefinitionName: rook
outcomes:
- fail:
message: Rook is required for my-application. Rook was not found in the cluster.
- pass:
message: Found a supported version of Rook installed and running in the cluster.
analyzers:
- imagePullSecret:
checkName: Has Access to Quay.io
registryName: quay.io
outcomes:
- fail:
message: Cannot pull from quay.io
- pass:
message: Found credentials to pull from quay.io
- clusterVersion:
outcomes:
- fail:
when: "< 1.13.0"
message: Sorry, my-application-name requires at least Kubernetes 1.14.0. Please update your Kubernetes cluster before installing.
uri: https://enterprise.my-application.com/install/requirements/kubernetes
- warn:
when: "< 1.15.0"
message: The version of Kubernetes you are running meets the minimum requirements to run my-application-name. It's recommended to run Kubernetes 1.15.0 or later.
uri: https://enterprise.my-application.com/install/requirements/kubernetes
- pass:
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 required storage class was not found in the cluster.
- pass:
message: The required storage class was found in the cluster.
- ingress:
namespace: default
ingressName: my-app-ingress
outcomes:
- fail:
message: Expected to find an ingress named "my-app-ingress".
- pass:
message: Expected ingress was found.
- customResourceDefinition:
customResourceDefinitionName: rook
outcomes:
- fail:
message: Rook is required for my-application. Rook was not found in the cluster.
- pass:
message: Found a supported version of Rook installed and running in the cluster.

```
```
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ gradient: "blueToBlue"
---

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Preflight
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: preflight-sample
spec:
Expand Down
4 changes: 2 additions & 2 deletions content/docs/troubleshoot/kubernetes/analysis/ingress.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ gradient: "blueToBlue"
---

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Preflight
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: preflight-sample
spec:
Expand Down
4 changes: 2 additions & 2 deletions content/docs/troubleshoot/kubernetes/analysis/secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ By default, the collectors don't include secrets. This means that a preflight ch


```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Preflight
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: preflight-sample
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ gradient: "blueToBlue"
---

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Preflight
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: preflight-sample
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ The cluster info collector is a default collector-- it will be automatically inc
This collector does not accept any parameters.

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Collector
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: sample
spec:
- clusterInfo: {}
collectors:
- clusterInfo: {}
```

## Included resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ The cluster resources colector is a default collector-- it will be automatically
This collector does not accept any parameters.

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Collector
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: sample
spec:
- clusterResources: {}
collectors:
- clusterResources: {}
```

## Included resources
Expand Down Expand Up @@ -226,4 +227,3 @@ This file contains information about all pods, separated by namespace.

### /cluster-resources/ingress/\<namespace\>/\<name\>.json
This file contains information about all ingresses, separated by namespace.

19 changes: 9 additions & 10 deletions content/docs/troubleshoot/kubernetes/collectors/copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ The copy file collector is not automatically included. You need to specify it in


```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Collector
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: sample
spec:
- copy:
selector:
- app=api
namespace: default
containerPath: /etc/hosts
containerName: sidecar
collectors:
- copy:
selector:
- app=api
namespace: default
containerPath: /etc/hosts
containerName: sidecar
```

If containerName is not specified, the first container in the pod will be used.
Expand All @@ -35,5 +36,3 @@ When this collector is executed, it will include the following files in a suppor

### /copy/\<namespace\>/\<pod-name\>/\<path\>
This will contain the pod output (up to 10000 lines).


Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ gradient: "blueToBlue"
All collectors are specified in a single YAML file. To build a set of collectors, start with a Kubernetes YAML file:

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Collector
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: my-application-name
spec: []
spec:
collectors: []
```

The above file is a simple but valid support bundle spec. It will collect only the default data.
Expand All @@ -28,30 +29,31 @@ To add additional collectors, read the docs in this section to understand each o
For example, a complete spec might be:

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Collector
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: my-application-name
spec:
- clusterInfo: {}
- clusterResources: {}
- logs:
selector:
- app=api
namespace: default
limits:
maxAge: 30d
maxLines: 1000
- http:
name: healthz
get:
url: http://api:3000/healthz
- exec:
name: mysql-version
selector:
- app=mysql
namespace: default
command: ["mysql"]
args: ["-V"]
timeout: 5s
collectors:
- clusterInfo: {}
- clusterResources: {}
- logs:
selector:
- app=api
namespace: default
limits:
maxAge: 30d
maxLines: 1000
- http:
name: healthz
get:
url: http://api:3000/healthz
- exec:
name: mysql-version
selector:
- app=mysql
namespace: default
command: ["mysql"]
args: ["-V"]
timeout: 5s
```
21 changes: 11 additions & 10 deletions content/docs/troubleshoot/kubernetes/collectors/exec.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ Optional `exec` collectors can be defined to collect output from commands execut
For example:

```yaml
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Collector
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: sample
spec:
- exec:
name: mysql-version
selector:
- app=mysql
namespace: default
command: ["mysql"]
args: ["-V"]
timeout: 5s
colectors:
- exec:
name: mysql-version
selector:
- app=mysql
namespace: default
command: ["mysql"]
args: ["-V"]
timeout: 5s
```

## Response
Expand Down
Loading