Commit Graph

70 Commits

Author SHA1 Message Date
Evans Mungai
a86d9435a8 feat(collector): Add host collector to copy files to a bundle (#1068)
* Boiler plate for host copy collector

* feat: Add copy host collector

* Add tests

* No need to handle symlinks in a special way

System libraries (os.ReadAll, os.ReadDir) already handle symlinks
2023-04-05 15:43:38 +01:00
Evans Mungai
546ffde14b feat: use klog as the default logging library (#1008) 2023-02-24 18:24:51 +00:00
Tom Wieczorek
752dacd5ed chore: Don't print which error in Makefile (#1012)
The which binary is used to detect if client-gen is installed, and if
it's not, the Makefile will install it. The initial detection prints
an error if it's not found. This is misleading, as it is actually an
expected situation.
2023-02-10 17:26:16 +00:00
Tom Wieczorek
49fe355086 chore: Don't hardcode /bin/bash (#1011)
Bash is not always installed in /bin/bash. Mitigate that by relying on
bash being in PATH.
2023-02-10 17:25:57 +00:00
Evans Mungai
100f9a13b6 feat: Record summary of execution times of support bundle operations (collect/redact/analyse) (#935)
When running a support bundle, we want to know how long each operation
(collect, redact, analyze) takes. This commit adds a new trace exporter
that records the start and end times of each operation, and then prints
a summary of the execution. The summary is also stored in the support
bundle.

Related to #923
2023-02-07 09:50:21 +00:00
Camila Macedo
f27c64cf85 chore: chore: update binaries used to build manifests and k8s (#997)
- client-gen version from v0.22.0 to v0.26.1
- controller-gen version from v0.7.0 to v0.11.2
- k8s pacth from 1.26.0 to 1.26.1
2023-02-01 17:06:46 +00:00
Evans Mungai
c62e71a578 chore: Filter tests to run when calling make test (#983) 2023-01-27 11:48:43 +13:00
Nathan Sullivan
827c49ca00 adding test coverage for preflight.RunPreflights() (#949)
* adding test coverage for preflight.RunPreflights()

TDD to work on https://github.com/replicatedhq/troubleshoot/issues/906
and verify the fix is successful

* go.mod/go.sum: removing gnomock stuff since it's not in use (yet)

* Makefile: try running the preflight integration test with the e2e tests,
since there's a K3s instance in place already

* Makefile add a dedicated test-integration task, which runs as it's own
github action job

* Makefile: exclude a few things from test-integration that break the
github action job

* WIP on preflight tests, addressing some of @banjoh's feedback, more to
go though (specifically changing over to using assert)

* preflight tests: use the testify libraries, restructure code to be
formatted more like other tests in this project
2023-01-13 08:22:57 +10:00
Evans Mungai
a523551da9 feat(redactors): Run redactors on an existing support bundle (#887)
* feat(redactors): Run redactors on an existing support bundle

Add redact subcommand to support-bundle to allow running redactors on an
existing bundle to creating a new redacted bundle.

The command will be launched like so

support-bundle redact <redactor urls> --bundle support-bundle.tar.gz

Fixes: #705
2023-01-03 18:05:15 +00:00
Evans Mungai
b693e6650d chore: Add GH workflow to ensure schemas are generated in a PR (#872)
* Make file target to check generated schemas

* Add missing yaml tag to Logs struct

* chore: Add GH workflow to ensure schemas are generated in a PR
2022-11-28 10:58:09 +13:00
Xav Paice
48faf0c144 Revert "Add ghcr to package releases (#848)" (#868)
This reverts commit 233966d4be.
2022-11-22 17:14:04 +13:00
Xav Paice
6530cb364f feat: Add docsgen command (#862)
* feat: Add docsgen command

* docs: add CLI docs for support-bundle and preflight
2022-11-21 11:31:08 -05:00
Chris Sanders
233966d4be Add ghcr to package releases (#848) 2022-11-17 11:12:54 +13:00
Evans Mungai
e02074941e Add golangci-lint linter make target (#752)
Add line, and lint-and-fix make targets
2022-10-10 09:52:02 +13:00
Diamon Wiggins
a0fb06f0b9 E2E Tests for Support Bundle CLI (#761)
* adding e2e tests for support bundle cli

* update e2e.yaml
2022-10-07 14:43:16 +13:00
Pavan Sokke Nagaraj
3da43b18c9 remove redundant client-gen code 2022-06-02 19:33:47 -04:00
Ethan Mosbaugh
d3cf4fc7f4 Run e2e tests locally 2022-06-02 13:41:00 +00:00
Ethan Mosbaugh
d2d19a2490 Change build step name to test 2022-05-17 17:20:45 +00:00
Ethan Mosbaugh
5c269e2aaf E2E preflight tests 2022-05-17 17:20:45 +00:00
Pavan Sokke Nagaraj
9ec9806b62 add cve scan github cron action (#572) 2022-05-10 13:52:30 -04:00
Ethan Mosbaugh
177f2da16d Update github.com/containers/image/v5 2021-11-30 23:37:25 +00:00
Ethan Mosbaugh
59d50e7679 Fix go mod 2021-11-30 21:26:24 +00:00
Andrew Reed
7b36e6a1f8 Copy in longhorn client (#454) 2021-10-22 15:24:07 -05:00
Simon Croome
977fc438ea Remote host collectors (#392)
* Add collect command and remote host collectors

Adds the ability to run a host collector on a set of remote k8s nodes.
Target nodes can be filtered using the --selector flag, with the same
syntax as kubectl.  Existing flags for --collector-image,
--collector-pullpolicy and --request-timeout are used.  To run on a
specified node, --selector="kubernetes.io/hostname=kind-worker2" could
be used.

The collect command is used by the remote collector to output the
results using a "raw" format, which uses the filename as the key, and
the value the output as a escaped json string.  When run manually it
defaults to fully decoded json. The existing block devices,
ipv4interfaces and services host collectors don't decode properly - the
fix is to convert their slice output to a map (fix not included as
unsure what depends on the existing format).

The collect command is also useful for troubleshooting preflight issues.

Examples are included to show remote collector usage.

```
bin/collect --collector-image=croomes/troubleshoot:latest  examples/collect/remote/memory.yaml --namespace test
{
  "kind-control-plane": {
    "system/memory.json": {
      "total": 1304207360
    }
  },
  "kind-worker": {
    "system/memory.json": {
      "total": 1695780864
    }
  },
  "kind-worker2": {
    "system/memory.json": {
      "total": 1726353408
    }
  }
}
```

The preflight command has been updated to run remote collectors.  To run
a host collector remotely it must be specified in the spec as a
`remoteCollector`:

```
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
  name: memory
spec:
  remoteCollectors:
    - memory:
        collectorName: memory
  analyzers:
    - memory:
        outcomes:
          - fail:
              when: "< 8Gi"
              message: At least 8Gi of memory is required
          - warn:
              when: "< 32Gi"
              message: At least 32Gi of memory is recommended
          - pass:
              message: The system has as sufficient memory
```

Results for each node are analyzed separately, with the node name
appended to the title:

```
bin/preflight --interactive=false --collector-image=croomes/troubleshoot:latest examples/preflight/remote/memory.yaml --format=json
{memory running 0 1}
{memory completed 1 1}
{
  "fail": [
    {
      "title": "Amount of Memory (kind-worker2)",
      "message": "At least 8Gi of memory is required"
    },
    {
      "title": "Amount of Memory (kind-worker)",
      "message": "At least 8Gi of memory is required"
    },
    {
      "title": "Amount of Memory (kind-control-plane)",
      "message": "At least 8Gi of memory is required"
    }
  ]
}
```

Also added a host collector to allow preflight checks of required kernel
modules, which is the main driver for this change.
2021-10-06 09:03:53 -05:00
Salah Aldeen Al Saleh
1bdd3db8c5 update schemas (#428)
* update schemas

* update controller-gen
2021-09-23 11:03:19 -07:00
John Murphy
639bf7a832 Add signed SBOM to troubleshoot (#414)
This change will generate a signed software bill of materials and add it to the repository release archives when the project is released.
2021-09-21 13:55:41 -05:00
Salah Aldeen Al Saleh
ac2a0484e2 add build flags to ffi (#349) 2021-04-12 11:23:46 -07:00
divolgin
7a0c6e5383 use containers package instead of go-containerregistry 2021-04-11 21:39:44 +00:00
Marc Campbell
c7fdec0291 Removing Scopeagent 2021-01-28 18:22:48 +00:00
divolgin
9e669b3f13 Remove RRD dependency and switch to dynamic linking 2020-11-12 19:13:25 +00:00
divolgin
5a1321da02 Collector and analyzer for RRD data 2020-11-10 17:19:17 +00:00
divolgin
a0ce85ae1e Adding troubleshoot.sh/v1beta2 2020-09-01 19:57:11 +00:00
Andrew Lavery
407b80daf5 update controller-gen to v0.3.0
the first version to be k8s 1.18 compatible
2020-08-10 17:51:53 -04:00
GraysonNull
dc80733397 update sample preflight and support bundles, update diretory name 2020-07-13 15:43:10 +00:00
Marc Campbell
a22e2e25df Analyze from the CLI 2020-06-12 12:47:45 -07:00
Marc Campbell
65f957db81 Refactor to support K8s 1.18 2020-06-12 09:28:49 -07:00
Andrew Lavery
c262320cea fix build after k8s 1.18 was released 2020-03-26 18:50:23 +00:00
Marc Campbell
206e5c01d7 Fix makefile 2020-03-23 08:37:53 -07:00
Marc Campbell
562a565f1f Adding postgres analyzer 2020-03-19 18:28:13 -07:00
Marc Campbell
346c751bdf Merge pull request #134 from replicatedhq/openapischema
Generate OpenAPISchema
2020-03-05 13:42:21 -08:00
Frank Shotwell
1b9a220e2d set SCOPE_LOG_ROOT_PATH to /dev/null to avoid creating lots of logfiles 2020-02-21 19:34:26 +00:00
Marc Campbell
899d5d7672 Generate OpenAPISchema 2020-02-10 21:17:11 +00:00
Marc Campbell
0aafbb79a6 go mod! 2019-12-24 20:00:46 +00:00
Marc Campbell
0ad7a87e4d Bump makefile 2019-12-24 19:46:43 +00:00
Marc Campbell
3955dab9bc Removing the CRD 2019-12-24 19:26:26 +00:00
Marc Campbell
7f82ec1f09 Add snapshot release back 2019-12-18 17:45:13 +00:00
Marc Campbell
7ab1734cb6 Remove manager and collector commands 2019-12-18 01:52:06 +00:00
Marc Campbell
9c4fa8ac14 Add version command 2019-11-30 00:03:43 +00:00
Marc Campbell
14ace5294f Analyze spec 2019-10-29 19:45:25 +00:00
Marc Campbell
25e884c43a Proxy 2019-09-08 15:09:02 +00:00