Compare commits

...
353 Commits
Author SHA1 Message Date
Diamon WigginsandEvans Mungai 08c3fcf3df Gracefully handle unreachable URIs in loadSupportBundleSpecsFromURIs (#1383)
* gracefully handle unreachable URIs in loadSupportBundleSpecsFromURIs

* let caller decide how to handle the error

* fix klog import

* Add a test to ensure failing to load uri does not error

---------

Co-authored-by: Evans Mungai <evans@replicated.com>
2023-10-27 14:48:09 +01:00
dependabot[bot]andlnx01 1d2c1191e2 chore(deps): bump google.golang.org/grpc from 1.58.2 to 1.58.3 (#1380)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.58.2 to 1.58.3.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.58.2...v1.58.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-27 11:06:39 +01:00
dependabot[bot]andlnx01 66e070a07d chore(deps): bump go.opentelemetry.io/otel/sdk from 1.18.0 to 1.19.0 (#1378)
Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.18.0 to 1.19.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.18.0...v1.19.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-24 10:03:45 +10:00
dependabot[bot]andlnx01 7528c57e83 chore(deps): bump golang.org/x/sync from 0.3.0 to 0.4.0 (#1373)
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.3.0 to 0.4.0.
- [Commits](https://github.com/golang/sync/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-19 16:14:39 +01:00
Evans Mungai 42fc4f06de fix: Correct how configmap and secrets paths are parsed in the CLI (#1375)
* fix: Correct how configmap and secrets paths are parsed in the CLI

* Add some garbage data to secrets and configmaps
2023-10-18 10:48:53 +01:00
Evans Mungai 312e467160 fix: embed troubleshoot version string from module dependency (#1371)
If troubleshoot is used as a dependency in go.mod, the version
information of the release would be missing at runtime. This is
because the version string is injected to binaries at build time
using linker flags (LD) passed to the compiler (check Makefile)
2023-10-16 13:51:55 +01:00
dependabot[bot]andlnx01 5e280d0652 chore(deps): bump golang.org/x/net from 0.13.0 to 0.17.0 in /examples/sdk/helm-template (#1367)
chore(deps): bump golang.org/x/net in /examples/sdk/helm-template

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.13.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.13.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-12 17:47:04 +01:00
dependabot[bot]andlnx01 15cfdb9eee chore(deps): bump golang.org/x/net from 0.15.0 to 0.17.0 (#1368)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.15.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.15.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-12 17:46:36 +01:00
Evans Mungai 15a4802cd2 feat: Add dry run flag to print support bundle specs to std out (#1337)
* Add dry-run flag

* No traces on dry run

* More refactoring

* More updates to support bundle binary

* More refactoring changes

* Different approach of loading specs from URIs

* Self review

* More changes after review and testing

* fix how we parse oci image uri

* Remove unnecessary comment

* Add missing file

* Fix failing tests

* Better error check for no collectors

* Add default collectors when parsing support bundle specs

* Add missed test fixture

* Download specs with correct headers

* Fix typo
2023-10-10 18:43:32 +01:00
Tom Wieczorek 0d4d305ae6 chore(ci): remove github repo/owner from .goreleaser.yaml (#1357)
Those values will be extracted from the origin remote URL, so specifying
them in the YAML file is not required.
2023-10-10 17:59:55 +01:00
Tom Wieczorek de7112fed2 feat: Build and release binaries for Linux RISC-V (#1356)
* Add riscv64 to GOARCHes in .goreleaser.yaml
* Add riscv64/linux to goreleaser-test GitHub workflow job
2023-10-10 17:51:49 +01:00
Evans Mungai 73a2d882d7 fix: Store custom resources in JSON & YAML format (#1360)
fix: Store custom resources as JSON and YAML files
2023-10-10 17:50:15 +01:00
Andrew Lavery 461cc994ef allow warning when filesystem performance not collected (fio) (#1363)
* add a way to only warn when the host fs perf file was not collected

* make fileNotCollected an exported constant
2023-10-10 11:03:47 -04:00
dependabot[bot]andlnx01 1bdf87e8cd chore(deps): bump github.com/spf13/viper from 1.16.0 to 1.17.0 (#1362)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-10 12:20:06 +01:00
Diamon Wiggins 32b0e1a890 Fix mssql and mysql analyzers (#1359)
fix mssql and mysql analyzers
2023-10-09 15:34:02 +01:00
Xav Paice cc56522571 feat: add ceph df to ceph collector (#1358) 2023-10-09 16:53:20 +13:00
ada mancini e3adc1cb35 call out to fio for host filesystem performance (#1275)
* stashing changes

* split filesystem collector into fio and legacy functions

* read fio results into analyzer

* remove test script

* update go.mod

* remove old notes

* go mod tidy

* fix up go.mod

* fix up go.mod

* refactor tests for fio

* make schemas

* remove local scripts

* local watch script for building troubleshoot

* document watch script

* fix var names

* handle errors if run as non-root

* go mod tidy

* use String interface

* collector happy path test

* invalid filesize

* invalid filesize

* tests

* remove old code

* remove old init function

* let actions tests run this

* clean up tests

* go mod tidy

* remove duplicated type declaration

* remove old file create code
2023-10-03 14:21:56 -04:00
dependabot[bot]andlnx01 359475ba87 chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.8 to 3.23.9 (#1354)
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.8 to 3.23.9.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.23.8...v3.23.9)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 09:38:44 +10:00
Evans Mungai f3d49c657f chore: Do not create package json files (#1347) 2023-10-02 14:32:33 +13:00
dependabot[bot]andlnx01 7f3808b8d7 chore(deps): bump sigs.k8s.io/controller-runtime from 0.16.1 to 0.16.2 (#1351)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.16.1 to 0.16.2.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.16.1...v0.16.2)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-26 12:45:26 +01:00
dependabot[bot]andlnx01 f44d077756 chore(deps): bump go.opentelemetry.io/otel/sdk from 1.17.0 to 1.18.0 (#1353)
Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.17.0 to 1.18.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.17.0...v1.18.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-26 12:44:38 +01:00
dependabot[bot]andlnx01 e34742f3cc chore(deps): bump k8s.io/metrics from 0.28.1 to 0.28.2 (#1345)
Bumps [k8s.io/metrics](https://github.com/kubernetes/metrics) from 0.28.1 to 0.28.2.
- [Commits](https://github.com/kubernetes/metrics/compare/v0.28.1...v0.28.2)

---
updated-dependencies:
- dependency-name: k8s.io/metrics
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-20 13:02:49 +10:00
dependabot[bot]andlnx01 fd29012624 chore(deps): bump go.opentelemetry.io/otel from 1.17.0 to 1.18.0 (#1343)
Bumps [go.opentelemetry.io/otel](https://github.com/open-telemetry/opentelemetry-go) from 1.17.0 to 1.18.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.17.0...v1.18.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-19 16:49:22 +10:00
dependabot[bot]andlnx01 be5e66cbca chore(deps): bump k8s.io/cli-runtime from 0.28.1 to 0.28.2 (#1342)
Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.28.1 to 0.28.2.
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.28.1...v0.28.2)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-19 16:48:59 +10:00
dependabot[bot]andlnx01 c079d96efe chore(deps): bump github.com/microsoft/go-mssqldb from 1.5.0 to 1.6.0 (#1335)
Bumps [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/microsoft/go-mssqldb/releases)
- [Changelog](https://github.com/microsoft/go-mssqldb/blob/main/CHANGELOG.md)
- [Commits](https://github.com/microsoft/go-mssqldb/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/microsoft/go-mssqldb
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-16 08:20:16 +12:00
dependabot[bot]andlnx01 7b797b3725 chore(deps): bump sigs.k8s.io/controller-runtime from 0.15.1 to 0.16.1 (#1336)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.15.1 to 0.16.1.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.15.1...v0.16.1)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-16 07:38:58 +12:00
Diamon Wiggins 6cbe188abe Fix incorrect result URI for pass and warn outcomes in common status analyzer (#1333)
* fix result URI
* revert examples
* fix warn outcome
2023-09-16 07:36:58 +12:00
Evans Mungai 86279b4ec4 chore(redactors): memory consumption improvements (#1332)
* Document additional go tool profiling flags

* Add a regex cache to avoid compiling regular expressions all the time

* Reduce max buffer capacity

* Prefer bytes to strings

Strings are immutable and hence we need to create a new one
all the time when operation on them

* Some more changes

* More bytes

* Use writer.Write instead of fmt.FPrintf

* Clear regex cache when resetting redactors

* Logs errors when redactors error since they get swallowed

* Add an improvement comment

* Limit the number of goroutines spawned when redacting

* Minor improvement

* Write byte slices one at a time instead of concatenating them first

* Add a test for writeBytes

* Additional tests
2023-09-15 13:09:21 -04:00
Evans Mungai 514c86d891 fix: use duration strings for http collector timeout (#1338)
* fix: use duration strings for http collector timeout

This follows the same format that all other collectors use.

* Update from PR comment
2023-09-13 19:18:03 -04:00
Evans Mungai b9f4fc4390 feat: Dry run flag to print preflight specs to std out (#1240) 2023-09-12 14:42:10 +01:00
dependabot[bot]andlnx01 53813502de chore(deps): bump goreleaser/goreleaser-action from 4 to 5 (#1334)
Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 4 to 5.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](https://github.com/goreleaser/goreleaser-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 14:04:26 +12:00
dependabot[bot]andlnx01 597fb2996b chore(deps): bump github.com/cyphar/filepath-securejoin from 0.2.3 to 0.2.4 in /examples/sdk/helm-template (#1330)
chore(deps): bump github.com/cyphar/filepath-securejoin

Bumps [github.com/cyphar/filepath-securejoin](https://github.com/cyphar/filepath-securejoin) from 0.2.3 to 0.2.4.
- [Release notes](https://github.com/cyphar/filepath-securejoin/releases)
- [Commits](https://github.com/cyphar/filepath-securejoin/compare/v0.2.3...v0.2.4)

---
updated-dependencies:
- dependency-name: github.com/cyphar/filepath-securejoin
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-08 12:22:21 +01:00
dependabot[bot]andlnx01 e44aff4100 chore(deps): bump github.com/cyphar/filepath-securejoin from 0.2.3 to 0.2.4 (#1329)
chore(deps): bump github.com/cyphar/filepath-securejoin

Bumps [github.com/cyphar/filepath-securejoin](https://github.com/cyphar/filepath-securejoin) from 0.2.3 to 0.2.4.
- [Release notes](https://github.com/cyphar/filepath-securejoin/releases)
- [Commits](https://github.com/cyphar/filepath-securejoin/compare/v0.2.3...v0.2.4)

---
updated-dependencies:
- dependency-name: github.com/cyphar/filepath-securejoin
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-08 12:22:04 +01:00
dependabot[bot]andlnx01 d0d6f00c0f chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.7 to 3.23.8 (#1327)
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.7 to 3.23.8.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.23.7...v3.23.8)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 14:29:21 +12:00
dependabot[bot]andlnx01 4460e8c639 chore(deps): bump golang.org/x/text from 0.12.0 to 0.13.0 (#1326)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.12.0 to 0.13.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.12.0...v0.13.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 14:28:56 +12:00
dependabot[bot]andlnx01 c166d46af4 chore(deps): bump sigs.k8s.io/e2e-framework from 0.2.0 to 0.3.0 (#1325)
Bumps [sigs.k8s.io/e2e-framework](https://github.com/kubernetes-sigs/e2e-framework) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/kubernetes-sigs/e2e-framework/releases)
- [Changelog](https://github.com/kubernetes-sigs/e2e-framework/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/e2e-framework/compare/v0.2.0...v0.3.0)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/e2e-framework
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 14:28:35 +12:00
dependabot[bot]andlnx01 ded1f42b5a chore(deps): bump actions/checkout from 3 to 4 (#1324)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 11:31:53 +12:00
Xav Paice 32176178a8 chore: update k8s.io to v0.28.1 (#1323)
* chore: update k8s.io to v0.28.1
* Update schemas following k8s.io deps update
2023-09-05 10:29:35 +12:00
Xav Paice 949b645336 chore: Update Go version in CONTRIBUTING.md (#1322)
Update Go version in CONTRIBUTING.md
2023-09-05 09:34:10 +12:00
Xav Paice 1f50fe3163 chore: update Go to 1.20 (#1321) 2023-09-04 18:40:28 +12:00
Archit Sharma 24c6278e5d add http collector timeouts; fixes #1064 (#1310)
* feat(collector): add http method timeouts (#1064)

Signed-off-by: Archit Sharma <archit@replicated.com>

* feat(collector) add schema updates for the http timeout (#1064)

Signed-off-by: Archit Sharma <archit@replicated.com>

* feat(collector): refactor HTTP method calls (#1064)

Signed-off-by: Archit Sharma <archit@replicated.com>

* feat(collector): add tests for HTTP type collector (#1064)

Signed-off-by: Archit Sharma <archit@replicated.com>

---------

Signed-off-by: Archit Sharma <archit@replicated.com>
2023-09-01 19:08:22 +05:30
Nick Meyer 8d527ead8c Replace FOSSA with Trivy (#1320) 2023-09-01 10:19:09 +12:00
dependabot[bot]andlnx01 1dedbcd67a chore(deps): bump go.opentelemetry.io/otel/sdk from 1.16.0 to 1.17.0 (#1318)
Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-30 14:12:19 +01:00
Evans Mungai ff03bfa9cd chore: make spec loaders internal APIs (#1313)
* chore: make specs an internal package

* Some minor improvements

* Use LoadClusterSpecs in support bundle implementation

* Remove change accidentally committed

* Use LoadFromCLIArgs in preflight CLI implementation

* Update comment

* Fix edge case where the label selector is an empty string

* Fix failing test
2023-08-30 14:02:30 +01:00
Dexter Yan b7d5a9876c feat(collector): add helm collector (#1309) 2023-08-28 11:51:57 +12:00
Evans Mungai 96c482a1f5 fix: complete mssql analyser implementation (#1290)
* fix: complete mssql analyser implementation

* Add mssql analyser tests and mssql collector logs

* Close mssql db after collecting data
2023-08-25 10:38:39 +01:00
ada mancini 543931631b Local watch script (#1304)
* local watch script for building troubleshoot
2023-08-25 15:12:22 +12:00
Dexter Yan d730be0fae feat(redact): use a scan regex for default redact rule of lines to improve cpu usage and reduce time cost (#1291) 2023-08-25 15:11:04 +12:00
Dexter Yan 38ff340883 feat(e2e): add e2e go test for support-bundler (#1265) 2023-08-25 14:43:09 +12:00
Dexter YanandEvans Mungai 04f69b3f8c fix(json_compare): solve unorderd slice deep equal (#1300)
* fix(json_compare): sort slice

* fix(json_compare): improve

* fix(json_compare): remove duplicated tests

---------

Co-authored-by: Evans Mungai <evans@replicated.com>
2023-08-24 11:48:33 +01:00
dependabot[bot]andlnx01 57b988b100 chore(deps): bump github.com/google/uuid from 1.3.0 to 1.3.1 (#1306)
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/google/uuid/releases)
- [Changelog](https://github.com/google/uuid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/uuid/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: github.com/google/uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-24 10:02:16 +01:00
dependabot[bot]andlnx01 6972789bea chore(deps): bump sigs.k8s.io/controller-runtime from 0.15.0 to 0.15.1 (#1299)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.15.0 to 0.15.1.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.15.0...v0.15.1)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-15 12:43:27 +12:00
Dexter Yan 17cbc16e05 feat(support-bundler): add leases, configmaps, service accounts and volume attachments for cluster resources collector (#1266) 2023-08-14 18:14:38 +12:00
dependabot[bot]andlnx01 87404982fe chore(deps): bump github.com/microsoft/go-mssqldb from 1.4.0 to 1.5.0 (#1296)
Bumps [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/microsoft/go-mssqldb/releases)
- [Changelog](https://github.com/microsoft/go-mssqldb/blob/main/CHANGELOG.md)
- [Commits](https://github.com/microsoft/go-mssqldb/compare/v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/microsoft/go-mssqldb
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-09 16:03:28 +01:00
Dexter Yan 5bb4358f7a Fix(support-bundle): improve copy from host collector performance by checking daemonset pod FailedMount event and retry (#1281) 2023-08-09 22:32:14 +12:00
Pavan Sokke Nagaraj 39314ef200 chore: export error ErrInsufficientPermissionsToRun and func ShowTextResultsStructured (#1297)
* chore: move ErrInsufficientPermissions to collect

* chore: export func ShowTextResultsStructured

* chore: rename to ErrInsufficientPermissionsToRun
2023-08-08 14:17:15 -04:00
73c7dba0e1 chore(deps): bump github.com/jackc/pgx/v5 from 5.4.2 to 5.4.3 (#1294)
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.4.2 to 5.4.3.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.4.2...v5.4.3)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nathan Sullivan <nathans@replicated.com>
2023-08-08 13:10:42 +10:00
dependabot[bot]andlnx01 a8f8bf9257 chore(deps): bump golang.org/x/text from 0.11.0 to 0.12.0 (#1293)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.11.0 to 0.12.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-08 12:59:46 +10:00
dependabot[bot]andlnx01 08c37c7333 chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.6 to 3.23.7 (#1287)
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.6 to 3.23.7.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.23.6...v3.23.7)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 07:09:28 +12:00
dependabot[bot]andlnx01 8f20b665f9 chore(deps): bump github.com/hashicorp/go-getter from 1.7.1 to 1.7.2 (#1286)
Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.7.1 to 1.7.2.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](https://github.com/hashicorp/go-getter/compare/v1.7.1...v1.7.2)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-01 16:13:00 +10:00
dependabot[bot]andlnx01 638d99eaad chore(deps): bump github.com/microsoft/go-mssqldb from 1.3.0 to 1.4.0 (#1283)
Bumps [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/microsoft/go-mssqldb/releases)
- [Changelog](https://github.com/microsoft/go-mssqldb/blob/main/CHANGELOG.md)
- [Commits](https://github.com/microsoft/go-mssqldb/compare/v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/microsoft/go-mssqldb
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-26 15:35:35 +01:00
dependabot[bot]andlnx01 25ddcf4388 chore(deps): bump k8s.io/apiserver from 0.27.3 to 0.27.4 (#1284)
Bumps [k8s.io/apiserver](https://github.com/kubernetes/apiserver) from 0.27.3 to 0.27.4.
- [Commits](https://github.com/kubernetes/apiserver/compare/v0.27.3...v0.27.4)

---
updated-dependencies:
- dependency-name: k8s.io/apiserver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-26 08:56:09 +10:00
Dexter YanandEvans Mungai 31ccbf696c Fix(test): add unit tests for util (#1273)
* feat(test): add test for util

* fix(test): add windows path test

---------

Co-authored-by: Evans Mungai <evans@replicated.com>
2023-07-24 13:51:49 +12:00
a068561af4 chore(deps): bump k8s.io/metrics from 0.27.3 to 0.27.4 (#1276)
Bumps [k8s.io/metrics](https://github.com/kubernetes/metrics) from 0.27.3 to 0.27.4.
- [Commits](https://github.com/kubernetes/metrics/compare/v0.27.3...v0.27.4)

---
updated-dependencies:
- dependency-name: k8s.io/metrics
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evans Mungai <evans@replicated.com>
2023-07-21 10:25:08 +01:00
Evans Mungai f3777bef69 feat: Add Strict flag to LoadSpecs API (#1279)
* feat: Add Strict flag to LoadSpecs API

Strict flag which can be used to toggle between true
(raising errors if a document is invalid)
and false (ignoring invalid documents, perhaps logging a warning).

* Granular error handling multidocs in secrets and configmaps

* Fix failing test
2023-07-21 10:08:16 +01:00
dependabot[bot]andlnx01 addc2ce925 chore(deps): bump k8s.io/cli-runtime from 0.27.3 to 0.27.4 (#1278)
Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.27.3 to 0.27.4.
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.27.3...v0.27.4)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-21 08:10:25 +10:00
dependabot[bot]andlnx01 247c60afd2 chore(deps): bump github.com/jackc/pgx/v5 from 5.4.1 to 5.4.2 (#1268)
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.4.1 to 5.4.2.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.4.1...v5.4.2)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-20 15:55:17 +01:00
Dan Jones 8237ac991c fix: fixes #1270 (#1271)
* fix: fixes #1270
2023-07-20 13:08:31 +12:00
Evans Mungai 73201c0304 feat: Add regex host analyser (#1267)
* feat: Add regular expressions host anaylser

This anaylser is the same as the in-cluster text anaylser. You pass in
search expressions to find values in files collected in a bundle

* additional test assertion to check analyser warn
2023-07-18 07:18:53 +12:00
Dexter Yan 531edf42e2 feat(support-bundle): add host certificate collector and analyzer (#1132) 2023-07-17 17:05:05 +12:00
Dexter Yan f69ae77bc3 feat(analyzer): add detailed message for unhealthy pod (#1261)
* feat(analyzer): add detailed message for unhealthy pod
2023-07-17 08:01:40 +12:00
David Morgan b02d12ff1e JSONPath support for json compare analyzer (#1244)
This adds JSONPath support to the json compare analyzer using
k8s.io/client-go/util/jsonpath implementation.

To preserve backwards compatibility a new attribute, `JsonPath, is added
to the compare analyzer as opposed to changing how `Path` works. Only
one should be set, but preference is given to `Path`, again to maintain
backwards compatibility.

As a convience for users, if the result of running the JSONPath
expression returns a single value, that value is unwrapped from its
enclosing array and used as the comparison with `Value`. This isn't
strictly compatible with how JSONPath works (all results are wrapped in
an array), but it's easier for end users who are expecting a single
result from their JSONPath expression.
2023-07-10 13:02:00 -04:00
Martin Hrabovcin 24822b7f95 fix(collector): cluster-resources PV filename pattern (#1262) 2023-07-10 12:53:56 -04:00
Dexter Yan 784918e7ee feat(preflight): adding warning message when validating the content of preflight and host preflight spec (#1250) 2023-07-06 16:10:16 +12:00
819dd5fc26 chore(deps): bump github.com/mitchellh/go-wordwrap from 1.0.0 to 1.0.1 (#1260)
Bumps [github.com/mitchellh/go-wordwrap](https://github.com/mitchellh/go-wordwrap) from 1.0.0 to 1.0.1.
- [Commits](https://github.com/mitchellh/go-wordwrap/compare/v1.0.0...v1.0.1)

---
updated-dependencies:
- dependency-name: github.com/mitchellh/go-wordwrap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nathan Sullivan <nathans@replicated.com>
2023-07-06 15:53:25 +12:00
dependabot[bot]andlnx01 27e06517bf chore(deps): bump golang.org/x/text from 0.10.0 to 0.11.0 (#1259)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.10.0 to 0.11.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-06 13:11:44 +10:00
dependabot[bot]andlnx01 d14e0dd18c chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.5 to 3.23.6 (#1258)
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.5 to 3.23.6.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.23.5...v3.23.6)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-06 14:55:10 +12:00
dependabot[bot]andlnx01 d7b3dd8abb chore(deps): bump github.com/microsoft/go-mssqldb from 1.1.0 to 1.3.0 (#1255)
Bumps [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb) from 1.1.0 to 1.3.0.
- [Release notes](https://github.com/microsoft/go-mssqldb/releases)
- [Changelog](https://github.com/microsoft/go-mssqldb/blob/main/CHANGELOG.md)
- [Commits](https://github.com/microsoft/go-mssqldb/compare/v1.1.0...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/microsoft/go-mssqldb
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-06 14:52:41 +12:00
Evans Mungai f64d98b5c3 feat(examples): loading troubleshoot specs from helm chart example (#1252)
* feat(examples): loading troubleshoot specs from helm chart example
2023-06-29 13:31:59 +12:00
Dexter Yan f0efbf658a fix(message): solve the terminal UI issue of truncating the message if it is long (#1242) 2023-06-28 11:06:15 +12:00
dependabot[bot]andlnx01 ec2d14a7ad chore(deps): bump k8s.io/apiserver from 0.27.2 to 0.27.3 (#1247)
Bumps [k8s.io/apiserver](https://github.com/kubernetes/apiserver) from 0.27.2 to 0.27.3.
- [Commits](https://github.com/kubernetes/apiserver/compare/v0.27.2...v0.27.3)

---
updated-dependencies:
- dependency-name: k8s.io/apiserver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-27 10:56:02 +01:00
dependabot[bot]andlnx01 6385a1247f chore(deps): bump k8s.io/cli-runtime from 0.27.2 to 0.27.3 (#1246)
Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.27.2 to 0.27.3.
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.27.2...v0.27.3)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-27 10:38:34 +01:00
dependabot[bot]andlnx01 80a946d0c2 chore(deps): bump golang.org/x/sync from 0.2.0 to 0.3.0 (#1245)
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.2.0 to 0.3.0.
- [Commits](https://github.com/golang/sync/compare/v0.2.0...v0.3.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-27 10:38:05 +01:00
ada mancini 58c428347e get cluster-resources even if negotiating RBAC fails (#1243)
* log errors negotiating and set ignoreRBAC when authorizer webhooks would fail
2023-06-27 15:07:08 +12:00
Xav Paice 2c6b1869e2 feat: add test for HostPreflight spec read (#1227) 2023-06-22 14:56:19 +01:00
Evans Mungai 944da4543a chore: Upgrade sigstore and goreleaser binaries (#1104)
* chore: Upgrade sigstore and goreleaser binaries
* Pin to goreleaser's v1 major versions
2023-06-21 07:07:48 +12:00
dependabot[bot]andlnx01 e8340d54d4 chore(deps): bump golang.org/x/text from 0.9.0 to 0.10.0 (#1221)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.9.0 to 0.10.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-20 12:30:17 +12:00
dependabot[bot]andlnx01 0fc92122d7 chore(deps): bump k8s.io/metrics from 0.27.2 to 0.27.3 (#1234)
Bumps [k8s.io/metrics](https://github.com/kubernetes/metrics) from 0.27.2 to 0.27.3.
- [Commits](https://github.com/kubernetes/metrics/compare/v0.27.2...v0.27.3)

---
updated-dependencies:
- dependency-name: k8s.io/metrics
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-20 12:29:38 +12:00
dependabot[bot]andlnx01 f7f5604734 chore(deps): bump k8s.io/api from 0.27.2 to 0.27.3 (#1232)
Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.27.2 to 0.27.3.
- [Commits](https://github.com/kubernetes/api/compare/v0.27.2...v0.27.3)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-20 12:18:29 +12:00
dependabot[bot]andlnx01 de44c21efa chore(deps): bump github.com/jackc/pgx/v5 from 5.3.1 to 5.4.1 (#1231)
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.3.1 to 5.4.1.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.3.1...v5.4.1)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-20 12:17:46 +12:00
Andrew Lavery 557a1381a9 explicitly test TCPConnectAnalyze unconditional fallthrough behavior (#1226) 2023-06-16 15:01:41 +12:00
Dexter Yan fefe118943 feat(collector): checking existing service account before create running pod (#1222) 2023-06-15 15:39:18 +12:00
Dexter Yan 5b1e48258f fix(collector): solving pod stuck in terminating with CNI issue (#1196)
* feat(collector): add force delete for pods when they're done with in a collector
2023-06-15 13:59:59 +12:00
ada manciniandDiamon Wiggins 03c53cabd6 make ConfigMap collector namespace-optional (#1212)
* try to load default namespace from kubectl current context

* use  ns from kubectl context when no ns is given in the spec

* remove test prints

* Update pkg/collect/configmap.go

Co-authored-by: Diamon Wiggins <38189728+diamonwiggins@users.noreply.github.com>

---------

Co-authored-by: Diamon Wiggins <38189728+diamonwiggins@users.noreply.github.com>
2023-06-13 13:12:17 -04:00
David Rohnow a5628874b0 Add code to collect cluster endpoint data with cluster-resources collector (#1219)
added code to collect cluster endpoint data to cluster-resources collector
2023-06-13 16:33:52 +12:00
Ahmed Mousa 620fa75eb5 feat: add k8s custom metrics collector (#1174)
Collector that collects custom k8s metrics from custom.metrics.k8s.io/v1beta1/ and saves them in the bundle under the /metrics directory
2023-06-09 10:26:03 +01:00
David Rohnow 60d5b686cc Add Daemonset collection to cluster_resources (#1213)
* added daemonset collection to cluster_resources

* squash commit to remove commit that was submitted by root
2023-06-08 16:05:54 -07:00
Dexter Yan f9dbccd354 feat(support-bundle): add support labels for troubleshoot.io and troubleshoot.sh (#1203) 2023-06-08 16:05:35 +01:00
Evans Mungai 08a1075d82 chore: remove unnecessary logrus dependency (#1214)
The troubleshoot project uses klog logging library. There is room for
only one library unfortunately. Sorry logrus :)
2023-06-08 10:43:08 -04:00
dependabot[bot]andlnx01 0a855f26c2 chore(deps): bump github.com/spf13/viper from 1.15.0 to 1.16.0 (#1209)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.15.0...v1.16.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-08 12:54:19 +01:00
danj-replicatedandNathan Sullivan 0d1e23651a Add ability for Cluster resources analyzer to do number and size comparison (#1210)
* make CR analyzer compare ints and sizes

* schemas

* typo

* more comments

* tests for cluster resources analyzer doing number/size comparisons

* switch from humanize to k8s size parsing

* schemas

---------

Co-authored-by: Nathan Sullivan <nathans@replicated.com>
2023-06-08 07:51:11 -04:00
dependabot[bot]andlnx01 70f0e071dd chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.4 to 3.23.5 (#1208)
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.4 to 3.23.5.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.23.4...v3.23.5)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-08 12:17:06 +01:00
5add5d6f9d chore(deps): bump github.com/microsoft/go-mssqldb from 1.0.0 to 1.1.0 (#1207)
Bumps [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/microsoft/go-mssqldb/releases)
- [Changelog](https://github.com/microsoft/go-mssqldb/blob/main/CHANGELOG.md)
- [Commits](https://github.com/microsoft/go-mssqldb/compare/v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: github.com/microsoft/go-mssqldb
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evans Mungai <evans@replicated.com>
2023-06-08 11:45:19 +01:00
191e002a9b chore(deps): bump github.com/sirupsen/logrus from 1.9.0 to 1.9.3 (#1206)
Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus) from 1.9.0 to 1.9.3.
- [Release notes](https://github.com/sirupsen/logrus/releases)
- [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sirupsen/logrus/compare/v1.9.0...v1.9.3)

---
updated-dependencies:
- dependency-name: github.com/sirupsen/logrus
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evans Mungai <evans@replicated.com>
2023-06-08 11:44:35 +01:00
fbacd055cd chore(deps): bump github.com/stretchr/testify from 1.8.3 to 1.8.4 (#1205)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.3 to 1.8.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.3...v1.8.4)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evans Mungai <evans@replicated.com>
2023-06-08 11:44:06 +01:00
Evans Mungai 401dfe2c57 feat: add loader APIs to load specs from raw troubleshoot spec (#1202)
* feat: add loader APIs to load specs from a list of yaml docs

The change introduces a loader package that will contain loader
public APIs. The aim of these APIs will be to, given any source of
troubleshoot specs, the loaders will fetch the specs and parse out
all troubleshoot objects that can be extracted.

* Some refactoring

* Some more changes

* More changes caught when testing vendor portal

* Add tests and rename Troubleshoot kinds struct

* Additional test

* Handle ConfigMap and Secrets with multiple specs in them

* Fix failing test

* Revert multidoc split implementation

* Fix merge conflict

* Change LoadFromXXX functions to a single LoadSpecs function
2023-06-06 16:48:29 -04:00
Evans Mungai 145bad7e8e chore: add make target to build all binaries together (#1211)
Add make build target that builds all troubleshoot binaries in parallel
using -j make flag that lets make run all make sub-targets as separate jobs
2023-06-06 10:15:28 -04:00
Xav Paice a3b7975690 Update the preflight secret label to troubleshoot.sh/kind (#1204)
Partial-fix: #1070

Changes the default label for preflights to troubleshoot.sh/kind: preflight
2023-06-06 07:19:49 +12:00
ada mancini 41cd7c2aa4 watchrsync job to push binaries to a test machine (#1158)
* ignore some more stuff

* watchrsync make command like kurl project

* document watchrsync

* the actual watchrsync script

* dont need these for npm dependencies

* Revert "dont need these for npm dependencies"

This reverts commit bdb4e62c38.

* install gaze-run-interrupt with make

* watchrsync instructions
2023-06-05 10:35:25 -04:00
Dexter Yan 2b8e3fb6bb fix(collector): removed unused name in certificates collector (#1200) 2023-06-01 09:46:34 +01:00
Evans Mungai 27c68a7e53 chore: update deprecated trivy cli option (#1197) 2023-05-31 10:49:58 -04:00
dependabot[bot]andlnx01 8fb417a896 chore(deps): bump go.opentelemetry.io/otel/sdk from 1.15.1 to 1.16.0 (#1191)
Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.15.1 to 1.16.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.1...v1.16.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-31 09:04:13 +01:00
dependabot[bot]andlnx01 88022bb67b chore(deps): bump github.com/mattn/go-isatty from 0.0.18 to 0.0.19 (#1192)
Bumps [github.com/mattn/go-isatty](https://github.com/mattn/go-isatty) from 0.0.18 to 0.0.19.
- [Commits](https://github.com/mattn/go-isatty/compare/v0.0.18...v0.0.19)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-isatty
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-31 09:01:30 +01:00
dependabot[bot]andlnx01 7304c9f20d chore(deps): bump github.com/microsoft/go-mssqldb from 0.21.0 to 1.0.0 (#1193)
Bumps [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb) from 0.21.0 to 1.0.0.
- [Release notes](https://github.com/microsoft/go-mssqldb/releases)
- [Changelog](https://github.com/microsoft/go-mssqldb/blob/main/CHANGELOG.md)
- [Commits](https://github.com/microsoft/go-mssqldb/compare/v0.21.0...v1.0.0)

---
updated-dependencies:
- dependency-name: github.com/microsoft/go-mssqldb
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-31 17:08:12 +12:00
dependabot[bot]andlnx01 097d20edcb chore(deps): bump sigs.k8s.io/controller-runtime from 0.14.6 to 0.15.0 (#1190)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.14.6 to 0.15.0.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.14.6...v0.15.0)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-31 17:06:56 +12:00
Diamon Wiggins 3b61b3025e Add regex to clusterResources analyzer (#1189)
* similar to the textAnalyze analyzer, adds support to evaluate the value at the specified yamlPath with regex or regexGroups
* fixes a typo in the shorthand name used for searching for cluster resource PVC objects
2023-05-30 17:53:03 -04:00
Xav Paice 6a9ad7842d Update preflight e2e test (#1187)
Replace the `run` collector (deprecated) with `runPod`.
2023-05-29 11:56:45 -04:00
Dexter Yan 830e357b48 fix(analyzer): fix clusterResource analyzer always uses the first object found (#1185)
* fix(analyzer): fix clusterResource analyzer  always uses the first object found
2023-05-29 17:26:37 +12:00
Dexter Yan acb1099bda feat(analyzer): add certificate analyzer (#1128)
* feat(analyzer): add cert analyzer
* feat(analyzer): add certificates tests
2023-05-29 16:40:10 +12:00
Diamon WigginsandEvans Mungai 091c4dc134 Capture runPod status and events before deleting the pod (#1172)
* adding savepoddetails function to capture runpod describe output
* update output paths for static-hi.log

---------

Co-authored-by: Evans Mungai <evans@replicated.com>
2023-05-29 10:37:27 +12:00
Evans Mungai 1939f5464d fix (support-bundle): Ensure specs are merged correctly (#1181)
When the support-bundle cli is used with --load-cluster-specs,
not all discovered specs are merged into the spec used to collect
data.

Fixes: #1179
2023-05-26 13:43:57 +01:00
dependabot[bot]andlnx01 1aeec3fa74 chore(deps): bump k8s.io/cli-runtime from 0.27.1 to 0.27.2 (#1170)
Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.27.1 to 0.27.2.
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.27.1...v0.27.2)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-23 13:06:14 +01:00
349fa746cc chore(deps): bump k8s.io/apiserver from 0.27.1 to 0.27.2 (#1168)
* chore(deps): bump k8s.io/apiserver from 0.27.1 to 0.27.2

Bumps [k8s.io/apiserver](https://github.com/kubernetes/apiserver) from 0.27.1 to 0.27.2.
- [Commits](https://github.com/kubernetes/apiserver/compare/v0.27.1...v0.27.2)

---
updated-dependencies:
- dependency-name: k8s.io/apiserver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Generate CRD schemas

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evans Mungai <evans@replicated.com>
2023-05-23 12:40:31 +01:00
dependabot[bot]andlnx01 380522a5f7 chore(deps): bump go.opentelemetry.io/otel from 1.15.1 to 1.16.0 (#1169)
Bumps [go.opentelemetry.io/otel](https://github.com/open-telemetry/opentelemetry-go) from 1.15.1 to 1.16.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.1...v1.16.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-23 12:22:06 +01:00
Martin Hrabovcin 51f626b994 fix(collector): cluster resource file names (#1165)
* fix(collector): use correct path for custom resources

* fix(collector): cluster role resource names
2023-05-23 10:11:45 +01:00
Martin Hrabovcin e22c7d7eca feat(collector): add priority class resources (#1159)
* feat(collector): add priority classes resources

* chore: use priorityclasses filename
2023-05-18 12:21:06 +01:00
Ethan Mosbaugh af4cc8a08a fix: simplify logs collector by removing goroutine which had a concurrency bug (#1155)
* fix: logs collector timeout prevent concurrent map iteration and map write

* remove goroutine

* log pod logs timeout
2023-05-18 07:43:47 +01:00
Nathan Sullivan 6de79afc35 Search stdin for secrets with preflight specs (#1153)
* we can now read preflight specs out of secrets, either from stdin or file input

* moved spec read logic out into its own function so it can be unit
tested easier

* added more comprehensive unit testing on the different ways we can read in specs
2023-05-16 11:44:54 +10:00
95c83f04c6 chore(deps): bump golang.org/x/sync from 0.1.0 to 0.2.0 (#1149)
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.1.0 to 0.2.0.
- [Commits](https://github.com/golang/sync/compare/v0.1.0...v0.2.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com>
2023-05-15 15:47:28 +12:00
dependabot[bot]andlnx01 f7f1504a38 chore(deps): bump github.com/docker/distribution from 2.8.1+incompatible to 2.8.2+incompatible (#1152)
chore(deps): bump github.com/docker/distribution

Bumps [github.com/docker/distribution](https://github.com/docker/distribution) from 2.8.1+incompatible to 2.8.2+incompatible.
- [Release notes](https://github.com/docker/distribution/releases)
- [Commits](https://github.com/docker/distribution/compare/v2.8.1...v2.8.2)

---
updated-dependencies:
- dependency-name: github.com/docker/distribution
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-12 13:17:56 +01:00
dependabot[bot]andlnx01 3a84d6a894 chore(deps): bump periph.io/x/host/v3 from 3.8.0 to 3.8.2 (#1141)
Bumps [periph.io/x/host/v3](https://github.com/periph/host) from 3.8.0 to 3.8.2.
- [Release notes](https://github.com/periph/host/releases)
- [Commits](https://github.com/periph/host/compare/v3.8.0...v3.8.2)

---
updated-dependencies:
- dependency-name: periph.io/x/host/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-11 17:58:07 +01:00
dependabot[bot]andlnx01 72d41b2a75 chore(deps): bump go.opentelemetry.io/otel/sdk from 1.15.0 to 1.15.1 (#1148)
Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.15.0 to 1.15.1.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.0...v1.15.1)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-11 17:56:09 +01:00
dependabot[bot]andlnx01 3c39c51665 chore(deps): bump github.com/go-sql-driver/mysql from 1.7.0 to 1.7.1 (#1147)
Bumps [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/go-sql-driver/mysql/releases)
- [Changelog](https://github.com/go-sql-driver/mysql/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-sql-driver/mysql/compare/v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: github.com/go-sql-driver/mysql
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-11 17:49:21 +01:00
Nathan Sullivan 3548b46cfc support multiple exit codes based on what went wrong/right (#1135)
0 = all passed, 3 = at least one failure, 4 = no failures but at least 1 warn

1 as a catch all (generic errors), 2 for invalid input/specs etc

ref https://github.com/replicatedhq/troubleshoot/issues/1131

docs https://github.com/replicatedhq/troubleshoot.sh/pull/489
2023-05-10 09:33:13 +10:00
dependabot[bot]andlnx01 766469b867 chore(deps): bump k8s.io/klog/v2 from 2.90.1 to 2.100.1 (#1140)
Bumps [k8s.io/klog/v2](https://github.com/kubernetes/klog) from 2.90.1 to 2.100.1.
- [Release notes](https://github.com/kubernetes/klog/releases)
- [Changelog](https://github.com/kubernetes/klog/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes/klog/compare/v2.90.1...v2.100.1)

---
updated-dependencies:
- dependency-name: k8s.io/klog/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-08 13:37:05 +12:00
dependabot[bot]andlnx01 7cdcd2afa9 chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.3 to 3.23.4 (#1138)
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.3 to 3.23.4.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.23.3...v3.23.4)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-08 13:36:31 +12:00
dependabot[bot]andlnx01 ca04a67d29 chore(deps): bump go.opentelemetry.io/otel/sdk from 1.14.0 to 1.15.0 (#1137)
Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.14.0 to 1.15.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.14.0...v1.15.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-08 13:35:25 +12:00
Dexter Yan 2484b3b1eb feat(certificate): support array of certificates from configmaps and secrets (#1119)
feat(certificate): support array of certificates from configmaps and secrets
2023-04-26 12:07:32 +12:00
dependabot[bot]andlnx01 4d23096657 chore(deps): bump k8s.io/cli-runtime from 0.27.0 to 0.27.1 (#1123)
Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.27.0 to 0.27.1.
- [Release notes](https://github.com/kubernetes/cli-runtime/releases)
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.27.0...v0.27.1)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-20 13:59:00 +01:00
Ethan Mosbaugh ae0cbc7044 fix(hostpreflight): tcploadbalancer analyzer should use first outcome (#1130) 2023-04-19 12:58:31 -07:00
dependabot[bot]andlnx01 6fc75138d9 chore(deps): bump k8s.io/apiserver from 0.27.0 to 0.27.1 (#1126)
Bumps [k8s.io/apiserver](https://github.com/kubernetes/apiserver) from 0.27.0 to 0.27.1.
- [Release notes](https://github.com/kubernetes/apiserver/releases)
- [Commits](https://github.com/kubernetes/apiserver/compare/v0.27.0...v0.27.1)

---
updated-dependencies:
- dependency-name: k8s.io/apiserver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-19 14:48:49 +01:00
dependabot[bot]andlnx01 01d322584a chore(deps): bump k8s.io/api from 0.27.0 to 0.27.1 (#1125)
Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.27.0 to 0.27.1.
- [Release notes](https://github.com/kubernetes/api/releases)
- [Commits](https://github.com/kubernetes/api/compare/v0.27.0...v0.27.1)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-19 14:16:36 +01:00
Ethan Mosbaugh 6493064e45 Revert "feat: Add partition type info to block device collector" (#1121)
Revert "feat: Add partition type info to block device collector (#1063)"

This reverts commit 6eb9c7096f.
2023-04-18 13:25:45 +12:00
Ricardo Maraschini 00a46b9374 bump: update kubernetes dependencies to v0.27.0 (#1116)
* bump: update kubernetes dependencies to v0.27.0

* chore: regenerating schemas.
2023-04-14 11:56:16 +12:00
dependabot[bot]andlnx01 6754bd8a59 chore(deps): bump github.com/containers/image/v5 from 5.24.2 to 5.25.0 (#1105)
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.24.2 to 5.25.0.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.24.2...v5.25.0)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-14 11:28:09 +12:00
danj-replicated 285631446e Add ability to fetch preflights from OCI registry to standard out (#1117)
* add oci-fetch command
2023-04-14 11:25:42 +12:00
danj-replicated f692635054 Add stdin and multidoc support to preflight. (#1114)
* add - url keyword for stdin
* add basic multidoc support
* filter on preflight kind
* add e2e test for stdin
2023-04-14 11:21:45 +12:00
Nick Meyer 39606f6d3b FOSSA process refinements (#1118) 2023-04-13 19:08:21 +01:00
dependabot[bot]andlnx01 19a3753265 chore(deps): bump golang.org/x/text from 0.8.0 to 0.9.0 (#1107)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.8.0 to 0.9.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-13 16:14:46 +12:00
dependabot[bot]andlnx01 53db32e8d6 chore(deps): bump github.com/spf13/cobra from 1.6.1 to 1.7.0 (#1106)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.6.1...v1.7.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-13 16:13:58 +12:00
64d5330ae5 certificate collector (#1112)
* adding  pkg/collect/certificates.go and pkg/collect/certificates_test.go files
* adding  collector.go and collector_shared.go files
* ran make schemas
* update zz_generated.deepcopy.go

Co-authored-by: Dexter Yan <yanshaocong@gmail.com>
Co-authored-by: Chris Sanders <sanders.chris@gmail.com>
Co-authored-by: Xav Paice <xav@replicated.com>
2023-04-12 14:34:02 +12:00
Ethan Mosbaugh b020c76977 fix: HostPreflight tcpConnect analyzer should use first matching outcome (#1115) 2023-04-11 15:22:05 -04:00
Dexter Yan 5991d6b250 feat(action): add git fetch all history for all branches and tags in tests (#1113)
* feat(action): add switch to fetch all history for all branches and tags
2023-04-11 16:23:41 +12:00
Diamon WigginsandCamila Macedo 9a457f7f72 fix/clusterPodStatuses: only process when conditional if specified (#1088)
* only process when conditional if specified

* adding tests for cluster pod status analyzer

* use klog instead of fmt for logging

* add additional tests for warn and more operators

---------

Co-authored-by: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com>
2023-04-06 09:17:33 +01:00
dependabot[bot]andlnx01 c99e34f230 chore(deps): bump github.com/docker/docker from 23.0.1+incompatible to 23.0.3+incompatible (#1100)
chore(deps): bump github.com/docker/docker

Bumps [github.com/docker/docker](https://github.com/docker/docker) from 23.0.1+incompatible to 23.0.3+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v23.0.1...v23.0.3)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-06 09:15:57 +01:00
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 ff4870627e fix: Correct arm release file names in krew config (#1101) 2023-04-05 14:55:41 +01:00
Tom Wieczorek 0d5f9697eb feat(krew): add linux/arm64 to krew plugin manifests (#1072)
The binaries are published, and that platform is supported by krew, so
it makes sense to also offer this as a krew plugin.
2023-04-05 14:00:03 +01:00
dependabot[bot]andlnx01 3f289b7449 chore(deps): bump oras.land/oras-go from 1.2.2 to 1.2.3 (#1097)
Bumps [oras.land/oras-go](https://github.com/oras-project/oras-go) from 1.2.2 to 1.2.3.
- [Release notes](https://github.com/oras-project/oras-go/releases)
- [Commits](https://github.com/oras-project/oras-go/compare/v1.2.2...v1.2.3)

---
updated-dependencies:
- dependency-name: oras.land/oras-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-05 11:45:24 +01:00
dependabot[bot]andlnx01 ea7b6c8839 chore(deps): bump github.com/docker/docker from 20.10.23+incompatible to 20.10.24+incompatible (#1099)
chore(deps): bump github.com/docker/docker

Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.23+incompatible to 20.10.24+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v20.10.23...v20.10.24)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-05 10:40:51 +01:00
dependabot[bot]andlnx01 4cd8db07c8 chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.2 to 3.23.3 (#1096)
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.2 to 3.23.3.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.23.2...v3.23.3)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-05 10:36:03 +01:00
dependabot[bot]andlnx01 132d042e79 chore(deps): bump github.com/go-logr/logr from 1.2.3 to 1.2.4 (#1095)
Bumps [github.com/go-logr/logr](https://github.com/go-logr/logr) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/go-logr/logr/releases)
- [Changelog](https://github.com/go-logr/logr/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-logr/logr/compare/v1.2.3...v1.2.4)

---
updated-dependencies:
- dependency-name: github.com/go-logr/logr
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-05 10:35:22 +01:00
dependabot[bot]andlnx01 d41d350097 chore(deps): bump sigs.k8s.io/controller-runtime from 0.14.5 to 0.14.6 (#1094)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.14.5 to 0.14.6.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.14.5...v0.14.6)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-05 10:31:31 +01:00
Evans Mungai dc1687a76a fix: Discover specs from namespaces user is allowed (#1098)
* fix: Discover specs from namespaces user is allowed

If a user has limited access to read secrets and config maps
from certain namespaces in a cluster, we'd need to gracefully
fail when forbidden errors are caught. We'll log them and continue
searching for specs in other namespaces.
2023-04-05 18:50:46 +12:00
0f3f827974 chore(deps): bump github.com/opencontainers/runc from 1.1.4 to 1.1.5 (#1086)
Bumps [github.com/opencontainers/runc](https://github.com/opencontainers/runc) from 1.1.4 to 1.1.5.
- [Release notes](https://github.com/opencontainers/runc/releases)
- [Changelog](https://github.com/opencontainers/runc/blob/v1.1.5/CHANGELOG.md)
- [Commits](https://github.com/opencontainers/runc/compare/v1.1.4...v1.1.5)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/runc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com>
2023-04-03 10:35:58 +01:00
dependabot[bot]andlnx01 71c9345157 chore(deps): bump github.com/microsoft/go-mssqldb from 0.18.0 to 0.21.0 (#1092)
Bumps [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb) from 0.18.0 to 0.21.0.
- [Release notes](https://github.com/microsoft/go-mssqldb/releases)
- [Changelog](https://github.com/microsoft/go-mssqldb/blob/main/CHANGELOG.md)
- [Commits](https://github.com/microsoft/go-mssqldb/compare/v0.18.0...v0.21.0)

---
updated-dependencies:
- dependency-name: github.com/microsoft/go-mssqldb
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-03 10:33:38 +01:00
181fa16b6c chore(deps): bump github.com/hashicorp/go-getter from 1.7.0 to 1.7.1 (#1084)
Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](https://github.com/hashicorp/go-getter/compare/v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com>
2023-04-03 10:31:34 +01:00
dependabot[bot]andlnx01 71d54c0d25 chore(deps): bump github.com/jackc/pgx/v5 from 5.3.0 to 5.3.1 (#1083)
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.3.0 to 5.3.1.
- [Release notes](https://github.com/jackc/pgx/releases)
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.3.0...v5.3.1)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-03 10:31:11 +01:00
ffa242c2f1 chore(deps): bump rajatjindal/krew-release-bot from 0.0.43 to 0.0.46 (#1085)
Bumps [rajatjindal/krew-release-bot](https://github.com/rajatjindal/krew-release-bot) from 0.0.43 to 0.0.46.
- [Release notes](https://github.com/rajatjindal/krew-release-bot/releases)
- [Changelog](https://github.com/rajatjindal/krew-release-bot/blob/main/.goreleaser.yml)
- [Commits](https://github.com/rajatjindal/krew-release-bot/compare/v0.0.43...v0.0.46)

---
updated-dependencies:
- dependency-name: rajatjindal/krew-release-bot
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com>
2023-04-03 08:29:32 +01:00
dependabot[bot]andlnx01 e481adf017 chore(deps): bump github.com/mattn/go-isatty from 0.0.17 to 0.0.18 (#1081)
Bumps [github.com/mattn/go-isatty](https://github.com/mattn/go-isatty) from 0.0.17 to 0.0.18.
- [Release notes](https://github.com/mattn/go-isatty/releases)
- [Commits](https://github.com/mattn/go-isatty/compare/v0.0.17...v0.0.18)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-isatty
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-03 08:24:02 +01:00
dependabot[bot]andlnx01 43ef7e8f76 chore(deps): bump k8s.io/klog/v2 from 2.90.0 to 2.90.1 (#1080)
Bumps [k8s.io/klog/v2](https://github.com/kubernetes/klog) from 2.90.0 to 2.90.1.
- [Release notes](https://github.com/kubernetes/klog/releases)
- [Changelog](https://github.com/kubernetes/klog/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes/klog/compare/v2.90.0...v2.90.1)

---
updated-dependencies:
- dependency-name: k8s.io/klog/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-03 08:22:53 +01:00
Diamon Wiggins 61722e0d47 fix:Revert namespace filename for cluster-resources back to namespaces.json (#1091)
* revert name of namespaces file back to namespaces.json

* fixing typo
2023-03-31 16:40:19 -05:00
Evans Mungai 6eb9c7096f feat: Add partition type info to block device collector (#1063) 2023-03-30 12:29:43 +01:00
+3 e9fac00516 feat: Add mssql collector and analyser (#990)
* Adds MSSQL collector based on Postgres collector

* Adds tests for MSSQL based on the tests for Postgres

* Adds analyzer

* Adds MS SQL Server example

* Assures MS SQL tests pass

* Aligns naming and adds to API

* Corrects names that weren't updated

* Updates text on sample

* Corrects typo

* Makes troubleshoot aware of mssql

* Uses Hashicorp version library for SQL Server versions

* Resyncs generated file

* Cleaning up the workspace.

* Updates schemas per PR feedback

* Unit Tests.

* fix: address runtime error of nil pointer when concatenating preflight specs (#998)

fix: address runtime error of nil pointer when concatenating preflight spec with hostpreflight spec in preflight run.go

* 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

* Deduplication for In-Cluster Collectors (#972)

* adding dedup for in cluster collectors

* add tests

* return collector as is whenever marshalling to json fails

---------

Co-authored-by: Evans Mungai <evans@replicated.com>

* refactor: keep support bundle concat logic to be consistent with Preflight concat (#1002)

* refactor: keep support bundle concat logic to be consistent with Preflight
* test: add tests for support bundle spec concat function

* chore: Refactor in cluster analysers (#999)

Have all in-cluster analysers implement the same interface. This
will help with the implementation of code that requires making
calls to all analysers

Fixes #995

* 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

* chore(deps): bump sigs.k8s.io/controller-runtime from 0.14.2 to 0.14.4 (#1006)

Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.14.2 to 0.14.4.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/master/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.14.2...v0.14.4)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/shirou/gopsutil/v3 from 3.22.12 to 3.23.1 (#1007)

Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.12 to 3.23.1.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.22.12...v3.23.1)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: Don't hardcode /bin/bash (#1011)

Bash is not always installed in /bin/bash. Mitigate that by relying on
bash being in PATH.

* 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.

* chore: remove unused code (#1013)

Remove code snippets that are not used across the codebase.

* remove PR label enforcement workflow (#1015)

* chore(deps): bump go.opentelemetry.io/otel/sdk from 1.11.2 to 1.13.0 (#1020)

Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.11.2 to 1.13.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.11.2...v1.13.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump golang.org/x/text from 0.6.0 to 0.7.0 (#1017)

Bumps [golang.org/x/text](https://github.com/golang/text) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/jackc/pgx/v5 from 5.2.0 to 5.3.0 (#1018)

Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/jackc/pgx/releases)
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.2.0...v5.3.0)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/hashicorp/go-getter from 1.6.2 to 1.7.0 (#1019)

Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.6.2 to 1.7.0.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](https://github.com/hashicorp/go-getter/compare/v1.6.2...v1.7.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(support-bundle): print progress in debug non-interactive mode (#1010)

Currently, there's no debug logs whatsoever when running a command like

    troubleshoot --debug --interactive=false

Tackle this by printing similar log statements as presented in
interactive mode to the debug logger. Refactor the code a bit so there's
no need for a dedicated finished channel and to exit the goroutines
properly.

Co-authored-by: Evans Mungai <evans@replicated.com>

* chore(deps): bump github.com/containerd/containerd from 1.6.12 to 1.6.18 (#1021)

Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.6.12 to 1.6.18.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.6.12...v1.6.18)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump golang.org/x/net from 0.6.0 to 0.7.0 (#1025)

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/containers/image/v5 from 5.24.0 to 5.24.1 (#1026)

Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.24.0 to 5.24.1.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.24.0...v5.24.1)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update README to add link for the docs (#1022)

Co-authored-by: Evans Mungai <evans@replicated.com>

* feat: use klog as the default logging library (#1008)

* chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.1 to 3.23.2 (#1043)

Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.1 to 3.23.2.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.23.1...v3.23.2)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump go.opentelemetry.io/otel from 1.13.0 to 1.14.0 (#1040)

Bumps [go.opentelemetry.io/otel](https://github.com/open-telemetry/opentelemetry-go) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/containers/image/v5 from 5.24.1 to 5.24.2 (#1038)

Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.24.1 to 5.24.2.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.24.1...v5.24.2)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: support for rhel 9 variants (rhel, centos, ol, rocky) (#1045)

* fix: Use namespace from the collector spec for Ceph (#1042)

use namespace from the collector spec for ceph

* chore(deps): bump go.opentelemetry.io/otel/sdk from 1.13.0 to 1.14.0 (#1039)

Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Collector/Analyzer - Subnet Available (#1004)

* Adding a new Subnet Available Collector and Analyzer, used to check if a subnet is available for use on a K8s node.

* chore(deps): bump k8s.io/apimachinery from 0.26.1 to 0.26.2 (#1050)

Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.26.1...v0.26.2)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump sigs.k8s.io/controller-runtime from 0.14.4 to 0.14.5 (#1048)

Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.14.4 to 0.14.5.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.14.4...v0.14.5)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* dont run tests on draft PRs (#966)

Co-authored-by: Xav Paice <xavpaice@users.noreply.github.com>

* chore(deps): bump k8s.io/klog/v2 from 2.90.0 to 2.90.1 (#1052)

Bumps [k8s.io/klog/v2](https://github.com/kubernetes/klog) from 2.90.0 to 2.90.1.
- [Release notes](https://github.com/kubernetes/klog/releases)
- [Changelog](https://github.com/kubernetes/klog/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes/klog/compare/v2.90.0...v2.90.1)

---
updated-dependencies:
- dependency-name: k8s.io/klog/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump k8s.io/cli-runtime from 0.26.1 to 0.26.2 (#1049)

Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/kubernetes/cli-runtime/releases)
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.26.1...v0.26.2)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump k8s.io/apiextensions-apiserver from 0.26.1 to 0.26.2 (#1051)

* chore(deps): bump k8s.io/apiextensions-apiserver from 0.26.1 to 0.26.2

Bumps [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases)
- [Commits](https://github.com/kubernetes/apiextensions-apiserver/compare/v0.26.1...v0.26.2)

---
updated-dependencies:
- dependency-name: k8s.io/apiextensions-apiserver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore(deps): bump k8s.io/klog/v2 from 2.90.0 to 2.90.1 (#1052)

Bumps [k8s.io/klog/v2](https://github.com/kubernetes/klog) from 2.90.0 to 2.90.1.
- [Release notes](https://github.com/kubernetes/klog/releases)
- [Changelog](https://github.com/kubernetes/klog/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes/klog/compare/v2.90.0...v2.90.1)

---
updated-dependencies:
- dependency-name: k8s.io/klog/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump k8s.io/cli-runtime from 0.26.1 to 0.26.2 (#1049)

Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/kubernetes/cli-runtime/releases)
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.26.1...v0.26.2)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump k8s.io/apiextensions-apiserver from 0.26.1 to 0.26.2

Bumps [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases)
- [Commits](https://github.com/kubernetes/apiextensions-apiserver/compare/v0.26.1...v0.26.2)

---
updated-dependencies:
- dependency-name: k8s.io/apiextensions-apiserver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update go.sum

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evans Mungai <evans@replicated.com>

* Adds MSSQL collector based on Postgres collector

* Missed a merge conflict.

* More merge conflicts fixed.

* Ran go mod tidy.

* Fixed the function name return.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chuck D'Antonio <chuck@crdant.io>
Co-authored-by: yunju.lly <yunju.lly@infracreate.com>
Co-authored-by: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com>
Co-authored-by: Diamon Wiggins <38189728+diamonwiggins@users.noreply.github.com>
Co-authored-by: Evans Mungai <evans@replicated.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tom Wieczorek <twz123@users.noreply.github.com>
Co-authored-by: Nick Meyer <nickm@replicated.com>
Co-authored-by: Ethan Mosbaugh <ethan@replicated.com>
Co-authored-by: Nathan Sullivan <nathans@replicated.com>
Co-authored-by: ada mancini <adamancini@users.noreply.github.com>
Co-authored-by: Xav Paice <xavpaice@users.noreply.github.com>
2023-03-27 16:06:27 +01:00
Evans Mungai b687656436 chore: Add community calendar to README (#1077) 2023-03-24 14:31:50 -05:00
e02fae86c3 chore(deps): bump k8s.io/cli-runtime from 0.26.1 to 0.26.3 (#1057)
* chore(deps): bump k8s.io/cli-runtime from 0.26.1 to 0.26.3

Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.26.1 to 0.26.3.
- [Release notes](https://github.com/kubernetes/cli-runtime/releases)
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.26.1...v0.26.3)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump apiextensions-apiserver and apiserver from 0.26.2 to 0.26.3

Includes schemagen

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Xav Paice <xav@replicated.com>
2023-03-24 13:24:52 +00:00
dependabot[bot]andlnx01 ae58bea4df chore(deps): bump golang.org/x/text from 0.7.0 to 0.8.0 (#1061)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.7.0 to 0.8.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.7.0...v0.8.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-23 17:29:20 +00:00
dependabot[bot]andlnx01 96a8b2a713 chore(deps): bump actions/setup-go from 3 to 4 (#1059)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-23 17:10:08 +00:00
dependabot[bot]andlnx01 df45d16c2c chore(deps): bump github.com/fatih/color from 1.14.1 to 1.15.0 (#1058)
Bumps [github.com/fatih/color](https://github.com/fatih/color) from 1.14.1 to 1.15.0.
- [Release notes](https://github.com/fatih/color/releases)
- [Commits](https://github.com/fatih/color/compare/v1.14.1...v1.15.0)

---
updated-dependencies:
- dependency-name: github.com/fatih/color
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-23 17:07:22 +00:00
Tom Wieczorek 880739d885 chore(ci): use fetch-depth instead of unshallow (#1073)
The fetch-depth parameter to the checkout action will provide a full
checkout instead of a shallow one that only has the last commit. Using
this makes the workflow files a bit more concise and removes an extra
step.
2023-03-23 16:57:04 +00:00
Tom Wieczorek 553b75f8f0 feat: Build and release binaries for Linux ARM 32-bit (#1074)
* Add arm to GOARCHes in .goreleaser.yaml and exclude the windows/arm
  build
* Add arm/linux to goreleaser-test GitHub workflow job
* Add the linux/arm binaries to krew plugin manifests
2023-03-23 16:53:27 +00:00
Evans Mungai d17e5d9a6d fix: Fix longhorn collector linting error (#1065) 2023-03-23 14:55:36 +00:00
Dexter Yan 8fe5bffae4 feat(analyzer): remove duplicated analyzers (#1056)
feat(analyzer): add DedupAnalyzers
2023-03-22 11:45:41 -04:00
Dexter Yan 79f8e6efab feat(support-bundle): check if the cluster IsNamespacedScopeRBAC and use current namespace (#1055)
feat(support-bundle): add IsNamespacedScope check
2023-03-22 11:33:54 -04:00
26d176a994 chore(deps): bump k8s.io/apiextensions-apiserver from 0.26.1 to 0.26.2 (#1051)
* chore(deps): bump k8s.io/apiextensions-apiserver from 0.26.1 to 0.26.2

Bumps [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases)
- [Commits](https://github.com/kubernetes/apiextensions-apiserver/compare/v0.26.1...v0.26.2)

---
updated-dependencies:
- dependency-name: k8s.io/apiextensions-apiserver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore(deps): bump k8s.io/klog/v2 from 2.90.0 to 2.90.1 (#1052)

Bumps [k8s.io/klog/v2](https://github.com/kubernetes/klog) from 2.90.0 to 2.90.1.
- [Release notes](https://github.com/kubernetes/klog/releases)
- [Changelog](https://github.com/kubernetes/klog/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes/klog/compare/v2.90.0...v2.90.1)

---
updated-dependencies:
- dependency-name: k8s.io/klog/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump k8s.io/cli-runtime from 0.26.1 to 0.26.2 (#1049)

Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/kubernetes/cli-runtime/releases)
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.26.1...v0.26.2)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump k8s.io/apiextensions-apiserver from 0.26.1 to 0.26.2

Bumps [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases)
- [Commits](https://github.com/kubernetes/apiextensions-apiserver/compare/v0.26.1...v0.26.2)

---
updated-dependencies:
- dependency-name: k8s.io/apiextensions-apiserver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update go.sum

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evans Mungai <evans@replicated.com>
2023-03-15 11:08:40 +00:00
dependabot[bot]andlnx01 cbd648af05 chore(deps): bump k8s.io/cli-runtime from 0.26.1 to 0.26.2 (#1049)
Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/kubernetes/cli-runtime/releases)
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.26.1...v0.26.2)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-14 17:04:43 +00:00
dependabot[bot]andlnx01 a2bddc3f3b chore(deps): bump k8s.io/klog/v2 from 2.90.0 to 2.90.1 (#1052)
Bumps [k8s.io/klog/v2](https://github.com/kubernetes/klog) from 2.90.0 to 2.90.1.
- [Release notes](https://github.com/kubernetes/klog/releases)
- [Changelog](https://github.com/kubernetes/klog/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes/klog/compare/v2.90.0...v2.90.1)

---
updated-dependencies:
- dependency-name: k8s.io/klog/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-14 15:44:16 +00:00
ada manciniandXav Paice d85f7798f3 dont run tests on draft PRs (#966)
Co-authored-by: Xav Paice <xavpaice@users.noreply.github.com>
2023-03-14 15:13:42 +00:00
dependabot[bot]andlnx01 7b5b03e16d chore(deps): bump sigs.k8s.io/controller-runtime from 0.14.4 to 0.14.5 (#1048)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.14.4 to 0.14.5.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.14.4...v0.14.5)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-14 15:02:34 +00:00
dependabot[bot]andlnx01 e45cff86e2 chore(deps): bump k8s.io/apimachinery from 0.26.1 to 0.26.2 (#1050)
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.26.1...v0.26.2)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-14 14:59:55 +00:00
Nathan Sullivan f3db02a200 Collector/Analyzer - Subnet Available (#1004)
* Adding a new Subnet Available Collector and Analyzer, used to check if a subnet is available for use on a K8s node.
2023-03-10 12:52:21 +10:00
dependabot[bot]andlnx01 5b51018541 chore(deps): bump go.opentelemetry.io/otel/sdk from 1.13.0 to 1.14.0 (#1039)
Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-09 14:22:18 +00:00
Diamon Wiggins 617ddf11d9 fix: Use namespace from the collector spec for Ceph (#1042)
use namespace from the collector spec for ceph
2023-03-08 11:33:27 -04:00
Ethan Mosbaugh 3419a9b888 feat: support for rhel 9 variants (rhel, centos, ol, rocky) (#1045) 2023-03-08 06:29:16 -08:00
dependabot[bot]andlnx01 7b56ed4e51 chore(deps): bump github.com/containers/image/v5 from 5.24.1 to 5.24.2 (#1038)
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.24.1 to 5.24.2.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.24.1...v5.24.2)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-08 13:44:43 +00:00
dependabot[bot]andlnx01 d21e4855e7 chore(deps): bump go.opentelemetry.io/otel from 1.13.0 to 1.14.0 (#1040)
Bumps [go.opentelemetry.io/otel](https://github.com/open-telemetry/opentelemetry-go) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-08 13:44:07 +00:00
dependabot[bot]andlnx01 6cc48f4751 chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.1 to 3.23.2 (#1043)
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.1 to 3.23.2.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.23.1...v3.23.2)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-08 11:52:22 +00:00
Evans Mungai 546ffde14b feat: use klog as the default logging library (#1008) 2023-02-24 18:24:51 +00:00
Camila MacedoandEvans Mungai 299258ef87 Update README to add link for the docs (#1022)
Co-authored-by: Evans Mungai <evans@replicated.com>
2023-02-22 10:06:44 +00:00
dependabot[bot]andlnx01 c4f2dc9339 chore(deps): bump github.com/containers/image/v5 from 5.24.0 to 5.24.1 (#1026)
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.24.0 to 5.24.1.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.24.0...v5.24.1)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 12:23:14 +00:00
dependabot[bot]andlnx01 93e5ca8eaa chore(deps): bump golang.org/x/net from 0.6.0 to 0.7.0 (#1025)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-20 14:33:33 +00:00
dependabot[bot]andlnx01 777224f4c3 chore(deps): bump github.com/containerd/containerd from 1.6.12 to 1.6.18 (#1021)
Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.6.12 to 1.6.18.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.6.12...v1.6.18)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-17 10:21:59 +00:00
Tom WieczorekandEvans Mungai 9f6739fdbe feat(support-bundle): print progress in debug non-interactive mode (#1010)
Currently, there's no debug logs whatsoever when running a command like

    troubleshoot --debug --interactive=false

Tackle this by printing similar log statements as presented in
interactive mode to the debug logger. Refactor the code a bit so there's
no need for a dedicated finished channel and to exit the goroutines
properly.

Co-authored-by: Evans Mungai <evans@replicated.com>
2023-02-15 19:13:35 +00:00
dependabot[bot]andlnx01 661a948d86 chore(deps): bump github.com/hashicorp/go-getter from 1.6.2 to 1.7.0 (#1019)
Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.6.2 to 1.7.0.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](https://github.com/hashicorp/go-getter/compare/v1.6.2...v1.7.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-15 19:13:00 +00:00
dependabot[bot]andlnx01 0bd6b88f04 chore(deps): bump github.com/jackc/pgx/v5 from 5.2.0 to 5.3.0 (#1018)
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/jackc/pgx/releases)
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.2.0...v5.3.0)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-15 18:41:59 +00:00
dependabot[bot]andlnx01 c6f7cb6df0 chore(deps): bump golang.org/x/text from 0.6.0 to 0.7.0 (#1017)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-14 17:39:31 +00:00
dependabot[bot]andlnx01 c640a01e9f chore(deps): bump go.opentelemetry.io/otel/sdk from 1.11.2 to 1.13.0 (#1020)
Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.11.2 to 1.13.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.11.2...v1.13.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-14 17:36:39 +00:00
Nick Meyer 8871e53584 remove PR label enforcement workflow (#1015) 2023-02-13 12:04:04 -06:00
Tom Wieczorek e85e91e784 chore: remove unused code (#1013)
Remove code snippets that are not used across the codebase.
2023-02-10 17:27:50 +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
dependabot[bot]andlnx01 b8680102e5 chore(deps): bump github.com/shirou/gopsutil/v3 from 3.22.12 to 3.23.1 (#1007)
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.12 to 3.23.1.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.22.12...v3.23.1)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-07 10:00:45 +00:00
dependabot[bot]andlnx01 b1d1b89068 chore(deps): bump sigs.k8s.io/controller-runtime from 0.14.2 to 0.14.4 (#1006)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.14.2 to 0.14.4.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/master/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.14.2...v0.14.4)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-07 09:59:37 +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
Evans Mungai e156b8c215 chore: Refactor in cluster analysers (#999)
Have all in-cluster analysers implement the same interface. This
will help with the implementation of code that requires making
calls to all analysers

Fixes #995
2023-02-03 15:26:36 +00:00
yunju.lly 1114902707 refactor: keep support bundle concat logic to be consistent with Preflight concat (#1002)
* refactor: keep support bundle concat logic to be consistent with Preflight
* test: add tests for support bundle spec concat function
2023-02-03 11:05:11 +00:00
Diamon WigginsandEvans Mungai 4fca6aff98 Deduplication for In-Cluster Collectors (#972)
* adding dedup for in cluster collectors

* add tests

* return collector as is whenever marshalling to json fails

---------

Co-authored-by: Evans Mungai <evans@replicated.com>
2023-02-01 14:14:43 -05: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
yunju.lly 0f6e6335fb fix: address runtime error of nil pointer when concatenating preflight specs (#998)
fix: address runtime error of nil pointer when concatenating preflight spec with hostpreflight spec in preflight run.go
2023-02-01 12:36:15 +00:00
dependabot[bot]andlnx01 925e94ad98 chore(deps): bump k8s.io/klog/v2 from 2.80.1 to 2.90.0 (#991)
Bumps [k8s.io/klog/v2](https://github.com/kubernetes/klog) from 2.80.1 to 2.90.0.
- [Release notes](https://github.com/kubernetes/klog/releases)
- [Changelog](https://github.com/kubernetes/klog/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes/klog/compare/v2.80.1...v2.90.0)

---
updated-dependencies:
- dependency-name: k8s.io/klog/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-31 14:35:49 +00:00
5bc3c33ee8 chore(deps): bump github.com/spf13/viper from 1.14.0 to 1.15.0 (#992)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.14.0 to 1.15.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.14.0...v1.15.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evans Mungai <evans@replicated.com>
2023-01-31 14:15:26 +00:00
dependabot[bot]andlnx01 271e2d2af9 chore(deps): bump k8s.io/cli-runtime from 0.26.0 to 0.26.1 (#994)
Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.26.0 to 0.26.1.
- [Release notes](https://github.com/kubernetes/cli-runtime/releases)
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.26.0...v0.26.1)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-31 13:09:51 +00:00
dependabot[bot]andlnx01 48ff918fcd chore(deps): bump sigs.k8s.io/controller-runtime from 0.14.1 to 0.14.2 (#993)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.14.1 to 0.14.2.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/master/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.14.1...v0.14.2)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-31 13:08:12 +00:00
Andrew Storms dcb91673b5 Fixes issue 985. update readme to change the flags on the cosign command (#986)
Fixes issue 985. update readme to change the flags on the cosign command.
2023-01-27 12:59:37 +13:00
Evans Mungai c62e71a578 chore: Filter tests to run when calling make test (#983) 2023-01-27 11:48:43 +13:00
dependabot[bot]andlnx01 a8da38dd15 chore(deps): bump github.com/containers/image/v5 from 5.23.1 to 5.24.0 (#976)
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.23.1 to 5.24.0.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.23.1...v5.24.0)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-26 10:10:13 +13:00
dependabot[bot]andlnx01 1756df905f chore(deps): bump k8s.io/apiextensions-apiserver from 0.26.0 to 0.26.1 (#977)
Bumps [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) from 0.26.0 to 0.26.1.
- [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases)
- [Commits](https://github.com/kubernetes/apiextensions-apiserver/compare/v0.26.0...v0.26.1)

---
updated-dependencies:
- dependency-name: k8s.io/apiextensions-apiserver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-26 09:58:29 +13:00
Diamon Wiggins 2fcdc77cd3 Standardize Cluster Resources Collector File Paths (#971)
* using const for cluster resources k8s objects to standardize directories and files
2023-01-25 13:34:15 -05:00
Ethan Mosbaugh ad1a56251f feat(hostpreflights): udp port status (#981)
* feat(hostpreflights): udp port status

* fix(hostpreflights): tcpPortStatus -> udpPortStatus
2023-01-24 16:38:54 -05:00
dependabot[bot]andlnx01 cf4eed1110 chore(deps): bump github.com/fatih/color from 1.13.0 to 1.14.1 (#980)
Bumps [github.com/fatih/color](https://github.com/fatih/color) from 1.13.0 to 1.14.1.
- [Release notes](https://github.com/fatih/color/releases)
- [Commits](https://github.com/fatih/color/compare/v1.13.0...v1.14.1)

---
updated-dependencies:
- dependency-name: github.com/fatih/color
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-24 17:40:35 +13:00
4939559789 chore(deps): bump k8s.io/client-go from 0.26.0 to 0.26.1 (#979)
* chore(deps): bump k8s.io/client-go from 0.26.0 to 0.26.1

Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.26.0 to 0.26.1.
- [Release notes](https://github.com/kubernetes/client-go/releases)
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.26.0...v0.26.1)

---
updated-dependencies:
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update schemas following client-go update

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Xav Paice <xav@replicated.com>
2023-01-24 17:37:00 +13:00
Nathan Sullivan 533d2917a9 CONTRIBUTING.md - fix path for design principles doc (#975)
Update CONTRIBUTING.md

fix path for design principles doc
2023-01-20 08:25:28 -06:00
Evans Mungai c8d9864235 Upgrade dependencies (#959)
* Upgrade docker distribution module

* Upgrade github.com/blang/semver dependency

* Upgrade github.com/godbus/dbus dependency
2023-01-13 10:32:39 +00: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
Nathan Sullivan de0371053a preflight: ensure --output produces an output file of the desired format (#951) 2023-01-13 07:55:47 +10:00
2b4bcd2433 chore(deps): bump oras.land/oras-go from 1.2.1 to 1.2.2 (#956)
* chore(deps): bump oras.land/oras-go from 1.2.1 to 1.2.2

Bumps [oras.land/oras-go](https://github.com/oras-project/oras-go) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/oras-project/oras-go/releases)
- [Commits](https://github.com/oras-project/oras-go/compare/v1.2.1...v1.2.2)

---
updated-dependencies:
- dependency-name: oras.land/oras-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore(deps): bump oras.land/oras-go from 1.2.1 to 1.2.2

Bumps [oras.land/oras-go](https://github.com/oras-project/oras-go) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/oras-project/oras-go/releases)
- [Commits](https://github.com/oras-project/oras-go/compare/v1.2.1...v1.2.2)

---
updated-dependencies:
- dependency-name: oras.land/oras-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evans Mungai <evans@replicated.com>
2023-01-10 13:56:56 +00:00
dependabot[bot]andlnx01 d9f4dca6b7 chore(deps): bump github.com/shirou/gopsutil/v3 from 3.22.11 to 3.22.12 (#957)
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.11 to 3.22.12.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/commits/v3.22.12)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 13:48:50 +00:00
dependabot[bot]andlnx01 76922ee59b chore(deps): bump sigs.k8s.io/controller-runtime from 0.13.1 to 0.14.1 (#955)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.13.1 to 0.14.1.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/master/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.13.1...v0.14.1)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 13:42:15 +00:00
dependabot[bot]andlnx01 4965941ea9 chore(deps): bump github.com/mattn/go-isatty from 0.0.16 to 0.0.17 (#954)
Bumps [github.com/mattn/go-isatty](https://github.com/mattn/go-isatty) from 0.0.16 to 0.0.17.
- [Release notes](https://github.com/mattn/go-isatty/releases)
- [Commits](https://github.com/mattn/go-isatty/compare/v0.0.16...v0.0.17)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-isatty
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 11:46:01 +00:00
Diamon Wiggins 18c4a39826 chore: Use org secret for username (#953)
use org secret for username
2023-01-10 11:37:07 +00:00
Dexter Yan 962e2c7d7e feat(support-bundle): optimize the error log of ceph and longhorn when kURL add-on were not enabled (#943) 2023-01-10 09:37:42 +13:00
Xav Paice f1066f5d76 CVE: bump golang.org/x/net (#948)
Resolves code scanning alert 19

Resolves Vulnerability CVE-2022-41717
2023-01-09 16:05:52 -04:00
Evans Mungai 70af0ff3d0 fix: Collect logs from all pods specified in logs collector spec (#952)
Fixes: #945
2023-01-09 12:04:01 -04:00
dependabot[bot]andlnx01 4601db58f9 Bump k8s.io/cli-runtime from 0.25.4 to 0.26.0 (#900)
Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.25.4 to 0.26.0.
- [Release notes](https://github.com/kubernetes/cli-runtime/releases)
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.25.4...v0.26.0)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 15:44:38 +13:00
dependabot[bot]andlnx01 ddc07e1205 Bump k8s.io/apiserver from 0.25.4 to 0.26.0 (#901)
Bumps [k8s.io/apiserver](https://github.com/kubernetes/apiserver) from 0.25.4 to 0.26.0.
- [Release notes](https://github.com/kubernetes/apiserver/releases)
- [Commits](https://github.com/kubernetes/apiserver/compare/v0.25.4...v0.26.0)

---
updated-dependencies:
- dependency-name: k8s.io/apiserver
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 15:27:31 +13:00
dependabot[bot]andlnx01 251fcc6dec Bump k8s.io/client-go from 0.25.4 to 0.26.0 (#902)
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.25.4 to 0.26.0.
- [Release notes](https://github.com/kubernetes/client-go/releases)
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.25.4...v0.26.0)

---
updated-dependencies:
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 15:05:57 +13:00
75eb0d7f89 Bump k8s.io/api from 0.25.4 to 0.26.0 (#904)
* Bump k8s.io/api from 0.25.4 to 0.26.0

Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.25.4 to 0.26.0.
- [Release notes](https://github.com/kubernetes/api/releases)
- [Commits](https://github.com/kubernetes/api/compare/v0.25.4...v0.26.0)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* update schemas

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Xav Paice <xav@replicated.com>
2023-01-09 14:17:57 +13:00
Edgar Lanting 199efca2ea Added note in to clarify purpose of MaxBytes in cluster_resources.go (#946) 2023-01-09 10:00:12 +13:00
Edgar Lanting a442ac8fc4 BREAKING: (Feature) maximum pod log size limit
introduces a new option to limit the size of a pod log when added to the bundle. This will make sure the support bundle will not grow to an unacceptable size and thus might contain information that is too old.

The maximum size of a pod log in a bundle is set by default to 5MB, and can be changed if we decide upon the need.

BREAKING CHANGE: any logs that are collected by the logs collector are now limited by default to 5MB unless a different size limit is specified.  Folks expecting log files larger than that to be collected without truncation will need to adjust their support bundle specs.

Fixes: #878
2023-01-05 16:23:43 +13:00
Evans Mungai a31e2ff1b9 chore: Add CLI flags to enable CPU & memory profiling (#926)
Allow collecting of CPU and memory diagnostics when running troubleshoot CLI applications using --memprofile and --cpuprofile flags. These flags accept file paths if where to store the collected runtime data
2023-01-04 11:56:07 +00:00
Nathan Sullivan 87c153cc8c preflight: add yaml output format (#940)
* preflight: add yaml output format

ref https://github.com/replicatedhq/troubleshoot/issues/905
2023-01-04 14:27:00 +13:00
Nathan Sullivan 8ba5d6f6cb GitHub Action goreleaser-test - convert to a matrix (#942)
github action goreleaser-test: convert to a matrix
2023-01-04 14:15:49 +13: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
Nathan SullivanandEvans Mungai d73d5c6a3a preflight: fix segfault when collector's are not defined in YAML (#939)
* preflight: fix segfault when collector's are not defined in YAML

* fix bug with kind: Preflight specs with uploadResultsTo, wrong variable being used :)

ref https://github.com/replicatedhq/troubleshoot/pull/894

Co-authored-by: Evans Mungai <evans@replicated.com>
2023-01-03 14:01:49 -04:00
8cb922c3b9 Bump mheap/github-action-required-labels from 2 to 3 (#938)
Bumps [mheap/github-action-required-labels](https://github.com/mheap/github-action-required-labels) from 2 to 3.
- [Release notes](https://github.com/mheap/github-action-required-labels/releases)
- [Commits](https://github.com/mheap/github-action-required-labels/compare/v2...v3)

---
updated-dependencies:
- dependency-name: mheap/github-action-required-labels
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evans Mungai <evans@replicated.com>
2023-01-03 16:35:35 +00:00
Nathan Sullivan 94dd7a670c Improve build-test-deploy GitHub Actions performance (#941)
* github build-test-deploy workflow: split goreleaser-test into 3 actions,
one for each ID/component (sharing a single config file)

rationale: speeding up github actions, goreleaser-test was taking
12-14mins and is the outlier longest to execute right now on this repo

* Revert "gitlab build-test-deploy workflow: split goreleaser-test into 3 actions,"

This reverts commit 61083dbbb8.

* github build-test-deploy workflow: split into 6 actions, divided by
GOARCH/GOOS

rationale: improve performance of checks on PR's

* .goreleaser.yaml - add a breadcrumb to ensure we keep the action jobs
list aligned
2023-01-03 13:07:10 +00:00
ada mancini 0f2892c316 add cpuArchitecture filter to nodeResources collector (#930)
* filter on cpu architecture

* filter by cpu architecture

* fail if we dont have a label match too

* add tests for cpu arch filter

* update for make schemas
2022-12-29 12:17:11 -05:00
Xav Paice df43c9fc21 If no pods are selected for log collector, do not wait for timeout (#932)
Fixes: #931
2022-12-29 11:17:54 +13:00
Evans Mungai ebeed77287 chore: Upgrade gopsutil to v3 (#927)
* Add host collector tests related to gopsutil upgrade

* Upgrade gopsutil to v3
2022-12-24 13:42:13 +13:00
Craig O'Donnell bc6528908f fix: collect rbac permissions error (#928) 2022-12-24 09:13:38 +13:00
ada mancini e2053a00a2 rename the troubleshoot label to "support-bundle" (#918) 2022-12-22 19:00:05 -03:00
David Rohnow 421cccf919 Add timeout context log collector (#914) 2022-12-22 10:23:37 +13:00
Dexter Yan be26462c19 feat(cluster_resources): increase default client burst and qps (#920)
* feat(collect): add client burst and qps
2022-12-22 09:49:42 +13:00
Xav Paice 13534bf7fd Minor format change to README.md (#924) 2022-12-21 08:34:16 -06:00
dependabot[bot]andlnx01 60b4931295 Bump goreleaser/goreleaser-action from 3 to 4 (#919)
Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 3 to 4.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](https://github.com/goreleaser/goreleaser-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-21 14:35:58 +13:00
danj-replicated e48fa36eaf Add generic kubernetes resource analyzer (#780)
* First draft of a generic cluster-resource analyzer

* Add more resource mappings

* Support some cluster-scoped resources

the structure of this could probably be a bit tidyer, but this now
allows us to target non-namespaced resources simply by not specifying
the namespace in the analyzer.

* General tidy up

* pull resource selection into it's own function

* remove pointless pointer to string

* Export findResource function

This lets other analyzers use it.

* Add tests for cluster resources analyzer

* Update schemas

* Address some of @banjoh's comments

* rework resource selection

thanks @banjoh

* Replace FindFiles with GetFile

Since we already know where we're looking for files,
it doesn't make sense to have to loop over a single item slice.

* Use assert instead of require

* format

* Change default behaviour for no namespace

Now not providing a namespace causes us to default to "default", with an
explicit bool to toggle cluster-scoped resource checking.

This should feel somewhat more intuitive when writing analyzers that use
this function

* Generate schemas

* Value → expectedValue
2022-12-19 11:31:43 -04:00
Diamon Wiggins f2be6f5829 Allow Preflight CLI to consume multiple specs as input (#894)
To keep both the Support Bundle and Preflight CLIs similar, this PR adds the ability for the Preflight binary to allow multiple specs be provided as CLI args and for them all to be run.
2022-12-14 14:50:01 -04:00
Evans Mungai cd1511a8fb fix(collectors): store unhealthy pod logs correctly (#909)
The symlinking logs feature led to a regression where symlinks of
unhealthy pods were overwritting logs in the support bundle. This
fix allows the cluster resources collector to instruct the logs
collector not to symlink logs, which in turn ensures logs are not
overwritten.

Fixes: #908
2022-12-14 14:47:20 -04:00
Diamon WigginsandEvans Mungai 9c77a0e3da Add sbctl integration proposal and move design directory into docs (#893)
* add sbctl integration proposal and move design directory into docs

Co-authored-by: Evans Mungai <evans@replicated.com>
2022-12-14 14:52:40 +13:00
Xav Paice c8820b3d8e chore: update containerd to v1.6.12 (#896)
Fixes: CVE-2022-23471
2022-12-09 16:48:37 -04:00
Xav Paice cf3a292877 Add proposal for concurrent collection (#809)
* Add proposal for concurrent collection

Design proposal for running collectors concurrently instead of sequentially.

* Update concurrent collector proposal with PR feedback
2022-12-09 16:48:09 -04:00
Diamon Wiggins a4c4b24056 Deduplication for Cluster Resources Collector (#832)
* add dedup for cluster resources collector
* restructure both collect.go in both pkg/supportbundle and pkg/preflight to be more similar for eventual refactor
2022-12-07 15:10:31 -04:00
dependabot[bot]andlnx01 e9f386a840 Bump github.com/jackc/pgx/v5 from 5.1.1 to 5.2.0 (#890)
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.1.1 to 5.2.0.
- [Release notes](https://github.com/jackc/pgx/releases)
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.1.1...v5.2.0)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-06 12:37:53 +00:00
dependabot[bot]andlnx01 d96b2ded78 Bump github.com/go-sql-driver/mysql from 1.6.0 to 1.7.0 (#889)
Bumps [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/go-sql-driver/mysql/releases)
- [Changelog](https://github.com/go-sql-driver/mysql/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-sql-driver/mysql/compare/v1.6.0...v1.7.0)

---
updated-dependencies:
- dependency-name: github.com/go-sql-driver/mysql
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-06 11:39:12 +00:00
Evans Mungai 8c31e61367 fix(collectors): Fix logs collection in longhorn collector (#886)
* fix(collectors): Fix logs collection in longhorn collector

* Small typo

* Run go fmt on added changes
2022-12-02 12:51:07 -05:00
Evans Mungai 8e174fb46c chore: Update PR template (#880) 2022-12-01 11:26:17 +00:00
Evans Mungai 2a61a8686a feat(collectors): Add TLS parameters to the postgres collector (#875)
For a postgres collector spec targeting a server configured to accept
(m)TLS connections we need to pass in the necessary parameters in order
to successfully connect to the server. Both preflight and support bundle
specs use this collector.

This change allows us to pass in the necessary TLS parameters via inlined
TLS configuration or via a secret reference.

Fixes #747
2022-11-30 15:52:08 +13:00
Xav Paice c85bf9a9a6 BREAKING: remove IP address redaction (#734)
This change removes the IPv4 address redaction which previously ran by default on all
support bundle collections.

Folks that want to redact IPv4 addresses will need to add that redactor manually to their redactor specs.
2022-11-30 08:42:42 +13:00
Evans Mungai bfb77ad601 feat(collectors): Add TLS parameters to the redis collector (#870)
feat(collectors): Add mTLS parameters to the redis collector

For a redis collector spec targeting a redis server configured to accept
(m)TLS connections we need to pass in the necessary TLS parameters in order
to successfully connect to the server. Both preflight and support bundle
specs use this collector.

This change allows us to pass in the necessary TLS parameters via inlined
TLS configuration or via a secret reference.

Fixes #746
2022-11-29 17:47:52 +00:00
Chuck D'Antonio c4c66633e5 Includes virtual memory parameters in Sysctl (#874)
TL;DR
-----

Updates Sysctl collector and analyzer for virtual memory parameters

Details
-------

Adds supoort for virtual memory parameters to the Sysctl collector and
analyzers. I uncovered this writing a pre-flight for a Helm chart that
includes ECK as a subchart. Since ECK requires a specific minimum value
for `vm.max_map_count` I wanted to use the Sysctl analyzer to check for
the expected value, but wasn't able to because of the limited values it
collected. I also learned that Sonarqube expects the same parameter to
be increased, so it seemed like a general enough requirement to add it
in.

The code updates the collector to collect values under `/proc/sys/vm`
and adds tests to the analyzer to based on the ECK requirements. Making
the tests pass required adding operators to the when expression, since
the existing code only allowed for `=`, `==`, and `===`. The when
expression now supports `>`, `<`, `>=`, and `<=`.

All tests pass.
2022-11-29 12:32:59 -05:00
f13a9598b2 Bump github/codeql-action from 1 to 2 (#865)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Diamon Wiggins <38189728+diamonwiggins@users.noreply.github.com>
2022-11-28 11:01:12 +13:00
4fa8411259 Bump rajatjindal/krew-release-bot from 0.0.38 to 0.0.43 (#866)
Bumps [rajatjindal/krew-release-bot](https://github.com/rajatjindal/krew-release-bot) from 0.0.38 to 0.0.43.
- [Release notes](https://github.com/rajatjindal/krew-release-bot/releases)
- [Changelog](https://github.com/rajatjindal/krew-release-bot/blob/master/.goreleaser.yml)
- [Commits](https://github.com/rajatjindal/krew-release-bot/compare/v0.0.38...v0.0.43)

---
updated-dependencies:
- dependency-name: rajatjindal/krew-release-bot
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Diamon Wiggins <38189728+diamonwiggins@users.noreply.github.com>
2022-11-28 10:59:37 +13: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
Dexter Yan 7e3a59cfc0 feat(analyze): add ExcludeFiles field to textAnazlye (#867)
* feat(analyze): add ExcludeFiles field to textAnazlye

* feat(analyze): fix test for getFiles

* feat(analyze): change function name to  excludeFilePaths

* feat(analyze): fix preflight test fail

* feat(analyze): add tests for excludeFiles

* feat(schemas): run make schemas

* feat(analyze): use getChildCollectedFileContents function prototype

* feat(analyze): reduce time complexity

* feat(longhorn): add getFileContents as getCollectedFileContents
2022-11-28 10:45:10 +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
Evans Mungai fbbcf87405 feat(collectors): Store all pod logs in cluster-resources directory (#821)
* feat(collectors): Store all pod logs in cluster-resources directory

All pod logs collected by the logs collector will now be stored in
/cluster-resources/pods/logs/[namespace]/[pod]/[container].log. This
will provide consistency and allow sbctl to find the logs when we run
`kubectl logs <pod>`. To allow backwards compatibility, symlinks of the
log files will be created in the current expected locations.

Closes: #744
2022-11-22 07:10:34 +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
Xav Paice c9b48aa716 docs: add ADR for mergable preflight specs (#858)
Adds a proposed Architecture Decision Records for the ability to specify
multiple specs per preflight test.
2022-11-21 11:29:51 -05:00
dependabot[bot]andlnx01 511671f699 Bump actions/setup-go from 1 to 3 (#853)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 1 to 3.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v1...v3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-18 18:19:42 +13:00
dependabot[bot]andlnx01 7a3bcfc74a Bump actions/download-artifact from 1 to 3 (#854)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 1 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v1...v3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-18 18:19:16 +13:00
dependabot[bot]andlnx01 e88f309391 Bump actions/upload-artifact from 1 to 3 (#855)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 1 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v1...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-18 18:18:46 +13:00
dependabot[bot]andlnx01 da48621eff Bump goreleaser/goreleaser-action from 2 to 3 (#852)
Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 2 to 3.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](https://github.com/goreleaser/goreleaser-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-18 17:44:56 +13:00
dependabot[bot]andlnx01 e51a25dc2f Bump actions/checkout from 2 to 3 (#856)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-18 17:35:55 +13:00
Camila Macedo 7a20aa1934 Add job to dependabot to update github actions (#851)
* Add job to dependabot to update github actions
2022-11-17 17:09:36 -05:00
Dexter Yan 78bcafe489 fix(flag): fix wrong output filename (#834)
* fix(flag): fix wrong output filename

* fix(flag): add reset flag function

* fix(flag): add output flag test cases

* fix(flag): move resetFlags function into private go test

* fix(flag): restructure flag tests with testify

* fix(flag): remove resetFlags function

* fix(flag): remove duplicated test and rewrite test names
2022-11-17 14:38:01 +13:00
Chris Sanders 233966d4be Add ghcr to package releases (#848) 2022-11-17 11:12:54 +13:00
Camila Macedo ebc569fcdb doc/readme : make clear that the links are just examples (#845)
* doc/readme : make clear that the links are just examples
2022-11-16 19:52:48 +13:00
dependabot[bot]andlnx01 0521b0e82b Bump k8s.io/apiserver from 0.25.3 to 0.25.4 (#837)
Bumps [k8s.io/apiserver](https://github.com/kubernetes/apiserver) from 0.25.3 to 0.25.4.
- [Release notes](https://github.com/kubernetes/apiserver/releases)
- [Commits](https://github.com/kubernetes/apiserver/compare/v0.25.3...v0.25.4)

---
updated-dependencies:
- dependency-name: k8s.io/apiserver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-16 15:55:12 +13:00
dependabot[bot]andlnx01 34f29f2914 Bump k8s.io/cli-runtime from 0.25.3 to 0.25.4 (#847)
Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.25.3 to 0.25.4.
- [Release notes](https://github.com/kubernetes/cli-runtime/releases)
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.25.3...v0.25.4)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-16 15:40:51 +13:00
dependabot[bot]andlnx01 1de1d00680 Bump github.com/containers/image/v5 from 5.23.0 to 5.23.1 (#836)
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.23.0 to 5.23.1.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.23.0...v5.23.1)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-16 14:59:57 +13:00
dependabot[bot]andlnx01 92a5f3569f Bump k8s.io/api from 0.25.3 to 0.25.4 (#838)
Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.25.3 to 0.25.4.
- [Release notes](https://github.com/kubernetes/api/releases)
- [Commits](https://github.com/kubernetes/api/compare/v0.25.3...v0.25.4)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-16 14:59:10 +13:00
dependabot[bot]andlnx01 495b1a760d Bump k8s.io/apimachinery from 0.25.3 to 0.25.4 (#839)
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.25.3 to 0.25.4.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.25.3...v0.25.4)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-16 14:58:43 +13:00
dependabot[bot]andlnx01 7bcfd01d43 Bump k8s.io/client-go from 0.25.3 to 0.25.4 (#835)
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.25.3 to 0.25.4.
- [Release notes](https://github.com/kubernetes/client-go/releases)
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.25.3...v0.25.4)

---
updated-dependencies:
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-16 14:58:18 +13:00
Camila Macedo f2ffef80af Revert "Remove ingress check from https://preflight.replicated.com (#840)" (#846)
This reverts commit a5244a262c.
2022-11-16 14:57:47 +13:00
Camila Macedo a5244a262c Remove ingress check from https://preflight.replicated.com (#840)
## Description:

Currently, when we install an k8s with kurl and we run kubectl preflight https://preflight.replicated.com it will fail:

> ------------
> Check FAIL
> Title: Ingress
> Message: Contour ingress not found!

Therefore,  Contour ingress does not seems a pre-requirement to kURL. So, should we have this check in the default example/test?
2022-11-15 08:55:04 -06:00
Camila Macedo 18d9a16ceb Minimal memory requirement for kURL is 8GI (#843) 2022-11-15 08:54:29 -06:00
Xav Paice 473738d709 Add proposal to consolidate collection code (#810)
Proposal to reduce duplication of code, and implement a more stable, public,
collection API.
2022-11-15 15:50:37 +13:00
Diamon Wiggins c34d80c300 Discover Redactors in Cluster (#827)
Adds the ability to search for support bundle specs and redactors, in both configmaps and secrets
2022-11-10 17:36:51 +13:00
Nick Meyer 38c1193ace correct checked out ref for FOSSA tests (#833) 2022-11-09 14:34:14 -05:00
Xav Paice 6b87cdb267 docs: ADR-001 remove default redaction of IP addresses (#823)
* Add ADR-001 Remove IP address redaction

Add design record (proposed) for removing IP address redaction by default.

Fixes: #735
2022-11-09 16:37:12 +13:00
Xav Paice 80cca8a487 Add omitempty to StorageClassName in schema (#814)
* Add omitempty to StorageClassName in schema

Allow a StorageClass spec to not require specify storageClassName.

Fixes: #813
2022-11-09 11:34:37 +13:00
dependabot[bot]andlnx01 6e79c169e0 Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (#829)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-09 09:22:44 +13:00
dependabot[bot]andlnx01 7edbec3e45 Bump sigs.k8s.io/controller-runtime from 0.13.0 to 0.13.1 (#828)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/master/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.13.0...v0.13.1)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-08 18:16:52 +13:00
Xav Paice 8f8e0dc6e3 chore: Update PULL_REQUEST_TEMPLATE.md (#831)
Fix a minor grammatical error in the pull request template
2022-11-08 18:14:16 +13:00
Dexter Yan e2c20cfda4 feat(github): add pull request template (#830)
* feat(github): add pull request template

* feat(github): rephrase pr template
2022-11-08 17:41:42 +13:00
Nick Meyer ccb7b1619b Update fossa (#826)
* Transition FOSSA to locally-managed action

* correct ref
2022-11-07 11:46:27 -06:00
Xav Paice d5c0dd4857 Add ADR directory and readme (#822)
Adds a directory and readme.md for storing Architecture Design Records
2022-11-07 13:41:32 +00:00
Xav Paice 8c5cd5a460 Update CONTRINBUTING.md with community info (#819)
Add to CONTRIBUTING.md:
* community meeting calendar and notes
* IRC
* commit messages info
2022-11-02 15:22:51 -04:00
dependabot[bot]andlnx01 9073a14c02 Bump periph.io/x/host/v3 from 3.7.2 to 3.8.0 (#815)
Bumps [periph.io/x/host/v3](https://github.com/periph/host) from 3.7.2 to 3.8.0.
- [Release notes](https://github.com/periph/host/releases)
- [Commits](https://github.com/periph/host/compare/v3.7.2...v3.8.0)

---
updated-dependencies:
- dependency-name: periph.io/x/host/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-02 15:04:03 +13:00
Xav Paice 3513eeca19 Ensure clusterResources is added prior to other collectors (#768)
This change ensures that the clusterResources collector runs prior to any others
in order to not collect info on pods that collectors run during collection.

Additionally centralizes functions that are common to all collection to make future
maintenance simpler.

Fixes: #767
2022-11-01 12:16:01 +13:00
Edgar Lanting 34817b67d0 Update cluster_resources.go (#804)
Due to deprecation of the API at `policy/v1beta1` for `PodDisruptionBudgets` and `batch/v1beta1` for `CronJobs`, updated cluster_resources.go to accommodate using either apiVersion v1 & v1beta1
2022-10-28 14:56:57 +13:00
Nick Meyer 388e7ca77d Update FOSSA API key (#803) 2022-10-25 15:17:12 -05:00
dependabot[bot]andlnx01 d8091909b3 Bump k8s.io/cli-runtime from 0.25.2 to 0.25.3 (#800)
Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.25.2 to 0.25.3.
- [Release notes](https://github.com/kubernetes/cli-runtime/releases)
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.25.2...v0.25.3)

---
updated-dependencies:
- dependency-name: k8s.io/cli-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-25 14:58:37 +13:00
dependabot[bot]andlnx01 9ae416ab23 Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 (#801)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-25 14:58:03 +13:00
dependabot[bot]andlnx01 e373c71874 Bump github.com/spf13/cobra from 1.6.0 to 1.6.1 (#802)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-25 14:57:26 +13:00
Diamon Wiggins e2ac7bf715 fix ceph title (#799) 2022-10-24 12:35:35 -05:00
Diamon Wiggins 3d4bd4b601 trim whitespace from collected contents (#796) 2022-10-21 16:41:07 +13:00
Diamon Wiggins 3b2aae1866 Remove unused Preflight spec (#782)
* remove unused preflight-spec

* removing other unused files
2022-10-21 11:38:43 +13:00
dependabot[bot]andlnx01 8a4f539173 Bump oras.land/oras-go from 1.2.0 to 1.2.1 (#786)
Bumps [oras.land/oras-go](https://github.com/oras-project/oras-go) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/oras-project/oras-go/releases)
- [Commits](https://github.com/oras-project/oras-go/compare/v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: oras.land/oras-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-20 16:24:36 +13:00
dependabot[bot]andlnx01 89b98c197e Bump k8s.io/apiserver from 0.25.2 to 0.25.3 (#783)
Bumps [k8s.io/apiserver](https://github.com/kubernetes/apiserver) from 0.25.2 to 0.25.3.
- [Release notes](https://github.com/kubernetes/apiserver/releases)
- [Commits](https://github.com/kubernetes/apiserver/compare/v0.25.2...v0.25.3)

---
updated-dependencies:
- dependency-name: k8s.io/apiserver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-20 16:02:24 +13:00
ada mancini 000abae68b plug sbctl (#790) in README.md 2022-10-19 10:22:47 +13:00
Ahmed MousaandEdgar Lanting 764f0ac8b6 'added collection of roles, cluster roles and their respective bindings' (#779)
Co-authored-by: Edgar Lanting <edgarlanting@users.noreply.github.com>
2022-10-17 11:02:07 -05:00
Diamon Wiggins 04c7a18da3 Fix Progress Callback for Support Bundle Collection (#781)
fix progress callback for support bundle and revert collector title changes
2022-10-14 12:29:59 -04:00
dependabot[bot]andlnx01 9b37b98a93 Bump github.com/opencontainers/image-spec from 1.1.0-rc1 to 1.1.0-rc2 (#777)
Bumps [github.com/opencontainers/image-spec](https://github.com/opencontainers/image-spec) from 1.1.0-rc1 to 1.1.0-rc2.
- [Release notes](https://github.com/opencontainers/image-spec/releases)
- [Changelog](https://github.com/opencontainers/image-spec/blob/main/RELEASES.md)
- [Commits](https://github.com/opencontainers/image-spec/compare/v1.1.0-rc1...v1.1.0-rc2)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/image-spec
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-13 15:23:34 +13:00
dependabot[bot]andlnx01 32f622a714 Bump github.com/containers/image/v5 from 5.19.3 to 5.23.0 (#755)
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.19.3 to 5.23.0.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.19.3...v5.23.0)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-13 13:28:30 +13:00
Diamon Wiggins bcaaa9e59a Fix Preflight CheckRBAC (#776)
* return collect result instead of nil
2022-10-13 12:54:40 +13:00
Chuck D'Antonio 2298ec3030 Supports the Kubernetes distribution analyzer identifying VMware Tanzu (#766)
Adds a check to the Kubernetes distribution analyzer to identify VMware Tanzu using the same approach as identifying OpenShift.
2022-10-13 12:52:22 +13:00
dependabot[bot]andlnx01 afa2eb552a Bump github.com/spf13/cobra from 1.5.0 to 1.6.0 (#775)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-13 12:48:07 +13:00
Xav Paice 771058980a bump golang.org/x/text to 0.3.8 (#773)
Fixes CVE-2022-32149
2022-10-12 10:53:42 -05:00
Xav Paice d789119634 Update github.com/sylabs/sif/v2 to 2.8.1 (#772)
References
CVE-2004-2761
CVE-2005-4900

Fixes: Dependabot alert #19
2022-10-12 10:52:10 -05:00
Diamon Wiggins 48beb303be export context field from collector structs (#771) 2022-10-11 14:54:54 -04:00
Xav Paice e30d279cad update CODEOWNERS file (#770)
Adds a new group to CODEOWNERS as global owner, and CREs for .md files.
2022-10-11 09:02:34 -05:00
stefanrepl 9c986a74a6 make runPreflight and preflight cli flags public (#769) 2022-10-10 16:34:54 -06: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
Edgar Lanting 56a68a4fef Issue #695 - Add --no-uri flag to support-bundle to ignore the uri field and revert back to the default spec… (#717)
Add --follow-uri flag to support-bundle to ignore the uri field when set in a spec

Implement the new CLI flag in `root.go` so we can pass it if we need to ignore the `uri` field in a spec. This also serves as a minimal documentation effort when running `support-bundle --help`.

Fixes: #695
2022-10-10 07:30:21 +13:00
Xav Paice b3e662c988 minor lint update for README.md (#727) 2022-10-07 13:15:01 -04: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
Evans Mungai 906fa88119 Fit wrapped long url in more information analyser message (#758) 2022-10-06 10:21:52 +13:00
ada mancini eb40b9422f implement uri: field (#702) 2022-10-05 15:35:55 +13:00
Xav Paice f6531b8434 Update golang.org/x/net to current version (#757)
Fixes: #756 (CVE resolution)
2022-10-05 13:13:02 +13:00
danj-replicated e80235f0a8 Collect resourcequotas (#729)
Signed-off-by: Dan Jones <danj@replicated.com>

Signed-off-by: Dan Jones <danj@replicated.com>
2022-10-05 12:58:54 +13:00
Diamon Wiggins c7b84ad1e5 Refactor in-clusters collectors to use struct per collector (#670)
refactor in-clusters collectors to use struct per collector
2022-10-03 13:53:05 -04:00
Diamon Wiggins 44ae409081 fix concat spec for cluster secrets (#750) 2022-09-30 08:24:33 +13:00
421 changed files with 70718 additions and 5540 deletions
-4
View File
@@ -1,4 +0,0 @@
version: 3
project:
id: github.com/replicatedhq/troubleshoot
+17 -1
View File
@@ -1 +1,17 @@
* @replicatedhq/day2
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# More details are here: https://help.github.com/articles/about-codeowners/
# The '*' pattern is global owners.
# Order is important. The last matching pattern has the most precedence.
# The folders are ordered as follows:
# In each subsection folders are ordered first by depth, then alphabetically.
# This should make it easy to add new rules without breaking existing ones.
## RULES
* @replicatedhq/troubleshoot
*.md @replicatedhq/cre
+21
View File
@@ -0,0 +1,21 @@
## Description, Motivation and Context
Please include a summary of the change or what problem it solves. Please also include relevant motivation and context.
<!--- If it relates to an open issue, please link to the issue here.
e.g.
Fixes: #414
-->
## Checklist
- [ ] New and existing tests pass locally with introduced changes.
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] The commit message(s) are informative and highlight any breaking changes
- [ ] Any documentation required has been added/updated. For changes to https://troubleshoot.sh/ create a PR [here](https://github.com/replicatedhq/troubleshoot.sh/pulls)
## Does this PR introduce a breaking change?
- [ ] Yes
- [ ] No
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
+12
View File
@@ -13,3 +13,15 @@ updates:
- "type::chore"
schedule:
interval: "weekly"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
labels:
- "dependencies"
- "github-actions"
- "type::chore"
schedule:
interval: "weekly"
+156 -46
View File
@@ -1,5 +1,10 @@
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
branches:
- main
push:
@@ -8,17 +13,24 @@ on:
tags:
- "v*.*.*"
concurrency:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
fail_if_pull_request_is_draft:
if: github.event.pull_request.draft == true
runs-on: ubuntu-20.04
steps:
- name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass.
run: exit 1
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-go@v1
- uses: actions/setup-go@v4
with:
go-version: "1.19"
go-version: "1.20"
- name: setup env
run: |
@@ -26,24 +38,61 @@ jobs:
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: make test
test-integration:
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: setup env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- uses: actions/checkout@v4
- uses: replicatedhq/action-k3s@main
id: k3s
with:
version: v1.23.6-k3s1
- run: make test-integration
ensure-schemas-are-generated:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: setup env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: make check-schemas
compile-preflight:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
- uses: actions/setup-go@v4
with:
go-version: '1.19'
go-version: "1.20"
- name: setup env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- uses: actions/checkout@master
- uses: actions/checkout@v4
- run: make generate preflight
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
with:
name: preflight
path: bin/preflight
@@ -57,16 +106,23 @@ jobs:
with:
version: v1.23.6-k3s1
- name: Download preflight binary
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: preflight
path: bin/
- run: chmod +x bin/preflight
- run: |
set +e
./bin/preflight --interactive=false --format=json https://preflight.replicated.com > result.json
EXIT_CODE=$?
cat result.json
EXIT_STATUS=0
if [ $EXIT_CODE -ne 3 ]; then
echo "Expected exit code of 3 (some checks failed), got $EXIT_CODE"
EXIT_STATUS=1
fi
if grep -q "was not collected" result.json; then
echo "Some files were not collected"
EXIT_STATUS=1
@@ -93,33 +149,39 @@ jobs:
runs-on: ubuntu-latest
needs: compile-preflight
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- uses: replicatedhq/action-k3s@main
id: k3s
with:
version: v1.23.6-k3s1
- name: Download preflight binary
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: preflight
path: bin/
- run: chmod +x bin/preflight
- run: make e2e-test
- run: make preflight-e2e-test
run-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make run-examples
compile-supportbundle:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
- uses: actions/setup-go@v4
with:
go-version: '1.19'
go-version: "1.20"
- name: setup env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- uses: actions/checkout@master
- uses: actions/checkout@v4
- run: make generate support-bundle
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
with:
name: support-bundle
path: bin/support-bundle
@@ -128,13 +190,13 @@ jobs:
runs-on: ubuntu-latest
needs: compile-supportbundle
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- uses: replicatedhq/action-k3s@main
id: k3s
with:
version: v1.23.6-k3s1
- name: Download support-bundle binary
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: support-bundle
path: bin/
@@ -143,20 +205,58 @@ jobs:
- run: ./bin/support-bundle ./examples/support-bundle/sample-supportbundle.yaml
- run: ./bin/support-bundle https://kots.io
compile-collect:
validate-supportbundle-e2e:
runs-on: ubuntu-latest
needs: compile-supportbundle
steps:
- uses: actions/setup-go@v1
- uses: actions/checkout@v4
- uses: replicatedhq/action-k3s@main
id: k3s
with:
go-version: '1.19'
version: v1.23.6-k3s1
- name: Download support bundle binary
uses: actions/download-artifact@v3
with:
name: support-bundle
path: bin/
- run: chmod +x bin/support-bundle
- run: make support-bundle-e2e-test
validate-supportbundle-e2e-go-test:
runs-on: ubuntu-latest
needs: compile-supportbundle
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: setup env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Download support bundle binary
uses: actions/download-artifact@v3
with:
name: support-bundle
path: bin/
- run: chmod +x bin/support-bundle
- run: make support-bundle-e2e-go-test
compile-collect:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: setup env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- uses: actions/checkout@v4
- run: make generate collect
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
with:
name: collect
path: bin/collect
@@ -164,22 +264,33 @@ jobs:
goreleaser-test:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') != true
strategy:
matrix:
goarch: [amd64, arm64]
goos: [darwin, linux, windows]
include:
- goarch: arm
goos: linux
- goarch: riscv64
goos: linux
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- uses: actions/setup-go@v1
uses: actions/checkout@v4
with:
go-version: "1.19"
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v5
with:
version: "v0.183.0"
args: build --rm-dist --snapshot --config deploy/.goreleaser.yaml
args: build --rm-dist --snapshot --config deploy/.goreleaser.yaml --single-target
env:
GOARCH: ${{ matrix.goarch }}
GOOS: ${{ matrix.goos }}
goreleaser:
runs-on: ubuntu-latest
@@ -190,23 +301,23 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: azure/docker-login@v1
with:
username: repldeploy2
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Unshallow
run: git fetch --prune --unshallow
- uses: actions/setup-go@v1
- uses: actions/setup-go@v4
with:
go-version: "1.19"
go-version: "1.20"
- uses: sigstore/cosign-installer@main
- uses: sigstore/cosign-installer@v3
with:
cosign-release: "v1.2.1"
# DO NOT USE v2 until we decide on whether to use Rekor or not
cosign-release: "v1.13.1" # Binary version to install
- name: Get Cosign Key
run: |
@@ -222,19 +333,18 @@ jobs:
COSIGN_KEY: ${{ secrets.COSIGN_KEY }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v5
with:
version: "v0.183.0"
version: "v1.x" # Binary version to install
args: release --rm-dist --config deploy/.goreleaser.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update new preflight version in krew-index
uses: rajatjindal/krew-release-bot@v0.0.38
uses: rajatjindal/krew-release-bot@v0.0.46
with:
krew_template_file: deploy/krew/preflight.yaml
- name: Update new support-bundle version in krew-index
uses: rajatjindal/krew-release-bot@v0.0.38
uses: rajatjindal/krew-release-bot@v0.0.46
with:
krew_template_file: deploy/krew/support-bundle.yaml
+2 -2
View File
@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
@@ -22,6 +22,6 @@ jobs:
severity: 'HIGH,CRITICAL'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v1
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
+42
View File
@@ -0,0 +1,42 @@
on:
push:
branches:
- main
pull_request:
env:
TRIVY_VERSION: 0.44.1
name: License scan
jobs:
license:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
- name: Install Go deps
run: go mod download
- name: Install trivy
run: |
wget https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.deb
sudo dpkg -i trivy_${TRIVY_VERSION}_Linux-64bit.deb
- name: Create license report artifact
run: trivy fs --scanners license --skip-dirs ".github" . | tee license-report.txt
- name: Upload license report artifact
uses: actions/upload-artifact@v3
with:
name: license-report
path: license-report.txt
- name: Check for unknown licenses
run: trivy fs --scanners license --skip-dirs ".github" --exit-code 1 --severity UNKNOWN . || echo "::warning::Unknown licenses found, please verify"
- name: Check for forbidden licenses and fail
run: trivy fs --scanners license --skip-dirs ".github" --exit-code 1 --severity CRITICAL,HIGH .
-19
View File
@@ -1,19 +0,0 @@
name: PR license scan
on:
pull_request:
jobs:
fossa-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Run FOSSA Analyze"
uses: fossas/fossa-action@main
with:
api-key: cf2d0196f5b5bb2fd245c559af8766d8 # push-only token, safe to expose
- name: "Run FOSSA Test"
uses: fossas/fossa-action@main
with:
api-key: cf2d0196f5b5bb2fd245c559af8766d8 # push-only token, safe to expose
run-tests: true
-25
View File
@@ -1,25 +0,0 @@
name: Require pull request labels
permissions:
pull-requests: read
on:
pull_request:
types:
- opened
- labeled
- unlabeled
- synchronize
jobs:
require-pr-labels:
uses: replicatedhq/reusable-workflows/.github/workflows/pr-enforce-labels.yaml@main
require-bug-labels:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v2
if: ${{ github.event.label.name == 'type::bug' }}
with:
mode: exactly
count: 1
labels: "bug::normal, bug::regression"
+14
View File
@@ -6,6 +6,11 @@
*.so
*.dylib
bin
.DS_Store
# npm generated files
node_modules/
package*.json
# Test binary, build with `go test -c`
*.test
@@ -25,6 +30,8 @@ vendor
*.swp
*.swo
*~
.envrc
dist
try.sh
@@ -34,3 +41,10 @@ workspace.*
cosign.key
sbom/
# Ignore local pre-commit config
.pre-commit-config.yaml
# Ignore generated support bundles
*.tar.gz
!testdata/supportbundle/*.tar.gz
+12
View File
@@ -0,0 +1,12 @@
# https://golangci-lint.run/usage/configuration/#config-file
run:
allow-parallel-runners: true
timeout: 30s
linters:
enable:
- gocritic
- gocyclo
- gofmt
- gosec
+85 -10
View File
@@ -1,21 +1,27 @@
# Contributing to Troubleshoot
Thank you for your interest in Troubleshoot, we welcome your participation. Please familiarize yourself with our [Code of Conduct](https://github.com/replicatedhq/troubleshoot/blob/master/CODE_OF_CONDUCT.md) prior to contributing. There are a number of ways to participate in Troubleshoot as outlined below:
Thank you for your interest in Troubleshoot, we welcome your participation. Please familiarize yourself with our [Code of Conduct](https://github.com/replicatedhq/troubleshoot/blob/main/CODE_OF_CONDUCT.md) prior to contributing. There are a number of ways to participate in Troubleshoot as outlined below:
# Community
For discussions about developing Troubleshoot, there's an [#app-troubleshoot channel in Kubernetes Slack](https://kubernetes.slack.com/channels/app-troubleshoot), plus IRC using [Libera](ircs://irc.libera.chat:6697/#troubleshoot) (#troubleshoot).
There are [community meetings](https://calendar.google.com/calendar/u/0?cid=Y19mMGx1aGhiZGtscGllOGo5dWpicXMwNnN1a0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t) on a regular basis, with a shared calendar and [public notes](https://hackmd.io/yZbotEHdTg6TfRZBzb8Tcg)
## Issues
- [Request a New Feature](https://github.com/replicatedhq/troubleshoot/issues/new?assignees=&labels=feature&template=feature_enhancement.md) Create an issue to add functionality that addresses a problem or adds an enhancement.
- [Request a New Feature](https://github.com/replicatedhq/troubleshoot/issues/new?assignees=&labels=feature&template=feature_enhancement.md) Create an issue to add functionality that addresses a problem or adds an enhancement.
- [Report a Bug](https://github.com/replicatedhq/troubleshoot/issues/new?assignees=&labels=bug&template=bug_report.md) Report a problem or unexpected behaviour with Troubleshoot.
## Design Principles
When implementing a new feature please review the [design principles](./design/design-principles.md) to help guide the approach.
When implementing a new feature please review the [design principles](./docs/design/design-principles.md) to help guide the approach.
## Development Environment
To get started we recommend:
1. Go (v1.17 or later)
1. Go (v1.20 or later)
2. A Kubernetes cluster (we recommend <https://k3d.io/>. This requires Docker v20.10.5 or later)
3. Fork and clone the repo to $GOPATH/src/github.com/replicatedhq/
4. Run `make support-bundle preflight` to generate binaries
@@ -24,12 +30,42 @@ To get started we recommend:
> Note: recent versions of Go support easy cross-compilation. For example, to cross-compile a Linux binary from MacOS:
> `GOOS=linux GOARCH=amd64 make support-bundle preflight`
6. Install [golangci-lint] linter and run `make lint` to execute additional code linters.
### Build automatically on save with `watch`
1. Install `npm`
2. Run `make watch` to build binaries automatically on saving. Note: you may still have to run `make schemas` if you've added API changes, like a new collector or analyzer type.
### Syncing to a test cluster with `watchrsync`
1. Install `npm`
2. Export `REMOTES=<user>@<ip>` so that `watchrsync` knows where to sync.
3. Maybe run `export GOOS=linux` and `export GOARCH=amd64` so that you build Linux binaries.
4. run `make watchrsync` to build and sync binaries automatically on saving.
```
ssh-add --apple-use-keychain ~/.ssh/google_compute_engine
export REMOTES=ada@35.229.61.56
export GOOS=linux
export GOARCH=amd64
make watchrsync
# bin/watchrsync.js
# make support-bundle
# go build -tags "netgo containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp" -installsuffix netgo -ldflags " -s -w -X github.com/replicatedhq/troubleshoot/pkg/version.version=`git describe --tags --dirty` -X github.com/replicatedhq/troubleshoot/pkg/version.gitSHA=`git rev-parse HEAD` -X github.com/replicatedhq/troubleshoot/pkg/version.buildTime=`date -u +"%Y-%m-%dT%H:%M:%SZ"` " -o bin/support-bundle github.com/replicatedhq/troubleshoot/cmd/troubleshoot
# rsync bin/support-bundle ada@35.229.61.56:
# date
# Tue May 16 14:14:13 EDT 2023
# synced
```
### Testing
To run the tests locally run the following:
```bash
make test
make test RUN=TestClusterResources_Merge
```
Additionally, e2e tests can be run with:
@@ -38,7 +74,33 @@ Additionally, e2e tests can be run with:
make support-bundle preflight e2e-test
```
A Kubernetes cluster as well as `jq` are required to run e2e tests.
A running Kubernetes cluster as well as `jq` are required to run e2e tests.
### Profiling
You are able to collect CPU & memory runtime properties and store the data for analysis in a file. To do so, pass in the file paths using `--cpuprofile` and `--memprofile` flags in the CLI. Once you have your data collected, you can analyse it using [pprof visualization tool](https://github.com/google/pprof/blob/main/doc/README.md). Here is how
Run support bundle and with CPU & memory profile flags
```sh
./bin/support-bundle examples/support-bundle/sample-supportbundle.yaml --cpuprofile=cpu.prof --memprofile=mem.prof
```
Visualize using [pprof](https://github.com/google/pprof/blob/main/doc/README.md)
```sh
go tool pprof -http=":8000" cpu.prof
go tool pprof -http=":8001" mem.prof
```
**Additional flags for memory profiling**
- `inuse_space`: Amount of memory allocated and not released yet (default).
- `inuse_objects`: Amount of objects allocated and not released yet.
- `alloc_space`: Total amount of memory allocated (regardless of released).
- `alloc_objects`: Total amount of objects allocated (regardless of released).
More on profiling please visit https://go.dev/doc/diagnostics#profiling
## Contribution workflow
@@ -48,23 +110,36 @@ This is a rough outline of how to prepare a contribution:
- Create a topic branch from where you want to base your work (branched from `main` is a safe choice).
- Make commits of logical units.
- When your changes are ready to merge, squash your history to 1 commit.
- For example, if you want to squash your last 3 commits and write a new commit message:
- For example, if you want to squash your last 3 commits and write a new commit message:
```
git reset --soft HEAD~3 &&
git reset --soft HEAD~3 &&
git commit
```
```
- If you want to keep the previous commit messages and concatenate them all into a new commit, you can do something like this instead:
```
git reset --soft HEAD~3 &&
git reset --soft HEAD~3 &&
git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"
```
- Push your changes to a topic branch in your fork of the repository.
- Submit a pull request to the original repository. It will be reviewed in a timely manner.
### Pull Requests
A pull request should address a single issue, feature or bug. For example, lets say you've written code that fixes two issues. That's great! However, you should submit two small pull requests, one for each issue as opposed to combining them into a single larger pull request. In general the size of the pull request should be kept small in order to make it easy for a reviewer to understand, and to minimize risks from integrating many changes at the same time. For example, if you are working on a large feature you should break it into several smaller PRs by implementing the feature as changes to several packages and submitting a separate pull request for each one. Squash commit history when preparing your PR so it merges as 1 commit.
A pull request should address a single issue, feature or bug. For example, lets say you've written code that fixes two issues. That's great! However, you should submit two small pull requests, one for each issue as opposed to combining them into a single larger pull request. In general the size of the pull request should be kept small in order to make it easy for a reviewer to understand, and to minimize risks from integrating many changes at the same time. For example, if you are working on a large feature you should break it into several smaller PRs by implementing the feature as changes to several packages and submitting a separate pull request for each one. Squash commit history when preparing your PR so it merges as 1 commit.
Code submitted in pull requests must be properly documented, formatted and tested in order to be approved and merged. The following guidelines describe the things a reviewer will look for when they evaluate your pull request. Here's a tip. If your reviewer doesn't understand what the code is doing, they won't approve the pull request. Strive to make code clear and well documented. If possible, request a reviewer that has some context on the PR.
### Commit messages
Commit messages should follow the general guidelines:
- Breaking changes should be highlighted in the heading of the commit message.
- Commits should be clear about their purpose (and a single commit per thing that changed)
- Messages should be descriptive:
- First line, 50 chars or less, as a heading/title that people can find
- Then a paragraph explaining things
- Consider a footer with links to which bugs they fix etc, bearing in mind that Github does some of this magic already
+88 -15
View File
@@ -2,10 +2,11 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
SHELL := /bin/bash -o pipefail
SHELL := bash -o pipefail
VERSION_PACKAGE = github.com/replicatedhq/troubleshoot/pkg/version
VERSION ?=`git describe --tags --dirty`
DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
RUN?=""
GIT_TREE = $(shell git rev-parse --is-inside-work-tree 2>/dev/null)
ifneq "$(GIT_TREE)" ""
@@ -34,8 +35,12 @@ define LDFLAGS
endef
BUILDFLAGS = -tags "netgo containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp" -installsuffix netgo
BUILDPATHS = ./pkg/... ./cmd/... ./internal/...
E2EPATHS = ./test/e2e/...
TESTFLAGS ?= -v -coverprofile cover.out
all: test support-bundle preflight collect
.DEFAULT: all
all: test build
.PHONY: ffi
ffi: fmt vet
@@ -43,12 +48,46 @@ ffi: fmt vet
.PHONY: test
test: generate fmt vet
go test ${BUILDFLAGS} ./pkg/... ./cmd/... -coverprofile cover.out
if [ -n $(RUN) ]; then \
go test ${BUILDFLAGS} ${BUILDPATHS} ${TESTFLAGS} -run $(RUN); \
else \
go test ${BUILDFLAGS} ${BUILDPATHS} ${TESTFLAGS}; \
fi
.PHONY: e2e-test
e2e-test:
# Go tests that require a K8s instance
# TODOLATER: merge with test, so we get unified coverage reports? it'll add 21~sec to the test job though...
.PHONY: test-integration
test-integration:
go test -v --tags "integration exclude_graphdriver_devicemapper exclude_graphdriver_btrfs" ${BUILDPATHS}
.PHONY: preflight-e2e-test
preflight-e2e-test:
./test/validate-preflight-e2e.sh
.PHONY: run-examples
run-examples:
./test/run-examples.sh
.PHONY: support-bundle-e2e-test
support-bundle-e2e-test:
./test/validate-support-bundle-e2e.sh
.PHONY: support-bundle-e2e-go-test
support-bundle-e2e-go-test:
if [ -n $(RUN) ]; then \
go test ${BUILDFLAGS} ${E2EPATHS} -v -run $(RUN); \
else \
go test ${BUILDFLAGS} ${E2EPATHS} -v; \
fi
# Build all binaries in parallel ( -j )
build:
@echo "Build cli binaries"
$(MAKE) -j support-bundle preflight analyze collect
mod-tidy:
go mod tidy
.PHONY: support-bundle
support-bundle:
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/support-bundle github.com/replicatedhq/troubleshoot/cmd/troubleshoot
@@ -60,18 +99,18 @@ preflight:
.PHONY: analyze
analyze:
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/analyze github.com/replicatedhq/troubleshoot/cmd/analyze
.PHONY: collect
collect:
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/collect github.com/replicatedhq/troubleshoot/cmd/collect
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/collect github.com/replicatedhq/troubleshoot/cmd/collect
.PHONY: fmt
fmt:
go fmt ./pkg/... ./cmd/...
go fmt ${BUILDPATHS}
.PHONY: vet
vet:
go vet ${BUILDFLAGS} ./pkg/... ./cmd/...
go vet ${BUILDFLAGS} ${BUILDPATHS}
.PHONY: generate
generate: controller-gen client-gen
@@ -91,19 +130,31 @@ openapischema: controller-gen
controller-gen crd +output:dir=./config/crds paths=./pkg/apis/troubleshoot/v1beta1
controller-gen crd +output:dir=./config/crds paths=./pkg/apis/troubleshoot/v1beta2
check-schemas: generate schemas
@if [ -n "$(shell git status --short)" ]; then \
echo -e "\033[31mThe git repo is dirty :( Ensure all generated files are committed e.g CRD schema files\033[0;m"; \
git status --short; \
exit 1; \
fi
.PHONY: schemas
schemas: fmt vet openapischema
go build ${LDFLAGS} -o bin/schemagen github.com/replicatedhq/troubleshoot/cmd/schemagen
./bin/schemagen --output-dir ./schemas
.PHONY: docs
docs: fmt vet
go build ${LDFLAGS} -o bin/docsgen github.com/replicatedhq/troubleshoot/cmd/docsgen
./bin/docsgen
controller-gen:
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.11.2
CONTROLLER_GEN=$(shell which controller-gen)
.PHONY: client-gen
client-gen:
ifeq (, $(shell which client-gen))
go install k8s.io/code-generator/cmd/client-gen@v0.22.2
ifeq (, $(shell which client-gen 2>/dev/null))
go install k8s.io/code-generator/cmd/client-gen@v0.28.2
CLIENT_GEN=$(shell go env GOPATH)/bin/client-gen
else
CLIENT_GEN=$(shell which client-gen)
@@ -155,7 +206,7 @@ generate-sbom: install-spdx-sbom-generator
$(SPDX_GENERATOR) -o ./sbom/spdx
sbom/assets/troubleshoot-sbom.tgz: generate-sbom
tar -czf sbom/assets/troubleshoot-sbom.tgz sbom/spdx/*.spdx
tar -czf sbom/assets/troubleshoot-sbom.tgz sbom/spdx/*.spdx
sbom: sbom/assets/troubleshoot-sbom.tgz
cosign sign-blob -key cosign.key sbom/assets/troubleshoot-sbom.tgz > sbom/assets/troubleshoot-sbom.tgz.sig
@@ -178,8 +229,30 @@ longhorn:
.PHONY: scan
scan:
trivy fs \
--security-checks vuln \
--scanners vuln \
--exit-code=1 \
--severity="HIGH,CRITICAL" \
--ignore-unfixed \
./
./
.PHONY: lint
lint: fmt vet
golangci-lint run --new -c .golangci.yaml ${BUILDPATHS}
.PHONY: lint-and-fix
lint-and-fix: fmt vet
golangci-lint run --new --fix -c .golangci.yaml ${BUILDPATHS}
.PHONY: watch
watch: npm-install
bin/watch.js
## Syncronize the code with a remote server. More info: CONTRIBUTING.md
.PHONY: watchrsync
watchrsync: npm-install
bin/watchrsync.js
.PHONY: npm-install
npm-install:
npm --version 2>&1 >/dev/null || ( echo "npm not installed; install npm to set up watchrsync" && exit 1 )
npm list gaze-run-interrupt || npm install install --no-save gaze-run-interrupt@~2.0.0
+35 -17
View File
@@ -1,25 +1,27 @@
# Replicated Troubleshoot
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B5995%2Fgithub.com%2Freplicatedhq%2Ftroubleshoot.svg?type=small)](https://app.fossa.com/projects/custom%2B5995%2Fgithub.com%2Freplicatedhq%2Ftroubleshoot?ref=badge_small)
Replicated Troubleshoot is a framework for collecting, redacting, and analyzing highly customizable diagnostic information about a Kubernetes cluster. Troubleshoot specs are created by 3rd-party application developers/maintainers and run by cluster operators in the initial and ongoing operation of those applications.
Troubleshoot provides two CLI tools as kubectl plugins (using [Krew](https://krew.dev)): `kubectl preflight` and `kubectl support-bundle`. Preflight provides pre-installation cluster conformance testing and validation (preflight checks) and support-bundle provides post-installation troubleshooting and diagnostics (support bundles).
To know more about troubleshoot, please visit: https://troubleshoot.sh/
## Preflight Checks
Preflight checks are an easy-to-run set of conformance tests that can be written to verify that specific requirements in a cluster are met.
To run a sample preflight check from a sample application, install the preflight kubectl plugin:
```shell
```
curl https://krew.sh/preflight | bash
```
and run:
```shell
and run, where https://preflight.replicated.com provides an **example** preflight spec:
```
kubectl preflight https://preflight.replicated.com
```
**NOTE** this is an example. Do **not** use to validate real scenarios.
For more details on creating the custom resource files that drive preflight checks, visit [creating preflight checks](https://troubleshoot.sh/docs/preflight/introduction/).
@@ -28,29 +30,45 @@ A support bundle is an archive that's created in-cluster, by collecting logs and
To collect a sample support bundle, install the troubleshoot kubectl plugin:
```shell
```
curl https://krew.sh/support-bundle | bash
```
and run:
```shell
and run, where https://support-bundle.replicated.com provides an **example** support bundle spec:
```
kubectl support-bundle https://support-bundle.replicated.com
```
**NOTE** this is an example. Do **not** use to validate real scenarios.
For more details on creating the custom resource files that drive support-bundle collection, visit [creating collectors](https://troubleshoot.sh/docs/collect/) and [creating analyzers](https://troubleshoot.sh/docs/analyze/).
And see our other tool [sbctl](https://github.com/replicatedhq/sbctl) that makes it easier to interact with support bundles using `kubectl` commands you already know
# Community
For questions about using Troubleshoot, there's a [Replicated Community](https://help.replicated.com/community) forum, and a [#app-troubleshoot channel in Kubernetes Slack](https://kubernetes.slack.com/channels/app-troubleshoot).
For questions about using Troubleshoot, how to contribute and engaging with the project in any other way, please refer to the following resources and channels.
# Software Bill of Materials
A signed SBOM that includes Troubleshoot dependencies is included in each release.
- **troubleshoot-sbom.tgz** contains a software bill of materials for Troubleshoot.
- [Replicated Community](https://help.replicated.com/community) forum
- [#app-troubleshoot channel in Kubernetes Slack](https://kubernetes.slack.com/channels/app-troubleshoot)
- [#Community meetings calendar](https://calendar.google.com/calendar/u/0?cid=Y19mMGx1aGhiZGtscGllOGo5dWpicXMwNnN1a0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t). This happen monthly but dates may change and would be kept upto date in the calendar.
# Software Bill of Materials
A signed SBOM that includes Troubleshoot dependencies is included in each release.
- **troubleshoot-sbom.tgz** contains a software bill of materials for Troubleshoot.
- **troubleshoot-sbom.tgz.sig** is the digital signature for troubleshoot-sbom.tgz
- **key.pub** is the public key from the key pair used to sign troubleshoot-sbom.tgz
The following example illustrates using [cosign](https://github.com/sigstore/cosign) to verify that **troubleshoot-sbom.tgz** has
not been tampered with.
```shell
$ cosign verify-blob -key key.pub -signature troubleshoot-sbom.tgz.sig troubleshoot-sbom.tgz
```sh
$ cosign verify-blob --key key.pub --signature troubleshoot-sbom.tgz.sig troubleshoot-sbom.tgz
Verified OK
```
```
If you were to get an error similar to the one below, it means you are verifying an SBOM signed using cosign `v1` using a newer `v2` of the binary. This version introduced [breaking changes](https://github.com/sigstore/cosign/blob/main/CHANGELOG.md#breaking-changes) which require an additional flag `--insecure-ignore-tlog=true` to successfully verify SBOMs like so.
```sh
$ cosign verify-blob --key key.pub --signature troubleshoot-sbom.tgz.sig troubleshoot-sbom.tgz --insecure-ignore-tlog=true
WARNING: Skipping tlog verification is an insecure practice that lacks of transparency and auditability verification for the blob.
Verified OK
```
Executable
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env node
const gri = require('gaze-run-interrupt');
const commands = [
// {
// command: 'rm',
// args: binList,
// },
{
command: 'make',
args: ['build'],
},
];
commands.push({
command: "date",
args: [],
});
commands.push({
command: "echo",
args: ["synced"],
});
gri([
'cmd/**/*.go',
'pkg/**/*.go',
], commands);
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env node
const gri = require('gaze-run-interrupt');
if (!process.env.REMOTES) {
console.log("Usage: `REMOTES='user@h1.1.1.1,user@1.1.1.2' ./watchrsync.js`");
process.exit(1);
}
process.env.GOOS = 'linux';
process.env.GOARCH = 'amd64';
const binList = [
// 'bin/analyze',
// 'bin/preflight',
'bin/support-bundle',
// 'bin/collect'
]
const commands = [
// {
// command: 'rm',
// args: binList,
// },
{
command: 'make',
args: ['build'],
},
];
process.env.REMOTES.split(",").forEach(function (remote) {
commands.push({
command: 'rsync',
args: binList.concat(`${remote}:`),
});
});
commands.push({
command: "date",
args: [],
});
commands.push({
command: "echo",
args: ["synced"],
});
gri([
'cmd/**/*.go',
'pkg/**/*.go',
], commands);
+18 -5
View File
@@ -4,7 +4,7 @@ import (
"os"
"strings"
"github.com/go-logr/logr"
"github.com/replicatedhq/troubleshoot/cmd/internal/util"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
"github.com/replicatedhq/troubleshoot/pkg/logger"
"github.com/spf13/cobra"
@@ -23,21 +23,28 @@ func RootCmd() *cobra.Command {
v := viper.GetViper()
v.BindPFlags(cmd.Flags())
if !v.GetBool("debug") {
klog.SetLogger(logr.Discard())
logger.SetupLogger(v)
if err := util.StartProfiling(); err != nil {
klog.Errorf("Failed to start profiling: %v", err)
}
},
RunE: func(cmd *cobra.Command, args []string) error {
v := viper.GetViper()
logger.SetQuiet(v.GetBool("quiet"))
return runAnalyzers(v, args[0])
},
PostRun: func(cmd *cobra.Command, args []string) {
if err := util.StopProfiling(); err != nil {
klog.Errorf("Failed to stop profiling: %v", err)
}
},
}
cobra.OnInitialize(initConfig)
cmd.AddCommand(util.VersionCmd())
cmd.Flags().String("analyzers", "", "filename or url of the analyzers to use")
cmd.Flags().Bool("debug", false, "enable debug logging")
@@ -45,8 +52,14 @@ func RootCmd() *cobra.Command {
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
// Initialize klog flags
logger.InitKlogFlags(cmd)
k8sutil.AddFlags(cmd.Flags())
// CPU and memory profiling flags
util.AddProfilingFlags(cmd)
return cmd
}
+3 -2
View File
@@ -7,7 +7,7 @@ import (
"os"
"github.com/pkg/errors"
"github.com/replicatedhq/troubleshoot/cmd/util"
"github.com/replicatedhq/troubleshoot/internal/util"
analyzer "github.com/replicatedhq/troubleshoot/pkg/analyze"
"github.com/spf13/viper"
)
@@ -18,7 +18,7 @@ func runAnalyzers(v *viper.Viper, bundlePath string) error {
specContent := ""
var err error
if _, err = os.Stat(specPath); err == nil {
b, err := ioutil.ReadFile(specPath)
b, err := os.ReadFile(specPath)
if err != nil {
return err
}
@@ -26,6 +26,7 @@ func runAnalyzers(v *viper.Viper, bundlePath string) error {
specContent = string(b)
} else {
if !util.IsURL(specPath) {
// TODO: Better error message when we do not have a file/url etc
return fmt.Errorf("%s is not a URL and was not found (err %s)", specPath, err)
}
+17 -5
View File
@@ -4,7 +4,7 @@ import (
"os"
"strings"
"github.com/go-logr/logr"
"github.com/replicatedhq/troubleshoot/cmd/internal/util"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
"github.com/replicatedhq/troubleshoot/pkg/logger"
"github.com/spf13/cobra"
@@ -23,21 +23,27 @@ func RootCmd() *cobra.Command {
v := viper.GetViper()
v.BindPFlags(cmd.Flags())
if !v.GetBool("debug") {
klog.SetLogger(logr.Discard())
logger.SetupLogger(v)
if err := util.StartProfiling(); err != nil {
klog.Errorf("Failed to start profiling: %v", err)
}
},
RunE: func(cmd *cobra.Command, args []string) error {
v := viper.GetViper()
logger.SetQuiet(v.GetBool("quiet"))
return runCollect(v, args[0])
},
PostRun: func(cmd *cobra.Command, args []string) {
if err := util.StopProfiling(); err != nil {
klog.Errorf("Failed to stop profiling: %v", err)
}
},
}
cobra.OnInitialize(initConfig)
cmd.AddCommand(VersionCmd())
cmd.AddCommand(util.VersionCmd())
cmd.Flags().StringSlice("redactors", []string{}, "names of the additional redactors to use")
cmd.Flags().Bool("redact", true, "enable/disable default redactions")
@@ -58,6 +64,12 @@ func RootCmd() *cobra.Command {
k8sutil.AddFlags(cmd.Flags())
// Initialize klog flags
logger.InitKlogFlags(cmd)
// CPU and memory profiling flags
util.AddProfilingFlags(cmd)
return cmd
}
+10 -13
View File
@@ -10,10 +10,9 @@ import (
"time"
"github.com/pkg/errors"
"github.com/replicatedhq/troubleshoot/cmd/util"
"github.com/replicatedhq/troubleshoot/internal/util"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
troubleshootclientsetscheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
"github.com/replicatedhq/troubleshoot/pkg/collect"
"github.com/replicatedhq/troubleshoot/pkg/docrewrite"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
@@ -51,7 +50,7 @@ func runCollect(v *viper.Viper, arg string) error {
collectorContent = spec
} else if _, err = os.Stat(arg); err == nil {
b, err := ioutil.ReadFile(arg)
b, err := os.ReadFile(arg)
if err != nil {
return err
}
@@ -88,19 +87,17 @@ func runCollect(v *viper.Viper, arg string) error {
multidocs := strings.Split(string(collectorContent), "\n---\n")
troubleshootclientsetscheme.AddToScheme(scheme.Scheme)
decode := scheme.Codecs.UniversalDeserializer().Decode
additionalRedactors := &troubleshootv1beta2.Redactor{}
for idx, redactor := range v.GetStringSlice("redactors") {
redactorObj, err := supportbundle.GetRedactorFromURI(redactor)
if err != nil {
return errors.Wrapf(err, "failed to get redactor spec %s, #%d", redactor, idx)
}
redactors, err := supportbundle.GetRedactorsFromURIs(v.GetStringSlice("redactors"))
if err != nil {
return errors.Wrap(err, "failed to get redactors")
}
if redactorObj != nil {
additionalRedactors.Spec.Redactors = append(additionalRedactors.Spec.Redactors, redactorObj.Spec.Redactors...)
}
additionalRedactors := &troubleshootv1beta2.Redactor{
Spec: troubleshootv1beta2.RedactorSpec{
Redactors: redactors,
},
}
for i, additionalDoc := range multidocs {
-22
View File
@@ -1,22 +0,0 @@
package cli
import (
"fmt"
"github.com/replicatedhq/troubleshoot/pkg/version"
"github.com/spf13/cobra"
)
func VersionCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print the current version and exit",
Long: `Print the current version and exit`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Printf("Replicated Collect %s\n", version.Version())
return nil
},
}
return cmd
}
+37
View File
@@ -0,0 +1,37 @@
package cli
import (
"log"
"os"
preflightcli "github.com/replicatedhq/troubleshoot/cmd/preflight/cli"
troubleshootcli "github.com/replicatedhq/troubleshoot/cmd/troubleshoot/cli"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
)
func RootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "docsgen",
Short: "Generate markdown docs for the commands in this project",
}
preflight := preflightcli.RootCmd()
troubleshoot := troubleshootcli.RootCmd()
commands := []*cobra.Command{preflight, troubleshoot}
for _, command := range commands {
err := doc.GenMarkdownTree(command, "./docs")
if err != nil {
log.Fatal(err)
}
}
return cmd
}
func InitAndExecute() {
if err := RootCmd().Execute(); err != nil {
os.Exit(1)
}
}
+10
View File
@@ -0,0 +1,10 @@
package main
import (
"github.com/replicatedhq/troubleshoot/cmd/docsgen/cli"
_ "k8s.io/client-go/plugin/pkg/client/auth"
)
func main() {
cli.InitAndExecute()
}
+83
View File
@@ -0,0 +1,83 @@
package util
import (
"fmt"
"os"
"runtime"
"runtime/pprof"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var (
cpuProfileFile *os.File
)
// StartProfiling starts profiling CPU and memory usage if either --cpuprofile or
// --memprofile flags were set and bound to viper configurations respectively.
func StartProfiling() error {
v := viper.GetViper()
if v.GetString("cpuprofile") != "" {
var err error
cpuProfileFile, err = os.Create(v.GetString("cpuprofile"))
if err != nil {
return fmt.Errorf("could not create CPU profile: %w", err)
}
if err := pprof.StartCPUProfile(cpuProfileFile); err != nil {
cpuProfileFile.Close()
cpuProfileFile = nil
return fmt.Errorf("could not start CPU profile: %w", err)
}
}
return nil
}
// StopProfiling stops profiling CPU and memory usage and writes the results to
// the files specified by --cpuprofile and --memprofile flags respectively.
func StopProfiling() error {
v := viper.GetViper()
errs := []string{}
// Stop CPU profiling if it was started
if cpuProfileFile != nil {
pprof.StopCPUProfile()
err := cpuProfileFile.Close()
if err != nil {
errs = append(errs, err.Error())
}
cpuProfileFile = nil
}
if v.GetString("memprofile") != "" {
f, err := os.Create(v.GetString("memprofile"))
if err != nil {
errs = append(errs, err.Error())
goto BREAK_FROM_MEMPROFILE_IF
}
runtime.GC() // get up-to-date statistics
if err := pprof.WriteHeapProfile(f); err != nil {
errs = append(errs, err.Error())
goto BREAK_FROM_MEMPROFILE_IF
}
err = f.Close()
if err != nil {
errs = append(errs, err.Error())
}
}
BREAK_FROM_MEMPROFILE_IF:
if len(errs) > 0 {
return fmt.Errorf("errors while stopping profiling: [%s]", strings.Join(errs, ", "))
}
return nil
}
// AddProfilingFlags adds the --cpuprofile and --memprofile flags to the given command.
func AddProfilingFlags(cmd *cobra.Command) {
// Persistent flags to make available to subcommands
cmd.PersistentFlags().String("cpuprofile", "", "File path to write cpu profiling data")
cmd.PersistentFlags().String("memprofile", "", "File path to write memory profiling data")
}
@@ -1,11 +1,10 @@
package cli
package util
import (
"fmt"
"github.com/spf13/cobra"
"github.com/replicatedhq/troubleshoot/pkg/version"
"github.com/spf13/cobra"
)
func VersionCmd() *cobra.Command {
@@ -14,7 +13,7 @@ func VersionCmd() *cobra.Command {
Short: "Print the current version and exit",
Long: `Print the current version and exit`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Printf("Replicated Preflight %s\n", version.Version())
fmt.Printf("Replicated Troubleshoot %s\n", version.Version())
return nil
},
+40
View File
@@ -0,0 +1,40 @@
package cli
import (
"fmt"
"strings"
"github.com/replicatedhq/troubleshoot/pkg/logger"
"github.com/replicatedhq/troubleshoot/pkg/oci"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
func OciFetchCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "oci-fetch [URI]",
Args: cobra.MinimumNArgs(1),
Short: "Fetch a preflight from an OCI registry and print it to standard out",
PreRun: func(cmd *cobra.Command, args []string) {
v := viper.GetViper()
v.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
v.BindPFlags(cmd.Flags())
logger.SetupLogger(v)
},
RunE: func(cmd *cobra.Command, args []string) error {
uri := args[0]
data, err := oci.PullPreflightFromOCI(uri)
if err != nil {
return err
}
fmt.Println(string(data))
return nil
},
}
// Initialize klog flags
logger.InitKlogFlags(cmd)
return cmd
}
+64 -19
View File
@@ -1,11 +1,18 @@
package cli
import (
"errors"
"fmt"
"os"
"strings"
"github.com/go-logr/logr"
"github.com/replicatedhq/troubleshoot/cmd/internal/util"
"github.com/replicatedhq/troubleshoot/internal/traces"
"github.com/replicatedhq/troubleshoot/pkg/constants"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
"github.com/replicatedhq/troubleshoot/pkg/logger"
"github.com/replicatedhq/troubleshoot/pkg/preflight"
"github.com/replicatedhq/troubleshoot/pkg/types"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/klog/v2"
@@ -18,45 +25,83 @@ func RootCmd() *cobra.Command {
Short: "Run and retrieve preflight checks in a cluster",
Long: `A preflight check is a set of validations that can and should be run to ensure
that a cluster meets the requirements to run an application.`,
SilenceUsage: true,
SilenceUsage: true,
SilenceErrors: true,
PreRun: func(cmd *cobra.Command, args []string) {
v := viper.GetViper()
v.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
v.BindPFlags(cmd.Flags())
if !v.GetBool("debug") {
klog.SetLogger(logr.Discard())
logger.SetupLogger(v)
if err := util.StartProfiling(); err != nil {
klog.Errorf("Failed to start profiling: %v", err)
}
},
RunE: func(cmd *cobra.Command, args []string) error {
v := viper.GetViper()
return runPreflights(v, args[0])
closer, err := traces.ConfigureTracing("preflight")
if err != nil {
// Do not fail running preflights if tracing fails
klog.Errorf("Failed to initialize open tracing provider: %v", err)
} else {
defer closer()
}
err = preflight.RunPreflights(v.GetBool("interactive"), v.GetString("output"), v.GetString("format"), args)
if !v.GetBool("dry-run") && (v.GetBool("debug") || v.IsSet("v")) {
fmt.Printf("\n%s", traces.GetExporterInstance().GetSummary())
}
return err
},
PostRun: func(cmd *cobra.Command, args []string) {
if err := util.StopProfiling(); err != nil {
klog.Errorf("Failed to stop profiling: %v", err)
}
},
}
cobra.OnInitialize(initConfig)
cmd.AddCommand(VersionCmd())
cmd.AddCommand(util.VersionCmd())
cmd.AddCommand(OciFetchCmd())
preflight.AddFlags(cmd.PersistentFlags())
cmd.Flags().Bool("interactive", true, "interactive preflights")
cmd.Flags().String("format", "human", "output format, one of human, json, yaml. only used when interactive is set to false")
cmd.Flags().String("collector-image", "", "the full name of the collector image to use")
cmd.Flags().String("collector-pullpolicy", "", "the pull policy of the collector image")
cmd.Flags().Bool("collect-without-permissions", true, "always run preflight checks even if some require permissions that preflight does not have")
cmd.Flags().String("selector", "", "selector (label query) to filter remote collection nodes on.")
cmd.Flags().String("since-time", "", "force pod logs collectors to return logs after a specific date (RFC3339)")
cmd.Flags().String("since", "", "force pod logs collectors to return logs newer than a relative duration like 5s, 2m, or 3h.")
cmd.Flags().StringP("output", "o", "", "specify the output file path for the preflight checks")
cmd.Flags().Bool("debug", false, "enable debug logging")
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
// Dry run flag should be in cmd.PersistentFlags() flags made available to all subcommands
// Adding here to avoid that
cmd.Flags().Bool("dry-run", false, "print the preflight spec without running preflight checks")
k8sutil.AddFlags(cmd.Flags())
// Initialize klog flags
logger.InitKlogFlags(cmd)
// CPU and memory profiling flags
util.AddProfilingFlags(cmd)
return cmd
}
func InitAndExecute() {
if err := RootCmd().Execute(); err != nil {
cmd := RootCmd()
err := cmd.Execute()
if err != nil {
var exitErr types.ExitError
if errors.As(err, &exitErr) {
// We need to do this, there's situations where we need the non-zero exit code (which comes as part of the custom error struct)
// but there's no actual error, just an exit code.
// If there's also an error to output (eg. invalid format etc) then print it as well
if exitErr.ExitStatus() != constants.EXIT_CODE_FAIL && exitErr.ExitStatus() != constants.EXIT_CODE_WARN {
cmd.PrintErrln("Error:", err.Error())
}
os.Exit(exitErr.ExitStatus())
}
// Fallback, should almost never be used (the above Exit() should handle almost all situations
cmd.PrintErrln("Error:", err.Error())
os.Exit(1)
}
}
-109
View File
@@ -1,109 +0,0 @@
package cli
import (
"encoding/json"
"fmt"
"github.com/pkg/errors"
analyzerunner "github.com/replicatedhq/troubleshoot/pkg/analyze"
)
func showStdoutResults(format string, preflightName string, analyzeResults []*analyzerunner.AnalyzeResult) error {
if format == "human" {
return showStdoutResultsHuman(preflightName, analyzeResults)
} else if format == "json" {
return showStdoutResultsJSON(preflightName, analyzeResults)
}
return errors.Errorf("unknown output format: %q", format)
}
func showStdoutResultsHuman(preflightName string, analyzeResults []*analyzerunner.AnalyzeResult) error {
fmt.Println("")
var failed bool
for _, analyzeResult := range analyzeResults {
testResultfailed := outputResult(analyzeResult)
if testResultfailed {
failed = true
}
}
if failed {
fmt.Printf("--- FAIL %s\n", preflightName)
fmt.Println("FAILED")
} else {
fmt.Printf("--- PASS %s\n", preflightName)
fmt.Println("PASS")
}
return nil
}
func showStdoutResultsJSON(preflightName string, analyzeResults []*analyzerunner.AnalyzeResult) error {
type ResultOutput struct {
Title string `json:"title"`
Message string `json:"message"`
URI string `json:"uri,omitempty"`
Strict bool `json:"strict,omitempty"`
}
type Output struct {
Pass []ResultOutput `json:"pass,omitempty"`
Warn []ResultOutput `json:"warn,omitempty"`
Fail []ResultOutput `json:"fail,omitempty"`
}
output := Output{
Pass: []ResultOutput{},
Warn: []ResultOutput{},
Fail: []ResultOutput{},
}
for _, analyzeResult := range analyzeResults {
resultOutput := ResultOutput{
Title: analyzeResult.Title,
Message: analyzeResult.Message,
URI: analyzeResult.URI,
}
if analyzeResult.Strict {
resultOutput.Strict = analyzeResult.Strict
}
if analyzeResult.IsPass {
output.Pass = append(output.Pass, resultOutput)
} else if analyzeResult.IsWarn {
output.Warn = append(output.Warn, resultOutput)
} else if analyzeResult.IsFail {
output.Fail = append(output.Fail, resultOutput)
}
}
b, err := json.MarshalIndent(output, "", " ")
if err != nil {
return errors.Wrap(err, "failed to marshal results")
}
fmt.Printf("%s\n", b)
return nil
}
func outputResult(analyzeResult *analyzerunner.AnalyzeResult) bool {
if analyzeResult.IsPass {
fmt.Printf(" --- PASS %s\n", analyzeResult.Title)
fmt.Printf(" --- %s\n", analyzeResult.Message)
} else if analyzeResult.IsWarn {
fmt.Printf(" --- WARN: %s\n", analyzeResult.Title)
fmt.Printf(" --- %s\n", analyzeResult.Message)
} else if analyzeResult.IsFail {
fmt.Printf(" --- FAIL: %s\n", analyzeResult.Title)
fmt.Printf(" --- %s\n", analyzeResult.Message)
}
if analyzeResult.Strict {
fmt.Printf(" --- Strict: %t\n", analyzeResult.Strict)
}
if analyzeResult.IsFail {
return true
}
return false
}
+2 -9
View File
@@ -7,10 +7,9 @@ import (
"net/http"
"os"
"github.com/replicatedhq/troubleshoot/cmd/util"
"github.com/replicatedhq/troubleshoot/internal/util"
analyzer "github.com/replicatedhq/troubleshoot/pkg/analyze"
"github.com/replicatedhq/troubleshoot/pkg/convert"
"github.com/replicatedhq/troubleshoot/pkg/logger"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"gopkg.in/yaml.v2"
@@ -23,15 +22,11 @@ func Analyze() *cobra.Command {
Short: "analyze a support bundle",
Long: `Analyze a support bundle using the Analyzer definitions provided`,
PreRun: func(cmd *cobra.Command, args []string) {
viper.BindPFlag("bundle", cmd.Flags().Lookup("bundle"))
viper.BindPFlag("output", cmd.Flags().Lookup("output"))
viper.BindPFlag("quiet", cmd.Flags().Lookup("quiet"))
viper.BindPFlags(cmd.Flags())
},
RunE: func(cmd *cobra.Command, args []string) error {
v := viper.GetViper()
logger.SetQuiet(v.GetBool("quiet"))
specPath := args[0]
analyzerSpec, err := downloadAnalyzerSpec(specPath)
if err != nil {
@@ -77,8 +72,6 @@ func Analyze() *cobra.Command {
cmd.Flags().MarkHidden("compatibility")
cmd.Flags().Bool("quiet", false, "enable/disable error messaging and only show parseable output")
viper.BindPFlags(cmd.Flags())
return cmd
}
+19 -21
View File
@@ -7,11 +7,13 @@ import (
"path"
"time"
"github.com/mitchellh/go-wordwrap"
"github.com/pkg/errors"
ui "github.com/replicatedhq/termui/v3"
"github.com/replicatedhq/termui/v3/widgets"
"github.com/replicatedhq/troubleshoot/cmd/util"
"github.com/replicatedhq/troubleshoot/internal/util"
analyzerunner "github.com/replicatedhq/troubleshoot/pkg/analyze"
"github.com/replicatedhq/troubleshoot/pkg/constants"
)
var (
@@ -178,7 +180,10 @@ func drawDetails(analysisResult *analyzerunner.AnalyzeResult) {
currentTop := 4
title := widgets.NewParagraph()
title.Text = analysisResult.Title
// WrapText is set to false to prevent internal wordwrap which is not accounting for the padding
title.WrapText = false
// For long title that lead to wrapping text, the terminal width is divided by 2 and deducted by MESSAGE_TEXT_PADDING to account for the padding
title.Text = wordwrap.WrapString(analysisResult.Title, uint(termWidth/2-constants.MESSAGE_TEXT_PADDING))
title.Border = false
if analysisResult.IsPass {
title.TextStyle = ui.NewStyle(ui.ColorGreen, ui.ColorClear, ui.ModifierBold)
@@ -187,33 +192,26 @@ func drawDetails(analysisResult *analyzerunner.AnalyzeResult) {
} else if analysisResult.IsFail {
title.TextStyle = ui.NewStyle(ui.ColorRed, ui.ColorClear, ui.ModifierBold)
}
height := estimateNumberOfLines(title.Text, termWidth/2)
height := util.EstimateNumberOfLines(title.Text)
title.SetRect(termWidth/2, currentTop, termWidth, currentTop+height)
ui.Render(title)
currentTop = currentTop + height + 1
message := widgets.NewParagraph()
message.Text = analysisResult.Message
// WrapText is set to false to prevent internal wordwrap which is not accounting for the padding
message.WrapText = false
// For long text that lead to wrapping text, the terminal width is divided by 2 and deducted by MESSAGE_TEXT_PADDING to account for the padding
message.Text = wordwrap.WrapString(analysisResult.Message, uint(termWidth/2-constants.MESSAGE_TEXT_PADDING))
if analysisResult.URI != "" {
// Add URL to the message with wordwrap
// Add emply lines as separator
urlText := wordwrap.WrapString(fmt.Sprintf("For more information: %s", analysisResult.URI), uint(termWidth/2-constants.MESSAGE_TEXT_PADDING))
message.Text = message.Text + "\n\n" + urlText
}
height = util.EstimateNumberOfLines(message.Text) + constants.MESSAGE_TEXT_LINES_MARGIN_TO_BOTTOM
message.Border = false
height = estimateNumberOfLines(message.Text, termWidth/2) + 2
message.SetRect(termWidth/2, currentTop, termWidth, currentTop+height)
ui.Render(message)
currentTop = currentTop + height + 1
if analysisResult.URI != "" {
uri := widgets.NewParagraph()
uri.Text = fmt.Sprintf("For more information: %s", analysisResult.URI)
uri.Border = false
height = estimateNumberOfLines(uri.Text, termWidth/2)
uri.SetRect(termWidth/2, currentTop, termWidth, currentTop+height)
ui.Render(uri)
currentTop = currentTop + height + 1
}
}
func estimateNumberOfLines(text string, width int) int {
lines := len(text)/width + 1
return lines
}
func showSaved(filename string) {
+82
View File
@@ -0,0 +1,82 @@
package cli
import (
"fmt"
"os"
"time"
"github.com/pkg/errors"
analyzer "github.com/replicatedhq/troubleshoot/pkg/analyze"
"github.com/replicatedhq/troubleshoot/pkg/collect"
"github.com/replicatedhq/troubleshoot/pkg/supportbundle"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
func Redact() *cobra.Command {
cmd := &cobra.Command{
Use: "redact [urls...]",
Args: cobra.MinimumNArgs(1), // TODO
Short: "Redact information from a generated support bundle archive",
Long: `Redaction is the process of masking sensitive information from collected data in a support bundle.
This is done using rules defined in the list of redactor manifests provided in the [urls...] command line
argument. Default built in redactors will also be run, but these would have been run when the support
bundle was generated. After redaction, the support bundle is archived once more. The resulting file will
be stored in the current directory in the path provided by the --output flag.
The [urls...] argument is a list of either oci://.., http://.., https://.. or local paths to yaml files.
For more information on redactors visit https://troubleshoot.sh/docs/redact/
`,
PreRunE: func(cmd *cobra.Command, args []string) error {
return viper.BindPFlags(cmd.Flags())
},
RunE: func(cmd *cobra.Command, args []string) error {
v := viper.GetViper()
// 1. Decode redactors from provided URLs
redactors, err := supportbundle.GetRedactorsFromURIs(args)
if err != nil {
return err
}
// 2. Download the bundle and extract it
tmpDir, bundleDir, err := analyzer.DownloadAndExtractSupportBundle(v.GetString("bundle"))
if err != nil {
return err
}
defer os.RemoveAll(tmpDir)
// 3. Represent bundle as a CollectorResult
collectorResult, err := collect.CollectorResultFromBundle(bundleDir)
if err != nil {
return err
}
// 4. Perform redaction on the bundle
err = collect.RedactResult(bundleDir, collectorResult, redactors)
if err != nil {
return errors.Wrap(err, "failed to redact support bundle")
}
// 5. Compress the bundle once more after redacting
output := v.GetString("output")
if output == "" {
output = fmt.Sprintf("redacted-support-bundle-%s.tar.gz", time.Now().Format("2006-01-02T15_04_05"))
}
err = collectorResult.ArchiveSupportBundle(bundleDir, output)
if err != nil {
return errors.Wrap(err, "failed to create support bundle archive")
}
fmt.Println("Redacted support bundle:", output)
return nil
},
}
cmd.Flags().String("bundle", "", "file path of the support bundle archive to redact")
cmd.MarkFlagRequired("bundle")
cmd.Flags().BoolP("quiet", "q", false, "enable/disable error messaging and only show parseable output")
cmd.Flags().StringP("output", "o", "", "file path of where to save the redacted support bundle archive (default \"redacted-support-bundle-YYYY-MM-DDTHH_MM_SS.tar.gz\")")
return cmd
}
+44 -37
View File
@@ -1,12 +1,12 @@
package cli
import (
"io/ioutil"
"fmt"
"os"
"strings"
"github.com/go-logr/logr"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/replicatedhq/troubleshoot/cmd/internal/util"
"github.com/replicatedhq/troubleshoot/internal/traces"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
"github.com/replicatedhq/troubleshoot/pkg/logger"
"github.com/spf13/cobra"
@@ -16,54 +16,82 @@ import (
func RootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "support-bundle [url]",
Use: "support-bundle [urls...]",
Args: cobra.MinimumNArgs(0),
Short: "Generate a support bundle",
Long: `A support bundle is an archive of files, output, metrics and state
from a server that can be used to assist when troubleshooting a Kubernetes cluster.`,
SilenceUsage: true,
PreRun: func(cmd *cobra.Command, args []string) {
PersistentPreRun: func(cmd *cobra.Command, args []string) {
v := viper.GetViper()
v.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
v.BindPFlags(cmd.Flags())
if !v.GetBool("debug") {
klog.SetLogger(logr.Discard())
logger.SetupLogger(v)
if err := util.StartProfiling(); err != nil {
klog.Errorf("Failed to start profiling: %v", err)
}
},
RunE: func(cmd *cobra.Command, args []string) error {
v := viper.GetViper()
logger.SetQuiet(v.GetBool("quiet"))
return runTroubleshoot(v, args)
closer, err := traces.ConfigureTracing("support-bundle")
if err != nil {
// Do not fail running support-bundle if tracing fails
klog.Errorf("Failed to initialize open tracing provider: %v", err)
} else {
defer closer()
}
err = runTroubleshoot(v, args)
if !v.IsSet("dry-run") && (v.GetBool("debug") || v.IsSet("v")) {
fmt.Printf("\n%s", traces.GetExporterInstance().GetSummary())
}
return err
},
PersistentPostRun: func(cmd *cobra.Command, args []string) {
if err := util.StopProfiling(); err != nil {
klog.Errorf("Failed to stop profiling: %v", err)
}
},
}
cobra.OnInitialize(initConfig)
cmd.AddCommand(Analyze())
cmd.AddCommand(VersionCmd())
cmd.AddCommand(Redact())
cmd.AddCommand(util.VersionCmd())
cmd.Flags().StringSlice("redactors", []string{}, "names of the additional redactors to use")
cmd.Flags().Bool("redact", true, "enable/disable default redactions")
cmd.Flags().Bool("interactive", true, "enable/disable interactive mode")
cmd.Flags().Bool("collect-without-permissions", true, "always generate a support bundle, even if it some require additional permissions")
cmd.Flags().StringSliceP("selector", "l", []string{"troubleshoot.io/kind=supportbundle-spec"}, "selector to filter on for loading additional support bundle specs found in secrets within the cluster")
cmd.Flags().Bool("load-cluster-specs", false, "enable/disable loading additional support bundle specs found in secrets within the cluster. required when no specs are provided on the command line")
cmd.Flags().StringSliceP("selector", "l", []string{"troubleshoot.sh/kind=support-bundle"}, "selector to filter on for loading additional support bundle specs found in secrets within the cluster")
cmd.Flags().Bool("load-cluster-specs", false, "enable/disable loading additional troubleshoot specs found within the cluster. required when no specs are provided on the command line")
cmd.Flags().String("since-time", "", "force pod logs collectors to return logs after a specific date (RFC3339)")
cmd.Flags().String("since", "", "force pod logs collectors to return logs newer than a relative duration like 5s, 2m, or 3h.")
cmd.Flags().StringP("output", "o", "", "specify the output file path for the support bundle")
cmd.Flags().Bool("debug", false, "enable debug logging")
cmd.Flags().Bool("debug", false, "enable debug logging. This is equivalent to --v=0")
cmd.Flags().Bool("dry-run", false, "print support bundle spec without collecting anything")
// hidden in favor of the `insecure-skip-tls-verify` flag
cmd.Flags().Bool("allow-insecure-connections", false, "when set, do not verify TLS certs when retrieving spec and reporting results")
cmd.Flags().MarkHidden("allow-insecure-connections")
viper.BindPFlags(cmd.Flags())
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
// `no-uri` references the `followURI` functionality where we can use an upstream spec when creating a support bundle
// This flag makes sure we can also disable this and fall back to the default spec.
cmd.Flags().Bool("no-uri", false, "When this flag is used, Troubleshoot does not attempt to retrieve the spec referenced by the uri: field`")
k8sutil.AddFlags(cmd.Flags())
// Initialize klog flags
logger.InitKlogFlags(cmd)
// CPU and memory profiling flags
util.AddProfilingFlags(cmd)
return cmd
}
@@ -77,24 +105,3 @@ func initConfig() {
viper.SetEnvPrefix("TROUBLESHOOT")
viper.AutomaticEnv()
}
func ensureCollectorInList(list []*troubleshootv1beta2.Collect, collector troubleshootv1beta2.Collect) []*troubleshootv1beta2.Collect {
for _, inList := range list {
if collector.ClusterResources != nil && inList.ClusterResources != nil {
return list
}
if collector.ClusterInfo != nil && inList.ClusterInfo != nil {
return list
}
}
return append(list, &collector)
}
func writeFile(filename string, contents []byte) error {
if err := ioutil.WriteFile(filename, contents, 0644); err != nil {
return err
}
return nil
}
+176 -178
View File
@@ -1,48 +1,80 @@
package cli
import (
"context"
"crypto/tls"
"encoding/json"
"fmt"
"net/http"
"net/url"
"os"
"os/signal"
"path/filepath"
"strings"
"sync"
"time"
cursor "github.com/ahmetalpbalkan/go-cursor"
"github.com/fatih/color"
"github.com/manifoldco/promptui"
"github.com/mattn/go-isatty"
"github.com/pkg/errors"
"github.com/replicatedhq/troubleshoot/internal/specs"
"github.com/replicatedhq/troubleshoot/internal/util"
analyzer "github.com/replicatedhq/troubleshoot/pkg/analyze"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
troubleshootclientsetscheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
"github.com/replicatedhq/troubleshoot/pkg/collect"
"github.com/replicatedhq/troubleshoot/pkg/constants"
"github.com/replicatedhq/troubleshoot/pkg/convert"
"github.com/replicatedhq/troubleshoot/pkg/httputil"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
"github.com/replicatedhq/troubleshoot/pkg/logger"
"github.com/replicatedhq/troubleshoot/pkg/specs"
"github.com/replicatedhq/troubleshoot/pkg/loader"
"github.com/replicatedhq/troubleshoot/pkg/supportbundle"
"github.com/replicatedhq/troubleshoot/pkg/types"
"github.com/spf13/viper"
spin "github.com/tj/go-spin"
"k8s.io/apimachinery/pkg/labels"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
)
const (
SupportBundleSecretKey = "support-bundle-spec"
)
func runTroubleshoot(v *viper.Viper, arg []string) error {
if v.GetBool("load-cluster-specs") == false && len(arg) < 1 {
func runTroubleshoot(v *viper.Viper, args []string) error {
ctx := context.Background()
if !v.GetBool("load-cluster-specs") && len(args) < 1 {
return errors.New("flag load-cluster-specs must be set if no specs are provided on the command line")
}
restConfig, err := k8sutil.GetRESTConfig()
if err != nil {
return errors.Wrap(err, "failed to convert kube flags to rest config")
}
client, err := kubernetes.NewForConfig(restConfig)
if err != nil {
return errors.Wrap(err, "failed to create kubernetes client")
}
mainBundle, additionalRedactors, err := loadSpecs(ctx, args, client)
if err != nil {
return err
}
// For --dry-run, we want to print the yaml and exit
if v.GetBool("dry-run") {
k := loader.TroubleshootKinds{
SupportBundlesV1Beta2: []troubleshootv1beta2.SupportBundle{*mainBundle},
}
// If we have redactors, add them to the temp kinds object
if len(additionalRedactors.Spec.Redactors) > 0 {
k.RedactorsV1Beta2 = []troubleshootv1beta2.Redactor{*additionalRedactors}
}
out, err := k.ToYaml()
if err != nil {
return types.NewExitCodeError(constants.EXIT_CODE_CATCH_ALL, errors.Wrap(err, "failed to convert specs to yaml"))
}
fmt.Printf("%s", out)
return nil
}
interactive := v.GetBool("interactive") && isatty.IsTerminal(os.Stdout.Fd())
if interactive {
@@ -60,11 +92,6 @@ func runTroubleshoot(v *viper.Viper, arg []string) error {
os.Exit(0)
}()
restConfig, err := k8sutil.GetRESTConfig()
if err != nil {
return errors.Wrap(err, "failed to convert kube flags to rest config")
}
var sinceTime *time.Time
if v.GetString("since-time") != "" || v.GetString("since") != "" {
sinceTime, err = parseTimeFlags(v)
@@ -79,136 +106,42 @@ func runTroubleshoot(v *viper.Viper, arg []string) error {
})
}
var mainBundle *troubleshootv1beta2.SupportBundle
troubleshootclientsetscheme.AddToScheme(scheme.Scheme)
additionalRedactors := &troubleshootv1beta2.Redactor{}
for i, v := range arg {
collectorContent, err := supportbundle.LoadSupportBundleSpec(v)
if err != nil {
return errors.Wrap(err, "failed to load support bundle spec")
var wg sync.WaitGroup
collectorCB := func(c chan interface{}, msg string) { c <- msg }
progressChan := make(chan interface{})
isProgressChanClosed := false
defer func() {
if !isProgressChanClosed {
close(progressChan)
}
multidocs := strings.Split(string(collectorContent), "\n---\n")
supportBundle, err := supportbundle.ParseSupportBundleFromDoc([]byte(multidocs[0]))
if err != nil {
return errors.Wrap(err, "failed to parse support bundle spec")
}
if i == 0 {
mainBundle = supportBundle
} else {
mainBundle = supportbundle.ConcatSpec(mainBundle, supportBundle)
}
parsedRedactors, err := supportbundle.ParseRedactorsFromSpec(multidocs)
if err != nil {
return errors.Wrap(err, "failed to parse redactors from doc")
}
additionalRedactors.Spec.Redactors = append(additionalRedactors.Spec.Redactors, parsedRedactors...)
}
if v.GetBool("load-cluster-specs") {
labelSelector := strings.Join(v.GetStringSlice("selector"), ",")
parsedSelector, err := labels.Parse(labelSelector)
if err != nil {
return errors.Wrap(err, "unable to parse selector")
}
namespace := ""
if v.GetString("namespace") != "" {
namespace = v.GetString("namespace")
}
config, err := k8sutil.GetRESTConfig()
if err != nil {
return errors.Wrap(err, "failed to convert kube flags to rest config")
}
client, err := kubernetes.NewForConfig(config)
if err != nil {
return errors.Wrap(err, "failed to convert create k8s client")
}
bundlesFromSecrets, err := specs.LoadFromSecretMatchingLabel(client, parsedSelector.String(), namespace, SupportBundleSecretKey)
if err != nil {
logger.Printf("failed to load support bundle spec from secrets: %s", err)
}
if bundlesFromSecrets != nil {
for _, bundle := range bundlesFromSecrets {
multidocs := strings.Split(string(bundle), "\n---\n")
parsedBundlesFromSecrets, err := supportbundle.ParseSupportBundleFromDoc([]byte(multidocs[0]))
if err != nil {
logger.Printf("failed to parse support bundle spec: %s", err)
continue
}
if mainBundle == nil {
mainBundle = parsedBundlesFromSecrets
} else {
supportbundle.ConcatSpec(mainBundle, parsedBundlesFromSecrets)
}
parsedRedactors, err := supportbundle.ParseRedactorsFromSpec(multidocs)
if err != nil {
logger.Printf("failed to parse redactors from doc: %s", err)
continue
}
additionalRedactors.Spec.Redactors = append(additionalRedactors.Spec.Redactors, parsedRedactors...)
}
}
if mainBundle == nil {
return errors.New("no specs found in cluster")
}
}
if mainBundle == nil {
return errors.New("no support bundle specs provided to run")
} else if mainBundle.Spec.Collectors == nil && mainBundle.Spec.HostCollectors == nil {
return errors.New("no collectors specified in support bundle")
}
for idx, redactor := range v.GetStringSlice("redactors") {
redactorObj, err := supportbundle.GetRedactorFromURI(redactor)
if err != nil {
return errors.Wrapf(err, "failed to get redactor spec %s, #%d", redactor, idx)
}
if redactorObj != nil {
additionalRedactors.Spec.Redactors = append(additionalRedactors.Spec.Redactors, redactorObj.Spec.Redactors...)
}
}
var collectorCB func(chan interface{}, string)
progressChan := make(chan interface{}) // non-zero buffer can result in missed messages
finishedCh := make(chan bool, 1)
isFinishedChClosed := false
wg.Wait()
}()
if !interactive {
// TODO (dans): custom warning handler to capture warning in `analysisOutput`
restConfig.WarningHandler = rest.NoWarnings{}
collectorCB = func(ch chan interface{}, name string) {
return
}
// TODO (dans): maybe log to file
wg.Add(1)
go func() {
for {
select {
case _ = <-progressChan:
// do nothing
}
defer wg.Done()
for msg := range progressChan {
klog.Infof("Collecting support bundle: %v", msg)
}
}()
} else {
s := spin.New()
wg.Add(1)
go func() {
defer wg.Done()
currentDir := ""
for {
select {
case msg := <-progressChan:
case msg, ok := <-progressChan:
if !ok {
fmt.Printf("\r%s\r", cursor.ClearEntireLine())
return
}
switch msg := msg.(type) {
case error:
c := color.New(color.FgHiRed)
@@ -216,9 +149,6 @@ func runTroubleshoot(v *viper.Viper, arg []string) error {
case string:
currentDir = filepath.Base(msg)
}
case <-finishedCh:
fmt.Printf("\r%s\r", cursor.ClearEntireLine())
return
case <-time.After(time.Millisecond * 100):
if currentDir == "" {
fmt.Printf("\r%s \033[36mCollecting support bundle\033[m %s", cursor.ClearEntireLine(), s.Next())
@@ -228,16 +158,6 @@ func runTroubleshoot(v *viper.Viper, arg []string) error {
}
}
}()
defer func() {
if !isFinishedChClosed {
close(finishedCh)
}
}()
collectorCB = func(c chan interface{}, msg string) {
c <- fmt.Sprintf("%s", msg)
}
}
createOpts := supportbundle.SupportBundleCreateOpts{
@@ -263,11 +183,12 @@ func runTroubleshoot(v *viper.Viper, arg []string) error {
if err != nil {
return errors.Wrap(err, "failed to run collect and analyze process")
}
close(progressChan) // this removes the spinner in interactive mode
isProgressChanClosed = true
if len(response.AnalyzerResults) > 0 {
if interactive {
close(finishedCh) // this removes the spinner
isFinishedChClosed = true
if err := showInteractiveResults(mainBundle.Name, response.AnalyzerResults); err != nil {
interactive = false
}
@@ -295,7 +216,7 @@ the %s Admin Console to begin analysis.`
return nil
}
fmt.Printf("%s\n", response.ArchivePath)
fmt.Printf("\n%s\n", response.ArchivePath)
return nil
}
@@ -311,12 +232,112 @@ the %s Admin Console to begin analysis.`
return nil
}
func getExpectedContentType(uploadURL string) string {
parsedURL, err := url.Parse(uploadURL)
if err != nil {
return ""
// loadSupportBundleSpecsFromURIs loads support bundle specs from URIs
func loadSupportBundleSpecsFromURIs(ctx context.Context, kinds *loader.TroubleshootKinds) (*loader.TroubleshootKinds, error) {
remoteRawSpecs := []string{}
for _, s := range kinds.SupportBundlesV1Beta2 {
if s.Spec.Uri != "" && util.IsURL(s.Spec.Uri) {
// We are using LoadSupportBundleSpec function here since it handles prompting
// users to accept insecure connections
// There is an opportunity to refactor this code in favour of the Loader APIs
// TODO: Pass ctx to LoadSupportBundleSpec
rawSpec, err := supportbundle.LoadSupportBundleSpec(s.Spec.Uri)
if err != nil {
// In the event a spec can't be loaded, we'll just skip it and print a warning
klog.Warningf("unable to load support bundle from URI: %q: %v", s.Spec.Uri, err)
continue
}
remoteRawSpecs = append(remoteRawSpecs, string(rawSpec))
}
}
return parsedURL.Query().Get("Content-Type")
if len(remoteRawSpecs) == 0 {
return kinds, nil
}
return loader.LoadSpecs(ctx, loader.LoadOptions{
RawSpecs: remoteRawSpecs,
})
}
func loadSpecs(ctx context.Context, args []string, client kubernetes.Interface) (*troubleshootv1beta2.SupportBundle, *troubleshootv1beta2.Redactor, error) {
// Append redactor uris to the args
allArgs := append(args, viper.GetStringSlice("redactors")...)
kinds, err := specs.LoadFromCLIArgs(ctx, client, allArgs, viper.GetViper())
if err != nil {
return nil, nil, err
}
// Load additional specs from support bundle URIs
if !viper.GetBool("no-uri") {
moreKinds, err := loadSupportBundleSpecsFromURIs(ctx, kinds)
if err != nil {
klog.Warningf("unable to load support bundles from URIs: %v", err)
} else {
kinds.Add(moreKinds)
}
}
// Check if we have any collectors to run in the troubleshoot specs
// TODO: Do we use the RemoteCollectors anymore?
if len(kinds.CollectorsV1Beta2) == 0 &&
len(kinds.HostCollectorsV1Beta2) == 0 &&
len(kinds.SupportBundlesV1Beta2) == 0 {
return nil, nil, errors.New("no collectors specified to run")
}
// Merge specs
// We need to add the default type information to the support bundle spec
// since by default these fields would be empty
mainBundle := &troubleshootv1beta2.SupportBundle{
TypeMeta: metav1.TypeMeta{
APIVersion: "troubleshoot.sh/v1beta2",
Kind: "SupportBundle",
},
ObjectMeta: metav1.ObjectMeta{
Name: "merged-support-bundle-spec",
},
}
for _, sb := range kinds.SupportBundlesV1Beta2 {
sb := sb
mainBundle = supportbundle.ConcatSpec(mainBundle, &sb)
}
for _, c := range kinds.CollectorsV1Beta2 {
mainBundle.Spec.Collectors = append(mainBundle.Spec.Collectors, c.Spec.Collectors...)
}
for _, hc := range kinds.HostCollectorsV1Beta2 {
mainBundle.Spec.HostCollectors = append(mainBundle.Spec.HostCollectors, hc.Spec.Collectors...)
}
// Ensure cluster info and cluster resources collectors are in the merged spec
// We need to add them here so when we --dry-run, these collectors are included.
// supportbundle.runCollectors duplicates this bit. We'll need to refactor it out later
// when its clearer what other code depends on this logic e.g KOTS
mainBundle.Spec.Collectors = collect.EnsureCollectorInList(
mainBundle.Spec.Collectors,
troubleshootv1beta2.Collect{ClusterInfo: &troubleshootv1beta2.ClusterInfo{}},
)
mainBundle.Spec.Collectors = collect.EnsureCollectorInList(
mainBundle.Spec.Collectors,
troubleshootv1beta2.Collect{ClusterResources: &troubleshootv1beta2.ClusterResources{}},
)
additionalRedactors := &troubleshootv1beta2.Redactor{
TypeMeta: metav1.TypeMeta{
APIVersion: "troubleshoot.sh/v1beta2",
Kind: "Redactor",
},
ObjectMeta: metav1.ObjectMeta{
Name: "merged-redactors-spec",
},
}
for _, r := range kinds.RedactorsV1Beta2 {
additionalRedactors.Spec.Redactors = append(additionalRedactors.Spec.Redactors, r.Spec.Redactors...)
}
return mainBundle, additionalRedactors, nil
}
func parseTimeFlags(v *viper.Viper) (*time.Time, error) {
@@ -344,29 +365,6 @@ func parseTimeFlags(v *viper.Viper) (*time.Time, error) {
return &sinceTime, nil
}
func shouldRetryRequest(err error) bool {
if strings.Contains(err.Error(), "x509") && canTryInsecure() {
httputil.AddTransport(&http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
})
return true
}
return false
}
func canTryInsecure() bool {
if !isatty.IsTerminal(os.Stdout.Fd()) {
return false
}
prompt := promptui.Prompt{
Label: "Connection appears to be insecure. Would you like to attempt to create a support bundle anyway?",
IsConfirm: true,
}
_, err := prompt.Run()
return err == nil
}
type analysisOutput struct {
Analysis []*analyzer.AnalyzeResult
ArchivePath string
+83
View File
@@ -0,0 +1,83 @@
package cli
import (
"context"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/replicatedhq/troubleshoot/pkg/httputil"
"github.com/replicatedhq/troubleshoot/pkg/loader"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
var orig = `
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: sb-1
spec:
uri: $MY_URI
collectors:
- configMap:
name: kube-root-ca.crt
namespace: default
`
func Test_loadSupportBundleSpecsFromURIs(t *testing.T) {
// Run a webserver to serve the spec
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: sb-2
spec:
collectors:
- clusterInfo: {}`))
}))
defer srv.Close()
orig := strings.ReplaceAll(orig, "$MY_URI", srv.URL)
ctx := context.Background()
kinds, err := loader.LoadSpecs(ctx, loader.LoadOptions{RawSpec: orig})
require.NoError(t, err)
require.NotNil(t, kinds)
moreKinds, err := loadSupportBundleSpecsFromURIs(ctx, kinds)
require.NoError(t, err)
require.Len(t, moreKinds.SupportBundlesV1Beta2, 1)
assert.NotNil(t, moreKinds.SupportBundlesV1Beta2[0].Spec.Collectors[0].ClusterInfo)
}
func Test_loadSupportBundleSpecsFromURIs_TimeoutError(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(2 * time.Second) // this will cause a timeout
}))
defer srv.Close()
ctx := context.Background()
kinds, err := loader.LoadSpecs(ctx, loader.LoadOptions{
RawSpec: strings.ReplaceAll(orig, "$MY_URI", srv.URL),
})
require.NoError(t, err)
// Set the timeout on the http client to 10ms
// supportbundle.LoadSupportBundleSpec does not yet use the context
before := httputil.GetHttpClient().Timeout
httputil.GetHttpClient().Timeout = 10 * time.Millisecond
defer func() {
// Reinstate the original timeout. Its a global var so we need to reset it
httputil.GetHttpClient().Timeout = before
}()
kindsAfter, err := loadSupportBundleSpecsFromURIs(ctx, kinds)
require.NoError(t, err)
assert.Equal(t, kinds, kindsAfter)
}
-24
View File
@@ -1,24 +0,0 @@
package cli
import (
"fmt"
"os"
"github.com/pkg/errors"
)
func findFileName(basename, extension string) (string, error) {
n := 1
name := basename
for {
filename := name + "." + extension
if _, err := os.Stat(filename); os.IsNotExist(err) {
return filename, nil
} else if err != nil {
return "", errors.Wrap(err, "check file exists")
}
name = fmt.Sprintf("%s (%d)", basename, n)
n = n + 1
}
}
-51
View File
@@ -1,51 +0,0 @@
package cli
import (
"fmt"
"io/ioutil"
"path/filepath"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/replicatedhq/troubleshoot/pkg/version"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
)
func VersionCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print the current version and exit",
Long: `Print the current version and exit`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Printf("Replicated Troubleshoot %s\n", version.Version())
return nil
},
}
return cmd
}
const VersionFilename = "version.yaml"
func writeVersionFile(path string) error {
version := troubleshootv1beta2.SupportBundleVersion{
ApiVersion: "troubleshoot.sh/v1beta2",
Kind: "SupportBundle",
Spec: troubleshootv1beta2.SupportBundleVersionSpec{
VersionNumber: version.Version(),
},
}
b, err := yaml.Marshal(version)
if err != nil {
return err
}
filename := filepath.Join(path, VersionFilename)
err = ioutil.WriteFile(filename, b, 0644)
if err != nil {
return err
}
return nil
}
-9
View File
@@ -1,9 +0,0 @@
apiVersion: troubleshoot.sh/v1beta2
kind: RemoteCollector
metadata:
name: modules
spec:
collectors:
- cpu: {}
- memory: {}
# - kernelModules: {}
@@ -1,10 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
controller-gen.kubebuilder.io/version: v0.11.2
creationTimestamp: null
name: analyzers.troubleshoot.replicated.com
spec:
@@ -687,7 +686,6 @@ spec:
type: string
required:
- outcomes
- storageClassName
type: object
textAnalyze:
properties:
@@ -747,9 +745,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
@@ -1,10 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
controller-gen.kubebuilder.io/version: v0.11.2
creationTimestamp: null
name: collectors.troubleshoot.replicated.com
spec:
@@ -164,6 +163,13 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: A Duration represents the elapsed time
between two instants as an int64 nanosecond count.
The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
url:
type: string
required:
@@ -181,6 +187,13 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: A Duration represents the elapsed time
between two instants as an int64 nanosecond count.
The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
url:
type: string
required:
@@ -196,6 +209,13 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: A Duration represents the elapsed time
between two instants as an int64 nanosecond count.
The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
url:
type: string
required:
@@ -329,9 +349,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
@@ -1,10 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
controller-gen.kubebuilder.io/version: v0.11.2
creationTimestamp: null
name: preflights.troubleshoot.replicated.com
spec:
@@ -687,7 +686,6 @@ spec:
type: string
required:
- outcomes
- storageClassName
type: object
textAnalyze:
properties:
@@ -837,6 +835,13 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: A Duration represents the elapsed time
between two instants as an int64 nanosecond count.
The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
url:
type: string
required:
@@ -854,6 +859,13 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: A Duration represents the elapsed time
between two instants as an int64 nanosecond count.
The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
url:
type: string
required:
@@ -869,6 +881,13 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: A Duration represents the elapsed time
between two instants as an int64 nanosecond count.
The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
url:
type: string
required:
@@ -1004,9 +1023,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
@@ -1,10 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
controller-gen.kubebuilder.io/version: v0.11.2
creationTimestamp: null
name: redactors.troubleshoot.replicated.com
spec:
@@ -79,9 +78,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
@@ -1,10 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
controller-gen.kubebuilder.io/version: v0.11.2
creationTimestamp: null
name: supportbundles.troubleshoot.replicated.com
spec:
@@ -718,7 +717,6 @@ spec:
type: string
required:
- outcomes
- storageClassName
type: object
textAnalyze:
properties:
@@ -868,6 +866,13 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: A Duration represents the elapsed time
between two instants as an int64 nanosecond count.
The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
url:
type: string
required:
@@ -885,6 +890,13 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: A Duration represents the elapsed time
between two instants as an int64 nanosecond count.
The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
url:
type: string
required:
@@ -900,6 +912,13 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: A Duration represents the elapsed time
between two instants as an int64 nanosecond count.
The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
url:
type: string
required:
@@ -1033,9 +1052,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+383 -8
View File
@@ -1,10 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
controller-gen.kubebuilder.io/version: v0.11.2
creationTimestamp: null
name: hostcollectors.troubleshoot.sh
spec:
@@ -41,6 +40,10 @@ spec:
properties:
blockDevices:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -93,6 +96,59 @@ spec:
type: object
certificate:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
type: string
exclude:
type: BoolString
outcomes:
items:
properties:
fail:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
pass:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
warn:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
certificatesCollection:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -138,6 +194,10 @@ spec:
type: object
cpu:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -183,6 +243,10 @@ spec:
type: object
diskUsage:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -228,6 +292,10 @@ spec:
type: object
filesystemPerformance:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -273,6 +341,10 @@ spec:
type: object
hostOS:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -318,6 +390,10 @@ spec:
type: object
hostServices:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -363,6 +439,10 @@ spec:
type: object
http:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -408,6 +488,10 @@ spec:
type: object
httpLoadBalancer:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -453,6 +537,10 @@ spec:
type: object
ipv4Interfaces:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -498,6 +586,10 @@ spec:
type: object
kernelModules:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -543,6 +635,59 @@ spec:
type: object
memory:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
type: string
exclude:
type: BoolString
outcomes:
items:
properties:
fail:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
pass:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
warn:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
subnetAvailable:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -588,6 +733,10 @@ spec:
type: object
systemPackages:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -633,6 +782,10 @@ spec:
type: object
tcpConnect:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -678,6 +831,10 @@ spec:
type: object
tcpLoadBalancer:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -723,6 +880,10 @@ spec:
type: object
tcpPortStatus:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -766,8 +927,122 @@ spec:
required:
- outcomes
type: object
textAnalyze:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
type: string
exclude:
type: BoolString
excludeFiles:
items:
type: string
type: array
fileName:
type: string
ignoreIfNoFiles:
type: boolean
outcomes:
items:
properties:
fail:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
pass:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
warn:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
type: object
type: array
regex:
type: string
regexGroups:
type: string
strict:
type: BoolString
required:
- outcomes
type: object
time:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
type: string
exclude:
type: BoolString
outcomes:
items:
properties:
fail:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
pass:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
warn:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
udpPortStatus:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -837,6 +1112,30 @@ spec:
- certificatePath
- keyPath
type: object
certificatesCollection:
properties:
collectorName:
type: string
exclude:
type: BoolString
paths:
items:
type: string
type: array
required:
- paths
type: object
copy:
properties:
collectorName:
type: string
exclude:
type: BoolString
path:
type: string
required:
- path
type: object
cpu:
properties:
collectorName:
@@ -961,6 +1260,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -976,6 +1280,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -991,6 +1300,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -1044,6 +1358,36 @@ spec:
exclude:
type: BoolString
type: object
run:
properties:
args:
items:
type: string
type: array
collectorName:
type: string
command:
type: string
exclude:
type: BoolString
required:
- args
- command
type: object
subnetAvailable:
properties:
CIDRRangeAlloc:
type: string
collectorName:
type: string
desiredCIDR:
type: integer
exclude:
type: BoolString
required:
- CIDRRangeAlloc
- desiredCIDR
type: object
systemPackages:
properties:
amzn:
@@ -1066,6 +1410,10 @@ spec:
items:
type: string
type: array
centos9:
items:
type: string
type: array
collectorName:
type: string
exclude:
@@ -1082,6 +1430,10 @@ spec:
items:
type: string
type: array
ol9:
items:
type: string
type: array
rhel:
items:
type: string
@@ -1094,6 +1446,22 @@ spec:
items:
type: string
type: array
rhel9:
items:
type: string
type: array
rocky:
items:
type: string
type: array
rocky8:
items:
type: string
type: array
rocky9:
items:
type: string
type: array
ubuntu:
items:
type: string
@@ -1160,6 +1528,19 @@ spec:
exclude:
type: BoolString
type: object
udpPortStatus:
properties:
collectorName:
type: string
exclude:
type: BoolString
interface:
type: string
port:
type: integer
required:
- port
type: object
type: object
type: array
type: object
@@ -1169,9 +1550,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
+425 -8
View File
@@ -1,10 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
controller-gen.kubebuilder.io/version: v0.11.2
creationTimestamp: null
name: hostpreflights.troubleshoot.sh
spec:
@@ -41,6 +40,10 @@ spec:
properties:
blockDevices:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -93,6 +96,59 @@ spec:
type: object
certificate:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
type: string
exclude:
type: BoolString
outcomes:
items:
properties:
fail:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
pass:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
warn:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
certificatesCollection:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -138,6 +194,10 @@ spec:
type: object
cpu:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -183,6 +243,10 @@ spec:
type: object
diskUsage:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -228,6 +292,10 @@ spec:
type: object
filesystemPerformance:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -273,6 +341,10 @@ spec:
type: object
hostOS:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -318,6 +390,10 @@ spec:
type: object
hostServices:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -363,6 +439,10 @@ spec:
type: object
http:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -408,6 +488,10 @@ spec:
type: object
httpLoadBalancer:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -453,6 +537,10 @@ spec:
type: object
ipv4Interfaces:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -498,6 +586,10 @@ spec:
type: object
kernelModules:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -543,6 +635,59 @@ spec:
type: object
memory:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
type: string
exclude:
type: BoolString
outcomes:
items:
properties:
fail:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
pass:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
warn:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
subnetAvailable:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -588,6 +733,10 @@ spec:
type: object
systemPackages:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -633,6 +782,10 @@ spec:
type: object
tcpConnect:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -678,6 +831,10 @@ spec:
type: object
tcpLoadBalancer:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -723,6 +880,10 @@ spec:
type: object
tcpPortStatus:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -766,8 +927,122 @@ spec:
required:
- outcomes
type: object
textAnalyze:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
type: string
exclude:
type: BoolString
excludeFiles:
items:
type: string
type: array
fileName:
type: string
ignoreIfNoFiles:
type: boolean
outcomes:
items:
properties:
fail:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
pass:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
warn:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
type: object
type: array
regex:
type: string
regexGroups:
type: string
strict:
type: BoolString
required:
- outcomes
type: object
time:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
type: string
exclude:
type: BoolString
outcomes:
items:
properties:
fail:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
pass:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
warn:
properties:
message:
type: string
uri:
type: string
when:
type: string
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
udpPortStatus:
properties:
annotations:
additionalProperties:
type: string
type: object
checkName:
type: string
collectorName:
@@ -837,6 +1112,30 @@ spec:
- certificatePath
- keyPath
type: object
certificatesCollection:
properties:
collectorName:
type: string
exclude:
type: BoolString
paths:
items:
type: string
type: array
required:
- paths
type: object
copy:
properties:
collectorName:
type: string
exclude:
type: BoolString
path:
type: string
required:
- path
type: object
cpu:
properties:
collectorName:
@@ -961,6 +1260,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -976,6 +1280,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -991,6 +1300,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -1044,6 +1358,36 @@ spec:
exclude:
type: BoolString
type: object
run:
properties:
args:
items:
type: string
type: array
collectorName:
type: string
command:
type: string
exclude:
type: BoolString
required:
- args
- command
type: object
subnetAvailable:
properties:
CIDRRangeAlloc:
type: string
collectorName:
type: string
desiredCIDR:
type: integer
exclude:
type: BoolString
required:
- CIDRRangeAlloc
- desiredCIDR
type: object
systemPackages:
properties:
amzn:
@@ -1066,6 +1410,10 @@ spec:
items:
type: string
type: array
centos9:
items:
type: string
type: array
collectorName:
type: string
exclude:
@@ -1082,6 +1430,10 @@ spec:
items:
type: string
type: array
ol9:
items:
type: string
type: array
rhel:
items:
type: string
@@ -1094,6 +1446,22 @@ spec:
items:
type: string
type: array
rhel9:
items:
type: string
type: array
rocky:
items:
type: string
type: array
rocky8:
items:
type: string
type: array
rocky9:
items:
type: string
type: array
ubuntu:
items:
type: string
@@ -1160,6 +1528,19 @@ spec:
exclude:
type: BoolString
type: object
udpPortStatus:
properties:
collectorName:
type: string
exclude:
type: BoolString
interface:
type: string
port:
type: integer
required:
- port
type: object
type: object
type: array
remoteCollectors:
@@ -1303,6 +1684,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -1318,6 +1704,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -1333,6 +1724,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -1379,6 +1775,20 @@ spec:
exclude:
type: BoolString
type: object
subnetAvailable:
properties:
CIDRRangeAlloc:
type: string
collectorName:
type: string
desiredCIDR:
type: integer
exclude:
type: BoolString
required:
- CIDRRangeAlloc
- desiredCIDR
type: object
systemPackages:
properties:
collectorName:
@@ -1435,6 +1845,19 @@ spec:
exclude:
type: BoolString
type: object
udpPortStatus:
properties:
collectorName:
type: string
exclude:
type: BoolString
interface:
type: string
port:
type: integer
required:
- port
type: object
type: object
type: array
type: object
@@ -1444,9 +1867,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
File diff suppressed because it is too large Load Diff
+1 -8
View File
@@ -1,10 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
controller-gen.kubebuilder.io/version: v0.11.2
creationTimestamp: null
name: redactors.troubleshoot.sh
spec:
@@ -79,9 +78,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
@@ -1,10 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
controller-gen.kubebuilder.io/version: v0.11.2
creationTimestamp: null
name: remotecollectors.troubleshoot.sh
spec:
@@ -208,6 +207,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -223,6 +227,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -238,6 +247,11 @@ spec:
type: object
insecureSkipVerify:
type: boolean
timeout:
description: Timeout is the time to wait for a server's
response. Its a duration e.g 15s, 2h30m. Missing value
or empty string or means no timeout.
type: string
url:
type: string
required:
@@ -284,6 +298,20 @@ spec:
exclude:
type: BoolString
type: object
subnetAvailable:
properties:
CIDRRangeAlloc:
type: string
collectorName:
type: string
desiredCIDR:
type: integer
exclude:
type: BoolString
required:
- CIDRRangeAlloc
- desiredCIDR
type: object
systemPackages:
properties:
collectorName:
@@ -340,6 +368,19 @@ spec:
exclude:
type: BoolString
type: object
udpPortStatus:
properties:
collectorName:
type: string
exclude:
type: BoolString
interface:
type: string
port:
type: integer
required:
- port
type: object
type: object
type: array
nodeSelector:
@@ -353,9 +394,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
File diff suppressed because it is too large Load Diff
+17 -4
View File
@@ -1,17 +1,20 @@
project_name: troubleshoot
release:
github:
owner: replicatedhq
name: troubleshoot
builds:
- id: preflight
# NOTE: if you add any additional goos/goarch values, ensure you update ../.github/workflows/build-test-deploy.yaml
# specifically the matrix values for goreleaser-test
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm
- arm64
- riscv64
ignore:
- goos: windows
goarch: arm
env:
- CGO_ENABLED=0
main: cmd/preflight/main.go
@@ -30,7 +33,12 @@ builds:
- windows
goarch:
- amd64
- arm
- arm64
- riscv64
ignore:
- goos: windows
goarch: arm
env:
- CGO_ENABLED=0
main: cmd/troubleshoot/main.go
@@ -49,7 +57,12 @@ builds:
- windows
goarch:
- amd64
- arm
- arm64
- riscv64
ignore:
- goos: windows
goarch: arm
env:
- CGO_ENABLED=0
main: cmd/collect/main.go
+23 -1
View File
@@ -16,6 +16,28 @@ spec:
- from: LICENSE
to: .
bin: preflight
- selector:
matchLabels:
os: linux
arch: arm64
{{addURIAndSha "https://github.com/replicatedhq/troubleshoot/releases/download/{{ .TagName }}/preflight_linux_arm64.tar.gz" .TagName }}
files:
- from: preflight
to: .
- from: LICENSE
to: .
bin: preflight
- selector:
matchLabels:
os: linux
arch: arm
{{addURIAndSha "https://github.com/replicatedhq/troubleshoot/releases/download/{{ .TagName }}/preflight_linux_arm.tar.gz" .TagName }}
files:
- from: preflight
to: .
- from: LICENSE
to: .
bin: preflight
- selector:
matchLabels:
os: darwin
@@ -37,7 +59,7 @@ spec:
to: .
- from: LICENSE
to: .
bin: preflight
bin: preflight
- selector:
matchLabels:
os: windows
+23 -1
View File
@@ -16,6 +16,28 @@ spec:
- from: LICENSE
to: .
bin: support-bundle
- selector:
matchLabels:
os: linux
arch: arm64
{{addURIAndSha "https://github.com/replicatedhq/troubleshoot/releases/download/{{ .TagName }}/support-bundle_linux_arm64.tar.gz" .TagName }}
files:
- from: support-bundle
to: .
- from: LICENSE
to: .
bin: support-bundle
- selector:
matchLabels:
os: linux
arch: arm
{{addURIAndSha "https://github.com/replicatedhq/troubleshoot/releases/download/{{ .TagName }}/support-bundle_linux_arm.tar.gz" .TagName }}
files:
- from: support-bundle
to: .
- from: LICENSE
to: .
bin: support-bundle
- selector:
matchLabels:
os: darwin
@@ -37,7 +59,7 @@ spec:
to: .
- from: LICENSE
to: .
bin: support-bundle
bin: support-bundle
- selector:
matchLabels:
os: windows
+68
View File
@@ -0,0 +1,68 @@
# Run collectors concurrently
## Goals
Increase the speed at which collectors complete.
## Non Goals
## Background
Currently all collectors run sequentially, in the order in which they are specified in the spec. This is implied, and has not been guaranteed. With the addition of the ability to supply multiple specs, the order is no longer predicatble.
Although sequence is not guaranteed for any collectors, #768 ensures that the `clusterResources` collector runs first, so that the list of resources does not include those that are started during the Troubleshoot collection sequence.
The performance for support-bundle and preflight runs is important to the end user experience of the product. There are examples where a support bundle takes multiple minutes to complete, and folks are left wondering if the process has hung or crashed. Preflights that take too long will simply be skipped, which leads to problems with installation being difficult to identify.
## High-Level Design
Switch collectors and host collectors to use goroutines to collect (concurrently). This should run the list of collectors of `clusterResources` type first, then the remainder concurrently when `clusterResources` is complete.
## Detailed Design
Tasks that can be split to separate merges (in order):
* Switch all collectors to use goroutines to collect (concurrently).
* In `supportbundle.runCollectors()`, refactor to use a `go func()` pattern to run all the collectors that are not `clusterResources` concurrently. Check that the first in the list is `clusterResources` and run that separately, prior to the others.
* This task should introduce an optional concurrency limit field, default to, say, 10, which limits the number of goroutines/collectors that can run at any given time.
* This task should improve the collection speed of in-cluster collectors and preflights
* Switch Host Collectors to use goroutines for concurrent collection.
* In `supportbundle.runHostCollectors()`, refactor to use a `go func()` pattern for each collector.
* No need to honor the same concurrency limit as host collectors do not load the Kubernetes API
* Switch Host Preflights to use goroutines - `preflight.CollectHost()` runs `go func()` for each collector.
* Switch in-cluster Preflights to use goroutines - `preflight.Collect()` runs `go func()` for each collector.
* Ensure `clusterResources` runs in advance of the others so that pods started by collectors do not produce an error in the results.
## Limitations
Relies on splitting up the list of collectors into `clusterResources` and others.
Collisions between specs (e.g. if `runPod` has multiple specs with the same name) are not handled. At the current stage with collectors running sequentially, if two collectors write to the same file the second overwrites the data from the first. If collectors run concurrently, there can be issues creating multiple pods with the same name, and issues with concurrent access to the target file. This issue is tracked in [#895](https://github.com/replicatedhq/troubleshoot/issues/895)
This proposal excludes Remote Collectors.
## Assumptions
* The Kubernetes API can handle the load of collectors running concurrently, including when the pod logs collector runs.
## Testing
Any new function will need unit tests.
The existing Collect functions will need unit tests altered (or added).
We will need to ensure that `clusterResources` is collected prior to others.
## Documentation
There should be a note in https://troubleshoot.sh/docs/collect/ ensuring that folks do not expect the collectors to run in any particular order.
## Alternatives Considered
None.
## Security Considerations
None identified.
+76
View File
@@ -0,0 +1,76 @@
# ADR 001: remove IP address redaction by default
## Context
Since PR #8 IP addresses have automatically been redacted throughout support bundles. This was originally
added so that folks with security requirements that include not sharing IP addresses can avoid needing to add
individual redactors for that purpose.
The general requirement for environments that protect network infrastructure from being communicated outside also
includes hostnames, port numbers, and mac addresses. The Troubleshoot code does not redact these.
The experience of support engineers making use of Troubleshoot support bundles has been that in many cases,
a further set of logs, and data collection information needs to be collected for issues that involve network
infrastructure in order to be able to assist. This involves collection that does not redact IP addresses, and
introduces significant delays in the resolution of issues due to back and forth.
A review of Replicated support cases where end users posted an IP address in GitHub found 71 different issues
in 2022 (as of October 2022). This doesn't cover uploaded files, phone calls, screen shares, etc. It also
doesn't include anything else networking like mac address, hostnames, ports.
The problem discussed in this document:
* Users of Troubleshoot need to avoid redaction if they have networking issues, in order to share IP addresses
that are redacted by default.
* The user experience of the product is based around "define what you want", however with default redactors built
into the product in addition to the defined spec is confusing and, in some cases, problematic if you do not want
the built in redactors.
* A default set of redactors gives product users a false sense of security in that though the default redactors
do cover some redaction, they do not cover every possible combination for every particular sensitive item.
Redaction of hostnames is almost impossible given the freeform nature of hostnames, and the built in Password
redactor does not cover all passwords, merely a particular json combination.
## Decision
We will remove the code that redacts IP addresses by default from Troubleshoot. Folks that wish to redact IP addresses will
need to add that redactor to their individual Troubleshoot specs.
## Solution
The following changes need to be made:
* [Documentation](https://troubleshoot.sh/docs/redact/ip-addresses/) for the IP address redaction needs altering to reflect that Troubleshoot
does not automatically redact IP addresses, but if users wish to there is an example yaml spec available.
* Removal of the IP address redactor from [the code](https://github.com/replicatedhq/troubleshoot/blob/v0.45.0/pkg/redact/redact.go#L170)
* Clear release notes on release of this change, communicating that those wishing to redact IP addresses need to add that redactor to their spec.
* Possible broadcast communication since this is a change to default behavior.
## Status
Proposed
## Consequences
Describe the resulting context, after applying the decision. All consequences should be listed here,
not just the "positive" ones. A particular decision may have positive, negative, and neutral consequences,
but all of them affect the team and project in the future.
Those that wish to have IP addresses redacted by Troubleshoot need to ensure that the redactor specified during `support-bundle` runs includes a
regex for IP address redaction.
Example regex for IP redaction:
```yaml
apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: IP Addresses
spec:
redactors:
- name: Redact ipv4 addresses
removals:
regex:
- redactor: '(?P<mask>\b(?P<drop>25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?P<drop>25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?P<drop>25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?P<drop>25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b)'
```
Folks that have not specified the IP address regex above will, on support bundle creation, share their IP address information in that bundle by default.
+37
View File
@@ -0,0 +1,37 @@
# ADR 002: Mergeable preflight specs
When the `preflight` binary, or pacakge, is called, it supports only one spec definition at a time.
Recent changes in Troubleshoot allow the `support-bundle` binary to be called with multiple specs at a time. This allows cluster components to contribute independant Troubleshoot specs for their scope, and have Troubleshoot assemble them at run time.
Tools such as kURL have components which are maintained with a degree of separation to one another. It would be helpful to the maintainers of such projects to be able to call `preflight` specifying a number of specs at runtime, allowing Troubleshoot to assemble them into one spec for collection/analysis.
Currently if the `preflight` binary is called with multiple specs, it simply ignores all after the first.
## Decision
Modify the `preflight` CLI and package to be able to read multiple args rather than just one.
Introduce a merge mechanism in the same way that the `support-bundle` binary runs, to merge and deduplicate Preflight specs.
## Status
Proposed
## Consequences
There are no backward compatibility consequences or breaking changes in this proposal.
The project benefits:
* Folks maintaining kURL add-ons can contribute unique preflight specs for their add-on (and the same for other projects simlarly structured)
* Folks using `preflight` from the CLI without other applications (e.g. for a Helm install) are able to specify a list of preflights for their application rather than having to assemble one spec for each environment.
## Design notes
This proposal does not include adding the `uri:` field to `kind: Preflight`.
The file `cmd/preflight/cli/root.go` calls `preflight.RunPreflights` with `args[0]` which is likely to need to change to just `args`.
Func `RunPreflights` takes a single string arg (`arg string`) for the spec definition. This is likely to need to change to `arg []string`.
File `cmd/troubleshoot/cli/run.go` loops through the list of args, concatenating them together. A similar process is suitable for this change.
+81
View File
@@ -0,0 +1,81 @@
# Architecture Decision Records
_ADR_ for short.
## What is an Architecturally Significant Decision?
See [Documenting Architecture
Decisions](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions)
for more information.
The basic idea is to capture key decisions having to do with anything _architectural_
in a way that promotes better communication than simple word-of-mouth.
What is an _architectural_ decision? If one or more of the following ideas apply you
might be dealing with an architectural decision.
Does the design decision...
* Alter externally visible system properties?
* Modify public interfaces?
* Directly influence high priority quality attributes?
* Include or remove dependencies?
* Result from a discussion where you learned more about technical or business constraints?
* Involve taking on strategic technical debt?
* Change the structures of the system (static, dynamic, or physical)?
* Require other developers to update construction techniques or development environments?
## Template
Use this template in any new ADRs. Replace the help text as you write the ADR.
```
# ADR N: Brief Decision Title
Context goes here.
Describe the forces at play, including technological, political, social, and project local.
These forces are likely in tension, and should be called out as such. The language in this
section is value-neutral. It is simply describing facts.
## Decision
This section describes our response to these forces. It is stated in full sentences,
with active voice. "We will ..."
## Status
choose one: [Proposed | Accepted | Deprecated | Superseded]
if deprecated, include a rationale.
If superseded, include a link to the new ADR
## Consequences
Describe the resulting context, after applying the decision. All consequences should be listed here,
not just the "positive" ones. A particular decision may have positive, negative, and neutral consequences,
but all of them affect the team and project in the future.
```
## Tips and Hints
* Titles should be descriptive, concise, and precise
* The whole document should be one or two pages long at most.
* Think of the document as a conversation with a future developer. This means write well and use full
sentences.
* Update consequences as they become known. The ADR becomes like a diary for seeing how the design
decisions we make impact the system over time.
* Include diagrams as necessary.
## References
Nygard, Michael. Documenting Architecture Decisions, from _Think Relevance_ blog. [Web](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions)
Kruchten, Philippe. _The Decision View's Role in Software Architecture Practice_, IEEE Software 26:36-42, February 2009
Tyree, J. and Akerman, A. _Architecture Decisions: Demystifying Architecture_, IEEE Software 22:2:19-27, March-April 2005 [PDF](http://www.utdallas.edu/~chung/SA/zz-Impreso-architecture_decisions-tyree-05.pdf)
@@ -0,0 +1,66 @@
# Consolidate collector code
## Goals
Reduce code maintenance needs.
Improve consistency between preflight and support-bundle.
## Non Goals
## Background
In the current Troubleshoot code base, there are three separate paths to running collectors. These include preflights, support-bundle, and the collect package. The three have diverged over time and are different to one another, but do not appear to have any need to be separate. This is confusing and likely to introduce errors in the future.
## High-Level Design
* Add a `collect` package public API that can be called to run the collect logic, from any other package
* change the preflight, support-bundle and collect binaries to call that API rather than their own collect routines
## Detailed Design
Package `preflight`:
* Remove `CollectHost`, `Collect` and `CollectRemote`
Package `supportbundle`:
* Remove `runCollectors`, `CollectSupportBundleFromSpec`, and associated code
Package `collect`:
* Add a replacement for `runCollectors`, `CollectSupportBundleFromSpec` taken from `supportbundle`
* Add replacements for `CollectHost`, `Collect` and `CollectRemote` taken from `preflight`
* Where the above duplicate functionality, alter the `supportbundle` or `preflight` packages to ensure that a single new function handles the requirement
CLI packages:
* Alter to use the public functions from `collect`
## Limitations
Breaking change - KOTS at least imports `CollectSupportBundleFromSpec` plus potentially others.
This does not affect the analysis and redaction portions of code.
## Assumptions
* there is no need to run collectors differently between preflight and support-bundle
## Testing
Any new function will need unit tests.
Existing tests will need to be altered, and possibly consolidated.
## Documentation
The public function to call collection should be documented and at that point regarded stable.
## Alternatives Considered
## Security Considerations
None identified.
## Related changes
TODO:
* make an API for analyze and redact
* create an API that calls collect, redact, and analyze - and decide if that can be called by preflight and support-bundle
+120
View File
@@ -0,0 +1,120 @@
# Integrate SBCTL with Troubleshoot
## Goals
Make sbctl easier to maintain by consolidating code bases.
Reduce code duplication.
Improve end-user experience and improve discoverability of sbctl.
## Non Goals
## Background
sbctl is our command line tool for examining K8s resources inside of Support Bundles generated by our troubleshoot project. With both projects having separate code bases we see the following problems:
* Most users are familiar with the binaries from troubleshoot (support-bundle, preflight, etc.), but are unaware of the existince of sbctl because it's a separate project
* sbctl and troubleshoot are naturally coupled together due to sbctl's reliance on support bundles to operate. Them being in separate repos leads to duplication of code in both projects increasing maintenance burden.
## High-Level Design
Because the functionality of sbctl and Troubleshoot are so tightly coupled together, they should live in the same repository. Moreover, as opposed to maintaing a separate binary for sbctl, all sbctl commands should become subcommands of `support-bundle`
## Detailed Design
The `serve` and `shell` commands become subcommands of the `support-bundle` CLI.
```
./bin/support-bundle --help
A support bundle is an archive of files, output, metrics and state
from a server that can be used to assist when troubleshooting a Kubernetes cluster.
Usage:
support-bundle [url] [flags]
support-bundle [command]
Available Commands:
analyze analyze a support bundle
serve Start API server
shell Start interractive shell
completion Generate the autocompletion script for the specified shell
...
```
Similiar to the [Analyze](https://github.com/replicatedhq/troubleshoot/blob/main/cmd/troubleshoot/cli/analyze.go) subcommand, we add `serve.go` and `shell.go` to `cmd/troubleshoot/cli`
### Standardize Cluster Resources Collector
* In `pkg/collect` standardize the root directory location of the Cluster Resources collector with a variable instead of repeatedly specifying it as a string - https://github.com/replicatedhq/troubleshoot/blob/main/pkg/collect/cluster_resources.go#L121.
* Import the directory the Cluster Resources collector uses from `pkg/collect` for usage in the APIs - https://github.com/replicatedhq/sbctl/blob/main/pkg/api/server.go#L220. This is an example of the way we can start making the sbctl code more efficient with this change.
cluster_resources.go
```go
const ClusterResourcesPath = `cluster-resources`
...
path := filepath.Join(ClusterResourcesPath, "namespaces.json")
output.SaveResult(c.BundlePath, path, bytes.NewBuffer(namespaces))
```
sbctl-server.go
```go
import (
...
"github.com/replicatedhq/troubleshoot/pkg/collect"
...
)
...
dirName := filepath.Join(collect.ClusterResourcesPath, fmt.Sprintf("%s", resource))
```
### Package Structure
```
cmd
serve/
shell/
pkg
serve/
shell/
tests # API tests, integration tests etc reside here.
serve/ # sbctl BDD tests.
# all tests and test fixtures moved here
```
### Makefile Changes
We'll need to add make targets specific to these commands similar to the current ones
```
make serve run-serve
make shell run-shell
make ginkgo
```
### Docs
In troubleshoot.sh docs, add a new sub section under "Support Bundle" describing then new serve & shell subcommands.
### Other Changes
We would need to merge some of the support bundle functionality we see in both projects like so
- Create a new sbutil module to store reusable support bundle functionality. At least `analyze` & `serve` modules will depend on this module
```
pkg
sbutil/
```
- Merge `troubleshoot/pkg/analyze/download.ExtractTroubleshootBundle` & `sbctl/pkg/sbctl/support-bundle.ExtractBundle` that duplicate support bundle archive extraction
- Build on `sbctl/pkg/sbctl/support-bundle.ClusterData` to have it expose well known paths (ClusterResourcesDir, Version files, analysis results etc) and unmarshalled resources (this bit can be built on a need to have basis) in a support bundle especially once [Add generic kubernetes resource analyzer #780 PR](https://github.com/replicatedhq/troubleshoot/pull/780) is merged.
- Build on `sbctl/pkg/sbctl/support-bundle.FindClusterData` to perform pre-validation of a support bundle to ensure it is valid before running any applications.
## Limitations
## Assumptions
## Testing
We will need to have a separate directory for sbctl (ginkgo BDD) tests. The test harness used is ginkgo cli instead of go test and there is no straight forward way of separating these tests. Also, from a directory structure point of view, such integration tests usually reside in modules in a root level tests directory. Changes to the test code need to be minimal, ideally no change, cause they will be used to ensure any refactored code does not break. We could now easily introduce tests which ensure that changes to collectors don't break APIs in sbctl.
## Alternatives Considered
* Have troubleshoot as a library dependency in sbctl keeping it as a separate binary and repo
* Move sbctl to the Troubleshoot library "as is" and continue maintaing a separate binary
* Leave things as they are
## Security Considerations
+57
View File
@@ -0,0 +1,57 @@
## preflight
Run and retrieve preflight checks in a cluster
### Synopsis
A preflight check is a set of validations that can and should be run to ensure
that a cluster meets the requirements to run an application.
```
preflight [url] [flags]
```
### Options
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--collect-without-permissions always run preflight checks even if some require permissions that preflight does not have (default true)
--collector-image string the full name of the collector image to use
--collector-pullpolicy string the pull policy of the collector image
--context string The name of the kubeconfig context to use
--cpuprofile string File path to write cpu profiling data
--debug enable debug logging
--disable-compression If true, opt-out of response compression for all requests to the server
--dry-run print the preflight spec without running preflight checks
--format string output format, one of human, json, yaml. only used when interactive is set to false (default "human")
-h, --help help for preflight
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--interactive interactive preflights (default true)
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--memprofile string File path to write memory profiling data
-n, --namespace string If present, the namespace scope for this CLI request
-o, --output string specify the output file path for the preflight checks
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
--selector string selector (label query) to filter remote collection nodes on.
-s, --server string The address and port of the Kubernetes API server
--since string force pod logs collectors to return logs newer than a relative duration like 5s, 2m, or 3h.
--since-time string force pod logs collectors to return logs after a specific date (RFC3339)
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
-v, --v Level number for the log level verbosity
```
### SEE ALSO
* [preflight oci-fetch](preflight_oci-fetch.md) - Fetch a preflight from an OCI registry and print it to standard out
* [preflight version](preflight_version.md) - Print the current version and exit
###### Auto generated by spf13/cobra on 31-Aug-2023
+36
View File
@@ -0,0 +1,36 @@
## preflight oci-fetch
Fetch a preflight from an OCI registry and print it to standard out
```
preflight oci-fetch [URI] [flags]
```
### Options
```
-h, --help help for oci-fetch
```
### Options inherited from parent commands
```
--collect-without-permissions always run preflight checks even if some require permissions that preflight does not have (default true)
--collector-image string the full name of the collector image to use
--collector-pullpolicy string the pull policy of the collector image
--cpuprofile string File path to write cpu profiling data
--debug enable debug logging
--format string output format, one of human, json, yaml. only used when interactive is set to false (default "human")
--interactive interactive preflights (default true)
--memprofile string File path to write memory profiling data
-o, --output string specify the output file path for the preflight checks
--selector string selector (label query) to filter remote collection nodes on.
--since string force pod logs collectors to return logs newer than a relative duration like 5s, 2m, or 3h.
--since-time string force pod logs collectors to return logs after a specific date (RFC3339)
```
### SEE ALSO
* [preflight](preflight.md) - Run and retrieve preflight checks in a cluster
###### Auto generated by spf13/cobra on 31-Aug-2023
+40
View File
@@ -0,0 +1,40 @@
## preflight version
Print the current version and exit
### Synopsis
Print the current version and exit
```
preflight version [flags]
```
### Options
```
-h, --help help for version
```
### Options inherited from parent commands
```
--collect-without-permissions always run preflight checks even if some require permissions that preflight does not have (default true)
--collector-image string the full name of the collector image to use
--collector-pullpolicy string the pull policy of the collector image
--cpuprofile string File path to write cpu profiling data
--debug enable debug logging
--format string output format, one of human, json, yaml. only used when interactive is set to false (default "human")
--interactive interactive preflights (default true)
--memprofile string File path to write memory profiling data
-o, --output string specify the output file path for the preflight checks
--selector string selector (label query) to filter remote collection nodes on.
--since string force pod logs collectors to return logs newer than a relative duration like 5s, 2m, or 3h.
--since-time string force pod logs collectors to return logs after a specific date (RFC3339)
```
### SEE ALSO
* [preflight](preflight.md) - Run and retrieve preflight checks in a cluster
###### Auto generated by spf13/cobra on 31-Aug-2023
+58
View File
@@ -0,0 +1,58 @@
## support-bundle
Generate a support bundle
### Synopsis
A support bundle is an archive of files, output, metrics and state
from a server that can be used to assist when troubleshooting a Kubernetes cluster.
```
support-bundle [urls...] [flags]
```
### Options
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--collect-without-permissions always generate a support bundle, even if it some require additional permissions (default true)
--context string The name of the kubeconfig context to use
--cpuprofile string File path to write cpu profiling data
--debug enable debug logging. This is equivalent to --v=0
--disable-compression If true, opt-out of response compression for all requests to the server
-h, --help help for support-bundle
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--interactive enable/disable interactive mode (default true)
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--load-cluster-specs enable/disable loading additional troubleshoot specs found within the cluster. required when no specs are provided on the command line
--memprofile string File path to write memory profiling data
-n, --namespace string If present, the namespace scope for this CLI request
--no-uri When this flag is used, Troubleshoot does not attempt to retrieve the bundle referenced by the uri: field in the spec.`
-o, --output string specify the output file path for the support bundle
--redact enable/disable default redactions (default true)
--redactors strings names of the additional redactors to use
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-l, --selector strings selector to filter on for loading additional support bundle specs found in secrets within the cluster (default [troubleshoot.sh/kind=support-bundle])
-s, --server string The address and port of the Kubernetes API server
--since string force pod logs collectors to return logs newer than a relative duration like 5s, 2m, or 3h.
--since-time string force pod logs collectors to return logs after a specific date (RFC3339)
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
-v, --v Level number for the log level verbosity
```
### SEE ALSO
* [support-bundle analyze](support-bundle_analyze.md) - analyze a support bundle
* [support-bundle redact](support-bundle_redact.md) - Redact information from a generated support bundle archive
* [support-bundle version](support-bundle_version.md) - Print the current version and exit
###### Auto generated by spf13/cobra on 31-Aug-2023
+33
View File
@@ -0,0 +1,33 @@
## support-bundle analyze
analyze a support bundle
### Synopsis
Analyze a support bundle using the Analyzer definitions provided
```
support-bundle analyze [url] [flags]
```
### Options
```
--bundle string filename of the support bundle to analyze
-h, --help help for analyze
--output string output format: json, yaml
--quiet enable/disable error messaging and only show parseable output
```
### Options inherited from parent commands
```
--cpuprofile string File path to write cpu profiling data
--memprofile string File path to write memory profiling data
```
### SEE ALSO
* [support-bundle](support-bundle.md) - Generate a support bundle
###### Auto generated by spf13/cobra on 31-Aug-2023
+42
View File
@@ -0,0 +1,42 @@
## support-bundle redact
Redact information from a generated support bundle archive
### Synopsis
Redaction is the process of masking sensitive information from collected data in a support bundle.
This is done using rules defined in the list of redactor manifests provided in the [urls...] command line
argument. Default built in redactors will also be run, but these would have been run when the support
bundle was generated. After redaction, the support bundle is archived once more. The resulting file will
be stored in the current directory in the path provided by the --output flag.
The [urls...] argument is a list of either oci://.., http://.., https://.. or local paths to yaml files.
For more information on redactors visit https://troubleshoot.sh/docs/redact/
```
support-bundle redact [urls...] [flags]
```
### Options
```
--bundle string file path of the support bundle archive to redact
-h, --help help for redact
-o, --output string file path of where to save the redacted support bundle archive (default "redacted-support-bundle-YYYY-MM-DDTHH_MM_SS.tar.gz")
-q, --quiet enable/disable error messaging and only show parseable output
```
### Options inherited from parent commands
```
--cpuprofile string File path to write cpu profiling data
--memprofile string File path to write memory profiling data
```
### SEE ALSO
* [support-bundle](support-bundle.md) - Generate a support bundle
###### Auto generated by spf13/cobra on 31-Aug-2023
+30
View File
@@ -0,0 +1,30 @@
## support-bundle version
Print the current version and exit
### Synopsis
Print the current version and exit
```
support-bundle version [flags]
```
### Options
```
-h, --help help for version
```
### Options inherited from parent commands
```
--cpuprofile string File path to write cpu profiling data
--memprofile string File path to write memory profiling data
```
### SEE ALSO
* [support-bundle](support-bundle.md) - Generate a support bundle
###### Auto generated by spf13/cobra on 31-Aug-2023
@@ -1,9 +1,9 @@
apiVersion: troubleshoot.sh/v1beta2
kind: HostCollector
metadata:
name: modules
name: port
spec:
collectors:
- cpu: {}
- memory: {}
# - kernelModules: {}
- udpPortStatus:
collectorName: flannel
port: 8472
+9
View File
@@ -0,0 +1,9 @@
apiVersion: troubleshoot.sh/v1beta2
kind: HostCollector
metadata:
name: port
spec:
collectors:
- udpPortStatus:
collectorName: flannel
port: 8472
+25 -5
View File
@@ -7,10 +7,21 @@ spec:
- data:
name: config/replicas.txt
data: "5"
- run:
collectorName: "static-hi"
image: 'alpine:3.5'
command: ["echo", "hi static!"]
- runPod:
collectorName: "static-hi-1"
podSpec:
containers:
- name: static-hi
image: alpine:3
command: ["echo", "hi static!"]
## This collector is intentionally duplicated to test same pod should be terminated after success
- runPod:
collectorName: "static-hi-2"
podSpec:
containers:
- name: static-hi
image: alpine:3
command: ["echo", "hi static!"]
analyzers:
- clusterVersion:
outcomes:
@@ -44,7 +55,16 @@ spec:
message: You have at least 5 replicas
- textAnalyze:
checkName: Said hi!
fileName: /static-hi.log
fileName: /static-hi-1.log
regex: 'hi static'
outcomes:
- fail:
message: Didn't say hi.
- pass:
message: Said hi!
- textAnalyze:
checkName: Said hi!
fileName: /static-hi-2.log
regex: 'hi static'
outcomes:
- fail:
-1
View File
@@ -19,4 +19,3 @@ spec:
message: At least 16 CPU cores preferred
- pass:
message: This server has sufficient CPU cores
@@ -0,0 +1,19 @@
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
name: subnet-available
spec:
collectors:
# would output yes/no depending if there is a /22 available in 10.0.0.0/8
- subnetAvailable:
CIDRRangeAlloc: "10.0.0.0/8"
desiredCIDR: 22
analyzers:
- subnetAvailable:
outcomes:
- fail:
when: "no-subnet-available"
message: failed to find available subnet
- pass:
when: "a-subnet-is-available"
message: available /22 subnet found
@@ -21,6 +21,15 @@ spec:
rhel8:
- nfs-utils
- openssl
rhel9:
- nfs-utils
- openssl
rocky8:
- nfs-utils
- openssl
rocky9:
- nfs-utils
- openssl
centos:
- iscsi-initiator-utils
centos7:
@@ -28,6 +37,9 @@ spec:
centos8:
- nfs-utils
- openssl
centos9:
- nfs-utils
- openssl
ol:
- lvm2
ol7:
@@ -35,6 +47,8 @@ spec:
- openssl
ol8:
- nfs-utils
ol9:
- nfs-utils
amzn:
- libzstd
amzn2:
+24
View File
@@ -0,0 +1,24 @@
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
name: port
spec:
collectors:
- udpPortStatus:
collectorName: flannel
port: 8472
analyzers:
- udpPortStatus:
collectorName: flannel
outcomes:
- fail:
when: "address-in-use"
message: Another process was already listening on port 8472.
- fail:
when: "error"
message: Unexpected port status
- pass:
when: "connected"
message: Port 8472 is open
- warn:
message: Unexpected port status
+70
View File
@@ -0,0 +1,70 @@
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: sample
spec:
collectors:
- mssql:
collectorName: mssql
uri: sqlserver://SA:nac3lle-ch@stise-bOMBay-wag@db.lab.shortrib.net:1433/master
analyzers:
- mssql:
checkName: Must be SQLServer 15.x or later
collectorName: mssql
outcomes:
- fail:
when: "connected == false"
message: Cannot connect to SQLServer
- fail:
when: "version < 15.x"
message: The SQLServer must be at least version 15
- pass:
message: The SQLServer connection checks out
- mssql:
checkName: Must be SQLServer 14 or earlier
collectorName: mssql
outcomes:
- fail:
when: "connected == false"
message: Cannot connect to SQLServer
- fail:
when: "version > 14.x"
message: The SQLServer must be at most version 14
- pass:
message: The SQLServer connection checks out
- mssql:
checkName: Must be SQLServer 15.0.2000.1565
collectorName: mssql
outcomes:
- fail:
when: "connected == false"
message: Cannot connect to SQLServer
- fail:
when: "version == 15.0.2000.1565"
message: The SQLServer must be version 15.0.2000.1565
- pass:
message: The SQLServer connection checks out
- mssql:
checkName: Must not be SQLServer 15.0.2000.1565
collectorName: mssql
outcomes:
- fail:
when: "connected == false"
message: Cannot connect to SQLServer
- fail:
when: "version != 15.0.2000.1565"
message: The SQLServer must not be version 15.0.2000.1565
- pass:
message: The SQLServer connection checks out
- mssql:
checkName: I don't want to connect to your SQL Server
collectorName: mssql
outcomes:
- fail:
when: "connected == true"
message: Can connect to your SQL Server
- fail:
when: "version != 15.0.2000.1565"
message: The SQLServer must be version 15.0.2000.1565
- pass:
message: The SQLServer connection checks out
+39 -10
View File
@@ -16,20 +16,20 @@ spec:
- pass:
message: This cluster has enough nodes.
- nodeResources:
checkName: Must have 3 nodes with at least 6 cores
checkName: Must have 3 nodes with at least 6 cores each
filters:
cpuCapacity: "6"
outcomes:
- fail:
when: "< 3"
when: "count() < 3"
message: This application requires at least 3 nodes with 6 cores each
- pass:
message: This cluster has enough nodes with enough codes
message: This cluster has enough nodes with enough cores
- nodeResources:
checkName: Must have 1 node with 16 GB (available) memory and 5 cores (on a single node)
checkName: Must have 1 node with 16 GB (available) memory and 10 cores (on a single node)
filters:
allocatableMemory: 16Gi
cpuCapacity: "5"
cpuCapacity: "10"
outcomes:
- fail:
when: "< 1"
@@ -37,13 +37,32 @@ spec:
- pass:
message: This cluster has a node with enough memory.
- nodeResources:
checkName: There must be at least 3 nodes in the cluster
checkName: Must have 1 node with 16 GB (available) memory and 4 cores of amd64 arch (on a single node)
filters:
allocatableMemory: 16Gi
cpuArchitecture: amd64
cpuCapacity: "4"
outcomes:
- fail:
when: "count() < 3"
message: This application requires at least 3 nodes in the cluster
when: "< 1"
message: This application requires at least 1 node with amd64 arch and 16GB available memory
- pass:
message: This cluster haas sufficient nodes
message: This cluster has a node with the correct architecture and enough memory.
- nodeResources:
checkName: Must have 1 manager node with 16 GB (available) memory and 4 cores of amd64 arch
filters:
selector:
matchLabel:
node-role.kubernetes.io/master: ""
allocatableMemory: 16Gi
cpuArchitecture: amd64
cpuCapacity: "6"
outcomes:
- fail:
when: "< 1"
message: This application requires at least 1 manager node with amd64 arch, 16GB available memory, and the label `node-role.kubernetes.io/master=""`
- pass:
message: This cluster has a node with the correct architecture and enough memory.
- nodeResources:
checkName: There must be a total of at least 32Gi of memory on all nodes
outcomes:
@@ -51,4 +70,14 @@ spec:
when: "sum(memoryCapacity) < 32Gi"
message: This application requires that 32Gi or more memory be available to the cluster
- pass:
message: This cluster haas sufficient memory
message: This cluster has sufficient memory
- nodeResources:
checkName: There must be a total of at least 32Gi of memory on amd64 nodes
filters:
cpuArchitecture: amd64
outcomes:
- fail:
when: "sum(memoryCapacity) < 32Gi"
message: This application requires that 32Gi or more memory on amd64 nodes be available to the cluster
- pass:
message: This cluster has sufficient memory
-1
View File
@@ -20,4 +20,3 @@ spec:
message: The postgres server must be at least version 10
- pass:
message: The postgres connection checks out
+4 -3
View File
@@ -6,7 +6,9 @@ spec:
collectors:
- redis:
collectorName: my-redis
uri: rediss://default:password@hostname:6379
uri: rediss://default:replicated@server:6380
tls:
skipVerify: true
analyzers:
- redis:
checkName: Must be redis 5.x or later
@@ -14,10 +16,9 @@ spec:
outcomes:
- fail:
when: "connected == false"
message: Cannot connect to postgres server
message: Cannot connect to redis server
- fail:
when: "version < 5.0.0"
message: The redis server must be at least version 5
- pass:
message: The redis connection checks out
+24
View File
@@ -0,0 +1,24 @@
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
name: port
spec:
collectors:
- udpPortStatus:
collectorName: flannel
port: 8472
analyzers:
- udpPortStatus:
collectorName: flannel
outcomes:
- fail:
when: "address-in-use"
message: Another process was already listening on port 8472.
- fail:
when: "error"
message: Unexpected port status
- pass:
when: "connected"
message: Port 8472 is open
- warn:
message: Unexpected port status
+3 -3
View File
@@ -88,11 +88,11 @@ spec:
- 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
checkName: Every node in the cluster must have at least 8 GB of memory, with 32 GB recommended
outcomes:
- fail:
when: "min(memoryCapacity) < 10Gi"
message: All nodes must have at least 10 GB of memory.
when: "min(memoryCapacity) < 8Gi"
message: All nodes must have at least 8 GB of memory.
uri: https://kurl.sh/docs/install-with-kurl/system-requirements
- warn:
when: "min(memoryCapacity) < 32Gi"
+10
View File
@@ -0,0 +1,10 @@
apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: e2e-redactor
spec:
redactors:
- name: redact-static-text
removals:
values:
- static
+14
View File
@@ -0,0 +1,14 @@
## Parse troubleshoot specs from a helm chart
This is an example of using troubleshoot's `loader.LoadSpecs` API to load specs from rendered manifests in a helm chart. The chart in this example contains a kubernetes `Secret` & `ConfigMap` with troubleshoot specs, as well as a troubleshoot custom resource. The custom resource is behind a values flag and does not get rendered by default. The code adds this flag to ensure that the manifest is rendered so as to load it.
The manifests are rendered with the equivalent of `helm template --values values.yaml` where the output is a YAML multidoc. `loader.LoadSpecs` will take the YAML multidoc as an input and extract troubleshoot specs inside kuberenetes `Secrets` and `ConfigMap`s, and any troubleshoot custom resources found.
This application always uses the local version of troubleshoot so as to build using the latest version of the library. This ensures that the example is kept in sync with new features.
### Running
```go
go mod tidy # sync go modules
go run main.go # run the application. This should print out a YAML multidoc of the loaded troubleshoot specs
```
+73
View File
@@ -0,0 +1,73 @@
module helm-template
go 1.20
// Always use the local version of troubleshoot so as to build using
// the latest version of the library. This will ensure the example
// is kept in sync with new features
replace github.com/replicatedhq/troubleshoot v0.0.0 => ../../../
require (
github.com/replicatedhq/troubleshoot v0.0.0
helm.sh/helm/v3 v3.12.3
sigs.k8s.io/yaml v1.3.0
)
require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.28.2 // indirect
k8s.io/apiextensions-apiserver v0.28.1 // indirect
k8s.io/apimachinery v0.28.2 // indirect
k8s.io/client-go v0.28.2 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
sigs.k8s.io/controller-runtime v0.16.2 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)
+220
View File
@@ -0,0 +1,220 @@
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/emicklei/go-restful/v3 v3.10.2 h1:hIovbnmBTLjHXkqEBUz3HGpXZdM7ZrE9fJIZIqlJLqE=
github.com/emicklei/go-restful/v3 v3.10.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA=
github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4=
golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
helm.sh/helm/v3 v3.12.3 h1:5y1+Sbty12t48T/t/CGNYUIME5BJ0WKfmW/sobYqkFg=
helm.sh/helm/v3 v3.12.3/go.mod h1:KPKQiX9IP5HX7o5YnnhViMnNuKiL/lJBVQ47GHe1R0k=
k8s.io/api v0.28.2 h1:9mpl5mOb6vXZvqbQmankOfPIGiudghwCoLl1EYfUZbw=
k8s.io/api v0.28.2/go.mod h1:RVnJBsjU8tcMq7C3iaRSGMeaKt2TWEUXcpIt/90fjEg=
k8s.io/apiextensions-apiserver v0.28.1 h1:l2ThkBRjrWpw4f24uq0Da2HaEgqJZ7pcgiEUTKSmQZw=
k8s.io/apiextensions-apiserver v0.28.1/go.mod h1:sVvrI+P4vxh2YBBcm8n2ThjNyzU4BQGilCQ/JAY5kGs=
k8s.io/apimachinery v0.28.2 h1:KCOJLrc6gu+wV1BYgwik4AF4vXOlVJPdiqn0yAWWwXQ=
k8s.io/apimachinery v0.28.2/go.mod h1:RdzF87y/ngqk9H4z3EL2Rppv5jj95vGS/HaFXrLDApU=
k8s.io/client-go v0.28.2 h1:DNoYI1vGq0slMBN/SWKMZMw0Rq+0EQW6/AK4v9+3VeY=
k8s.io/client-go v0.28.2/go.mod h1:sMkApowspLuc7omj1FOSUxSoqjr+d5Q0Yc0LOFnYFJY=
k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg=
k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ=
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM=
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk=
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/controller-runtime v0.16.2 h1:mwXAVuEk3EQf478PQwQ48zGOXvW27UJc8NHktQVuIPU=
sigs.k8s.io/controller-runtime v0.16.2/go.mod h1:vpMu3LpI5sYWtujJOa2uPK61nB5rbwlN7BAB8aSLvGU=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=
sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
+115
View File
@@ -0,0 +1,115 @@
package main
import (
"context"
"fmt"
"log"
"strings"
tsloader "github.com/replicatedhq/troubleshoot/pkg/loader"
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/engine"
"sigs.k8s.io/yaml"
)
func main() {
// Load chart from tarball
// The helm loader package has a few other ways to load a chart, such as from a directory `loader.LoadDir()`
// or from an archive in memory `loader.LoadArchive()` etc.
chart, err := loader.LoadFile("mychart-0.1.0.tgz")
if err != nil {
log.Fatalf("error loading at chart: %v", err)
}
// Render chart to manifests. Equivalent to `helm template --values values.yaml`
renderedManifests, err := renderChartToManifests(chart, chartutil.Values{
"preflight": true,
"includeTroubleshootCRs": true,
})
if err != nil {
log.Fatalf("error rendering chart: %v", err)
}
fmt.Println("############# Raw helm manifests #############")
fmt.Println(renderedManifests)
// Load rendered manifests into a slice of troubleshoot specs
// 'tsKinds' will contain all the specs. This object will the the
// input of other troubleshoot APIs such as ones used to collect
// bundles, analyze bundles, redact etc.
ctx := context.Background()
tsKinds, err := tsloader.LoadSpecs(ctx, tsloader.LoadOptions{
RawSpec: renderedManifests,
})
if err != nil {
log.Fatalf("error loading troubleshoot specs: %v", err)
}
// Ensure we have the correct number of specs
if len(tsKinds.PreflightsV1Beta2) != 1 {
log.Fatalf("expected 1 preflight, got %d", len(tsKinds.PreflightsV1Beta2))
}
if len(tsKinds.SupportBundlesV1Beta2) != 1 {
log.Fatalf("expected 1 supportbundle, got %d", len(tsKinds.SupportBundlesV1Beta2))
}
if len(tsKinds.RedactorsV1Beta2) != 1 {
log.Fatalf("expected 1 redactor, got %d", len(tsKinds.RedactorsV1Beta2))
}
// Print the specs as yaml
fmt.Println("---\n############# Support bundle #############")
printSpecAsYaml(tsKinds.SupportBundlesV1Beta2[0])
fmt.Println("---\n############# Preflight #############")
printSpecAsYaml(tsKinds.PreflightsV1Beta2[0])
fmt.Println("---\n############# Redactor #############")
printSpecAsYaml(tsKinds.RedactorsV1Beta2[0])
}
func renderChartToManifests(chart *chart.Chart, inputValues chartutil.Values) (string, error) {
options := chartutil.ReleaseOptions{
Name: "my-release", // Not mandatory, but this is how helm sets the release name
}
// Pull in imported values from dependencies to the parent chart
// https://helm.sh/docs/topics/charts/#importing-child-values-via-dependencies
if err := chartutil.ProcessDependencies(chart, chartutil.Values{}); err != nil {
return "", fmt.Errorf("failed to process chart %q dependencies: %w", chart.Name(), err)
}
// Gather all values necessary to render the templates
// imported values, values from the chart and user provided values
rValues, err := chartutil.ToRenderValues(chart, inputValues, options, nil)
if err != nil {
return "", fmt.Errorf("failed to render template values: %w", err)
}
// Render the chart templates. This will include non YAML files as well
renderedTemplates, err := engine.Render(chart, rValues)
if err != nil {
return "", fmt.Errorf("failed to render template: %w", err)
}
// Combine all rendered templates into a single yaml multidoc string
// Only pick up YAML files, ignore any others. Troubleshoot loader
// expects only valid YAML input
var out strings.Builder
for k, v := range renderedTemplates {
if strings.HasSuffix(k, ".yaml") || strings.HasSuffix(k, ".yml") {
// Add the multidoc split marker
out.WriteString(fmt.Sprintf("---\n# Source: %s\n%s\n", k, v))
}
}
return out.String(), nil
}
func printSpecAsYaml(v any) {
b, err := yaml.Marshal(v)
if err != nil {
log.Fatalf("error marshalling troubleshoot specs: %v", err)
}
fmt.Println(string(b))
}
Binary file not shown.
@@ -1,7 +1,7 @@
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: mysql
name: dbs-collector
spec:
collectors:
- mysql:
@@ -15,3 +15,6 @@ spec:
- innodb_large_prefix
- innodb_strict_mode
- log_bin_trust_function_creators
- redis:
collectorName: my-redis
uri: rediss://default:replicated@server:6380
+103
View File
@@ -0,0 +1,103 @@
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: example
spec:
collectors:
- clusterInfo: {}
- clusterResources: {}
- data:
name: config/replicas.txt
data: "5"
- runPod:
collectorName: "static-hi"
podSpec:
containers:
- name: static-hi
image: alpine:3
command: ["echo", "hi static!"]
analyzers:
- clusterVersion:
outcomes:
- fail:
when: "< 1.20.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.21.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.22.0"
message: Your cluster meets the recommended and required versions of Kubernetes.
- distribution:
outcomes:
- pass:
when: "== k3s"
message: K3S is a supported distribution
- warn:
message: Unable to determine the distribution of Kubernetes
- textAnalyze:
checkName: Replica Count
fileName: config/replicas.txt
regexGroups: '(?P<Replicas>\d+)'
outcomes:
- fail:
when: "Replicas < 5"
message: That's not enough replicas!
- pass:
message: You have at least 5 replicas
- textAnalyze:
checkName: Said hi!
fileName: /static-hi.log
regex: 'hi static'
outcomes:
- fail:
message: Didn't say hi.
- pass:
message: Said hi!
- nodeResources:
checkName: Must be exactly 1 node in the cluster
outcomes:
- pass:
when: "= 1"
message: This cluster has exactly 1 node
- fail:
message: This application requires exactly 1 node
- nodeResources:
checkName: Must have 1 node with at least 2 cores
filters:
cpuCapacity: "2"
outcomes:
- pass:
when: "= 1"
message: This cluster has exactly 1 node with at least 2 cores
- fail:
message: This application requires exactly 1 node with at least 2 cores
- nodeResources:
checkName: Must have 1 node with 2Gi (available) memory and at least 2 cores (on a single node)
filters:
allocatableMemory: 2Gi
cpuCapacity: "2"
outcomes:
- pass:
when: "= 1"
message: This cluster has exactly 1 node with at least 2Gi available memory and 2 cores
- fail:
message: This application requires exactly 1 node with at least 2Gi available memory and 2 cores
- nodeResources:
checkName: There must be exactly 1 node in the cluster
outcomes:
- pass:
when: "count() = 1"
message: This has exactly 1 node in the cluster
- fail:
message: This application requires exactly 1 node in the cluster
- nodeResources:
checkName: There must be a total of at least 2Gi of memory on all nodes
outcomes:
- fail:
when: "sum(memoryCapacity) < 2Gi"
message: This application requires that 2Gi or more memory be available to the cluster
- pass:
message: This cluster has sufficient memory
@@ -3,6 +3,8 @@ kind: SupportBundle
metadata:
name: example
spec:
hostCollectors:
- hostOS: {}
collectors:
- logs:
selector:
@@ -12,6 +14,17 @@ spec:
limits:
maxAge: 720h # 30*24
maxLines: 10000
maxBytes: 5000000
- logs:
collectorName: all-logs
name: all-logs
- runPod:
collectorName: "static-hi"
podSpec:
containers:
- name: static-hi
image: alpine:3
command: ["echo", "hi static!"]
analyzers:
- clusterVersion:
outcomes:
@@ -30,6 +43,7 @@ spec:
outcomes:
- fail:
message: The Rook CRD was not found in the cluster.
uri: https://kurl.sh/docs/add-ons/rook/some/path/that/does/not/exist/for/the/sake/of/having/a/very/long/url.md
- pass:
message: Rook is installed and available.
- containerRuntime:
@@ -99,3 +113,12 @@ spec:
message: The API deployment has only a single ready replica.
- pass:
message: There are multiple replicas of the API deployment ready.
- textAnalyze:
checkName: Said hi!
fileName: /static-hi.log
regex: 'hi static'
outcomes:
- fail:
message: Didn't say hi.
- pass:
message: Said hi!
+179 -134
View File
@@ -1,148 +1,195 @@
module github.com/replicatedhq/troubleshoot
go 1.19
go 1.20
require (
github.com/ahmetalpbalkan/go-cursor v0.0.0-20131010032410-8136607ea412
github.com/blang/semver v3.5.1+incompatible
github.com/containers/image/v5 v5.19.3
github.com/docker/distribution v2.8.1+incompatible
github.com/fatih/color v1.13.0
github.com/go-logr/logr v1.2.3
github.com/apparentlymart/go-cidr v1.1.0
github.com/blang/semver/v4 v4.0.0
github.com/containers/image/v5 v5.25.0
github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2
github.com/fatih/color v1.15.0
github.com/go-logr/logr v1.2.4
github.com/go-redis/redis/v7 v7.4.1
github.com/go-sql-driver/mysql v1.6.0
github.com/go-sql-driver/mysql v1.7.1
github.com/gobwas/glob v0.2.3
github.com/godbus/dbus v4.1.0+incompatible
github.com/godbus/dbus/v5 v5.1.0
github.com/google/gofuzz v1.2.0
github.com/google/uuid v1.3.0
github.com/google/uuid v1.3.1
github.com/gorilla/handlers v1.5.1
github.com/hashicorp/go-getter v1.6.2
github.com/hashicorp/go-getter v1.7.2
github.com/hashicorp/go-multierror v1.1.1
github.com/lib/pq v1.10.7
github.com/jackc/pgx/v5 v5.4.3
github.com/longhorn/go-iscsi-helper v0.0.0-20210330030558-49a327fb024e
github.com/manifoldco/promptui v0.9.0
github.com/mattn/go-isatty v0.0.16
github.com/mattn/go-isatty v0.0.19
github.com/mholt/archiver/v3 v3.5.1
github.com/opencontainers/image-spec v1.0.3-0.20211202193544-a5463b7f9c84
github.com/microsoft/go-mssqldb v1.6.0
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b
github.com/pkg/errors v0.9.1
github.com/replicatedhq/termui/v3 v3.1.1-0.20200811145416-f40076d26851
github.com/segmentio/ksuid v1.0.4
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.5.0
github.com/shirou/gopsutil/v3 v3.23.9
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.13.0
github.com/stretchr/testify v1.8.0
github.com/spf13/viper v1.17.0
github.com/stretchr/testify v1.8.4
github.com/tj/go-spin v1.1.0
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel/sdk v1.19.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/sync v0.4.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.25.2
k8s.io/apiextensions-apiserver v0.25.0
k8s.io/apimachinery v0.25.2
k8s.io/apiserver v0.25.2
k8s.io/cli-runtime v0.25.2
k8s.io/client-go v0.25.2
k8s.io/klog/v2 v2.80.1
oras.land/oras-go v1.2.0
sigs.k8s.io/controller-runtime v0.13.0
k8s.io/api v0.28.2
k8s.io/apiextensions-apiserver v0.28.1
k8s.io/apimachinery v0.28.2
k8s.io/apiserver v0.28.1
k8s.io/cli-runtime v0.28.2
k8s.io/client-go v0.28.2
k8s.io/klog/v2 v2.100.1
oras.land/oras-go v1.2.3
sigs.k8s.io/controller-runtime v0.16.2
sigs.k8s.io/e2e-framework v0.3.0
)
require (
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/go-gorp/gorp/v3 v3.0.5 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mistifyio/go-zfs/v3 v3.0.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/onsi/ginkgo v1.14.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/rubenv/sql-migrate v1.3.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/sylabs/sif/v2 v2.11.1 // indirect
github.com/tchap/go-patricia/v2 v2.3.1 // indirect
github.com/vladimirvivien/gexe v0.2.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
k8s.io/component-base v0.28.1 // indirect
k8s.io/kubectl v0.28.1 // indirect
)
require (
cloud.google.com/go v0.100.2 // indirect
cloud.google.com/go/compute v1.6.1 // indirect
cloud.google.com/go/iam v0.3.0 // indirect
cloud.google.com/go/storage v1.14.0 // indirect
cloud.google.com/go v0.110.7 // indirect
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/iam v1.1.1 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/BurntSushi/toml v1.0.0 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/Microsoft/hcsshim v0.9.3 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Microsoft/hcsshim v0.10.0-rc.7 // indirect
github.com/andybalholm/brotli v1.0.1 // indirect
github.com/aws/aws-sdk-go v1.43.16 // indirect
github.com/aws/aws-sdk-go v1.44.198 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/c9s/goprocinfo v0.0.0-20170724085704-0010a05ce49f // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/chzyer/logex v1.1.11-0.20160617073814-96a4d311aa9b // indirect
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/containerd/cgroups v1.0.3 // indirect
github.com/containerd/containerd v1.6.6 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.11.0 // indirect
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b // indirect
github.com/containers/ocicrypt v1.1.4 // indirect
github.com/containers/storage v1.38.3 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/cli v20.10.17+incompatible // indirect
github.com/docker/docker v20.10.17+incompatible // indirect
github.com/docker/docker-credential-helpers v0.6.4 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/containerd/containerd v1.7.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 // indirect
github.com/containers/ocicrypt v1.1.7 // indirect
github.com/containers/storage v1.46.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/docker/cli v23.0.1+incompatible // indirect
github.com/docker/docker v23.0.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-intervals v0.0.2 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.14.2 // indirect
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/klauspost/pgzip v1.2.6-0.20220930104621-17e8dac29df8 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-shellwords v1.0.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/sys/mountinfo v0.5.0 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
@@ -151,60 +198,58 @@ require (
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d // indirect
github.com/nwaples/rardecode v1.1.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/runc v1.1.3 // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
github.com/opencontainers/selinux v1.10.1 // indirect
github.com/ostreedev/ostree-go v0.0.0-20190702140239-759a8c1ac913 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/opencontainers/runc v1.1.5 // indirect
github.com/opencontainers/runtime-spec v1.1.0-rc.1 // indirect
github.com/opencontainers/selinux v1.11.0 // indirect
github.com/ostreedev/ostree-go v0.0.0-20210805093236-719684c64e4f // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pierrec/lz4/v4 v4.1.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.12.2 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/sylabs/sif/v2 v2.3.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/tchap/go-patricia v2.3.0+incompatible // indirect
github.com/tklauser/go-sysconf v0.3.9 // indirect
github.com/tklauser/numcpus v0.3.0 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/vbatts/tar-split v0.11.2 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opencensus.io v0.23.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
google.golang.org/api v0.81.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.opencensus.io v0.24.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0
golang.org/x/time v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.143.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/grpc v1.58.3 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
periph.io/x/host/v3 v3.7.2
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/kustomize/api v0.12.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect
helm.sh/helm/v3 v3.12.3
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/metrics v0.28.2
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
periph.io/x/host/v3 v3.8.2
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/yaml v1.3.0
)
replace (
+702 -853
View File
File diff suppressed because it is too large Load Diff
+46
View File
@@ -0,0 +1,46 @@
package specs
import (
"context"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
)
func LoadFromConfigMap(ctx context.Context, client kubernetes.Interface, ns string, name string) (map[string]string, error) {
foundConfigMap, err := client.CoreV1().ConfigMaps(ns).Get(ctx, name, metav1.GetOptions{})
if err != nil {
return nil, errors.Wrap(err, "failed to get configmap")
}
klog.V(1).InfoS("Loaded data from config map", "name",
foundConfigMap.Name, "namespace", foundConfigMap.Namespace,
)
return foundConfigMap.Data, nil
}
func LoadFromConfigMapMatchingLabel(ctx context.Context, client kubernetes.Interface, label string, ns string, key string) ([]string, error) {
var configMapMatchingKey []string
configMaps, err := client.CoreV1().ConfigMaps(ns).List(ctx, metav1.ListOptions{LabelSelector: label})
if err != nil {
return nil, errors.Wrap(err, "failed to search for configmaps in the cluster")
}
for _, configMap := range configMaps.Items {
spec, ok := configMap.Data[key]
if !ok {
continue
}
klog.V(1).InfoS("Loaded spec from config map", "name", configMap.Name,
"namespace", configMap.Namespace, "data key", key, "label selector", label,
)
configMapMatchingKey = append(configMapMatchingKey, string(spec))
}
return configMapMatchingKey, nil
}
+561
View File
@@ -0,0 +1,561 @@
package specs
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
testclient "k8s.io/client-go/kubernetes/fake"
)
func Test_LoadFromConfigMapMatchingLabel(t *testing.T) {
tests := []struct {
name string
supportBundleConfigMaps []corev1.ConfigMap
want []string
wantErr bool
}{
{
name: "support bundle configmap with matching label and key",
supportBundleConfigMaps: []corev1.ConfigMap{
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string]string{
"support-bundle-spec": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: test
spec:
collectors:
- runPod:
name: "run-ping"
namespace: default
podSpec:
containers:
- name: run-ping
image: busybox:1
command: ["ping"]
args: ["-w", "5", "www.google.com"]`,
},
},
},
want: []string{
`apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: test
spec:
collectors:
- runPod:
name: "run-ping"
namespace: default
podSpec:
containers:
- name: run-ping
image: busybox:1
command: ["ping"]
args: ["-w", "5", "www.google.com"]`,
},
},
{
name: "mutlidoc support bundle secret with matching label and key",
supportBundleConfigMaps: []corev1.ConfigMap{
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string]string{
"support-bundle-spec": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: test
spec:
collectors:
- runPod:
name: "run-ping"
namespace: default
podSpec:
containers:
- name: run-ping
image: busybox:1
command: ["ping"]
args: ["-w", "5", "www.google.com"]
---
apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: Usernames
spec:
redactors:
- name: Redact usernames in multiline JSON
removals:
regex:
- selector: '(?i)"name": *".*user[^\"]*"'
redactor: '(?i)("value": *")(?P<mask>.*[^\"]*)(")'`,
},
},
},
want: []string{
`apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: test
spec:
collectors:
- runPod:
name: "run-ping"
namespace: default
podSpec:
containers:
- name: run-ping
image: busybox:1
command: ["ping"]
args: ["-w", "5", "www.google.com"]
---
apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: Usernames
spec:
redactors:
- name: Redact usernames in multiline JSON
removals:
regex:
- selector: '(?i)"name": *".*user[^\"]*"'
redactor: '(?i)("value": *")(?P<mask>.*[^\"]*)(")'`,
},
},
{
name: "support bundle configmap with missing label",
supportBundleConfigMaps: []corev1.ConfigMap{
{
ObjectMeta: metav1.ObjectMeta{
Name: "configap",
Namespace: "default",
},
Data: map[string]string{
"support-bundle-spec": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: test
spec:
collectors:
- data:
name: static/data.txt
data: |
static data`,
},
},
},
want: []string(nil),
},
{
name: "support bundle configmap with matching label but wrong key",
supportBundleConfigMaps: []corev1.ConfigMap{
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap",
Namespace: "default",
},
Data: map[string]string{
"support-bundle-specc": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: test
spec:
collectors:
- data:
name: static/data.txt
data: |
static data`,
},
},
},
want: []string(nil),
},
{
name: "multiple support bundle configmaps in the same namespace with matching label and key",
supportBundleConfigMaps: []corev1.ConfigMap{
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string]string{
"support-bundle-spec": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: cluster-info
spec:
collectors:
- clusterInfo: {}`,
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap-2",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string]string{
"support-bundle-spec": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: cluster-resources
spec:
collectors:
- clusterResources: {}`,
},
},
},
want: []string{
`apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: cluster-info
spec:
collectors:
- clusterInfo: {}`,
`apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: cluster-resources
spec:
collectors:
- clusterResources: {}`,
},
},
{
name: "multiple support bundle configmaps in different namespaces with matching label and key",
supportBundleConfigMaps: []corev1.ConfigMap{
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap",
Namespace: "some-namespace",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string]string{
"support-bundle-spec": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: cluster-info
spec:
collectors:
- clusterInfo: {}`,
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap-2",
Namespace: "some-namespace-2",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string]string{
"support-bundle-spec": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: cluster-resources
spec:
collectors:
- clusterResources: {}`,
},
},
},
want: []string{
`apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: cluster-info
spec:
collectors:
- clusterInfo: {}`,
`apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: cluster-resources
spec:
collectors:
- clusterResources: {}`,
},
},
{
name: "multiple support bundle configmaps in different namespaces but only one with correct label and key",
supportBundleConfigMaps: []corev1.ConfigMap{
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap",
Namespace: "some-namespace",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle-wrong",
},
},
Data: map[string]string{
"support-bundle-spec-wrong": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: cluster-info
spec:
collectors:
- clusterInfo: {}`,
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap-2",
Namespace: "some-namespace-2",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string]string{
"support-bundle-spec": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: cluster-resources
spec:
collectors:
- clusterResources: {}`,
},
},
},
want: []string{
`apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: cluster-resources
spec:
collectors:
- clusterResources: {}`,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctx := context.Background()
client := testclient.NewSimpleClientset()
for _, configmap := range tt.supportBundleConfigMaps {
_, err := client.CoreV1().ConfigMaps(configmap.Namespace).Create(ctx, &configmap, metav1.CreateOptions{})
require.NoError(t, err)
}
got, err := LoadFromConfigMapMatchingLabel(ctx, client, "troubleshoot.io/kind=support-bundle", "", "support-bundle-spec")
if tt.wantErr {
assert.Error(t, err)
} else {
require.NoError(t, err)
assert.Equal(t, tt.want, got)
}
})
}
}
func TestUserProvidedNamespace_LoadFromConfigMapMatchingLabel(t *testing.T) {
tests := []struct {
name string
supportBundleConfigMaps []corev1.ConfigMap
want []string
wantErr bool
}{
{
name: "support bundle configmap with matching label and key in user provided namespace",
supportBundleConfigMaps: []corev1.ConfigMap{
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap",
Namespace: "some-namespace",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string]string{
"support-bundle-spec": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: test
spec:
collectors:
- data:
name: static/data.txt
data: |
static data`,
},
},
},
want: []string{
`apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: test
spec:
collectors:
- data:
name: static/data.txt
data: |
static data`,
},
},
{
name: "support bundle configmap with matching label and key outside of user provided namespace",
supportBundleConfigMaps: []corev1.ConfigMap{
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap",
Namespace: "not-your-namespace",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string]string{
"support-bundle-spec": `apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: test
spec:
collectors:
- data:
name: static/data.txt
data: |
static data`,
},
},
},
want: []string(nil),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctx := context.Background()
client := testclient.NewSimpleClientset()
for _, configmap := range tt.supportBundleConfigMaps {
_, err := client.CoreV1().ConfigMaps(configmap.Namespace).Create(ctx, &configmap, metav1.CreateOptions{})
require.NoError(t, err)
}
got, err := LoadFromConfigMapMatchingLabel(ctx, client, "troubleshoot.io/kind=support-bundle", "some-namespace", "support-bundle-spec")
if tt.wantErr {
assert.Error(t, err)
} else {
require.NoError(t, err)
assert.Equal(t, tt.want, got)
}
})
}
}
func TestRedactors_LoadFromConfigMapMatchingLabel(t *testing.T) {
tests := []struct {
name string
supportBundleConfigMaps []corev1.ConfigMap
want []string
wantErr bool
}{
{
name: "redactor configmap with matching label and key",
supportBundleConfigMaps: []corev1.ConfigMap{
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string]string{
"redactor-spec": `apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: redact-some-content
spec:
redactors:
- name: replace some-content
fileSelector:
file: result.json
removals:
values:
- some-content`,
},
},
},
want: []string{
`apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: redact-some-content
spec:
redactors:
- name: replace some-content
fileSelector:
file: result.json
removals:
values:
- some-content`,
},
},
{
name: "redactor configmap with matching label but wrong key",
supportBundleConfigMaps: []corev1.ConfigMap{
{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string]string{
"redactor-spec-wrong": `apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: redact-some-content
spec:
redactors:
- name: replace some-content
fileSelector:
file: result.json
removals:
values:
- some-content`,
},
},
},
want: []string(nil),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctx := context.Background()
client := testclient.NewSimpleClientset()
for _, configmap := range tt.supportBundleConfigMaps {
_, err := client.CoreV1().ConfigMaps(configmap.Namespace).Create(ctx, &configmap, metav1.CreateOptions{})
require.NoError(t, err)
}
got, err := LoadFromConfigMapMatchingLabel(ctx, client, "troubleshoot.io/kind=support-bundle", "", "redactor-spec")
if tt.wantErr {
assert.Error(t, err)
} else {
require.NoError(t, err)
assert.Equal(t, tt.want, got)
}
})
}
}
+42
View File
@@ -0,0 +1,42 @@
package specs
import (
"context"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
)
func LoadFromSecret(ctx context.Context, client kubernetes.Interface, ns string, name string) (map[string][]byte, error) {
foundSecret, err := client.CoreV1().Secrets(ns).Get(ctx, name, metav1.GetOptions{})
if err != nil {
return nil, errors.Wrap(err, "failed to get secret")
}
return foundSecret.Data, nil
}
func LoadFromSecretMatchingLabel(ctx context.Context, client kubernetes.Interface, label string, ns string, key string) ([]string, error) {
var secretsMatchingKey []string
secrets, err := client.CoreV1().Secrets(ns).List(ctx, metav1.ListOptions{LabelSelector: label})
if err != nil {
return nil, errors.Wrap(err, "failed to search for secrets in the cluster")
}
for _, secret := range secrets.Items {
spec, ok := secret.Data[key]
if !ok {
continue
}
klog.V(1).InfoS("Loaded spec from secret", "name", secret.Name,
"namespace", secret.Namespace, "data key", key, "label selector", label,
)
secretsMatchingKey = append(secretsMatchingKey, string(spec))
}
return secretsMatchingKey, nil
}
@@ -8,15 +8,10 @@ import (
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
testclient "k8s.io/client-go/kubernetes/fake"
)
func Test_LoadFromSecretMatchingLabel(t *testing.T) {
type args struct {
ctx context.Context
client kubernetes.Interface
}
tests := []struct {
name string
supportBundleSecrets []corev1.Secret
@@ -31,7 +26,7 @@ func Test_LoadFromSecretMatchingLabel(t *testing.T) {
Name: "secret",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "supportbundle-spec",
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string][]byte{
@@ -44,7 +39,7 @@ spec:
- runPod:
name: "run-ping"
namespace: default
podSpec:
podSpec:
containers:
- name: run-ping
image: busybox:1
@@ -63,7 +58,7 @@ spec:
- runPod:
name: "run-ping"
namespace: default
podSpec:
podSpec:
containers:
- name: run-ping
image: busybox:1
@@ -71,6 +66,78 @@ spec:
args: ["-w", "5", "www.google.com"]`,
},
},
{
name: "mutlidoc support bundle secret with matching label and key",
supportBundleSecrets: []corev1.Secret{
{
ObjectMeta: metav1.ObjectMeta{
Name: "secret",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string][]byte{
"support-bundle-spec": []byte(`apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: test
spec:
collectors:
- runPod:
name: "run-ping"
namespace: default
podSpec:
containers:
- name: run-ping
image: busybox:1
command: ["ping"]
args: ["-w", "5", "www.google.com"]
---
apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: Usernames
spec:
redactors:
- name: Redact usernames in multiline JSON
removals:
regex:
- selector: '(?i)"name": *".*user[^\"]*"'
redactor: '(?i)("value": *")(?P<mask>.*[^\"]*)(")'`),
},
},
},
want: []string{
`apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: test
spec:
collectors:
- runPod:
name: "run-ping"
namespace: default
podSpec:
containers:
- name: run-ping
image: busybox:1
command: ["ping"]
args: ["-w", "5", "www.google.com"]
---
apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: Usernames
spec:
redactors:
- name: Redact usernames in multiline JSON
removals:
regex:
- selector: '(?i)"name": *".*user[^\"]*"'
redactor: '(?i)("value": *")(?P<mask>.*[^\"]*)(")'`,
},
},
{
name: "support bundle secret with missing label",
supportBundleSecrets: []corev1.Secret{
@@ -127,7 +194,7 @@ spec:
Name: "secret",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "supportbundle-spec",
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string][]byte{
@@ -145,7 +212,7 @@ spec:
Name: "secret-2",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "supportbundle-spec",
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string][]byte{
@@ -184,7 +251,7 @@ spec:
Name: "secret",
Namespace: "some-namespace",
Labels: map[string]string{
"troubleshoot.io/kind": "supportbundle-spec",
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string][]byte{
@@ -202,7 +269,7 @@ spec:
Name: "secret-2",
Namespace: "some-namespace-2",
Labels: map[string]string{
"troubleshoot.io/kind": "supportbundle-spec",
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string][]byte{
@@ -241,7 +308,7 @@ spec:
Name: "secret",
Namespace: "some-namespace",
Labels: map[string]string{
"troubleshoot.io/kind": "supportbundle-spec-wrong",
"troubleshoot.io/kind": "support-bundle-wrong",
},
},
Data: map[string][]byte{
@@ -259,7 +326,7 @@ spec:
Name: "secret-2",
Namespace: "some-namespace-2",
Labels: map[string]string{
"troubleshoot.io/kind": "supportbundle-spec",
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string][]byte{
@@ -292,7 +359,7 @@ spec:
_, err := client.CoreV1().Secrets(secret.Namespace).Create(ctx, &secret, metav1.CreateOptions{})
require.NoError(t, err)
}
got, err := LoadFromSecretMatchingLabel(client, "troubleshoot.io/kind=supportbundle-spec", "", "support-bundle-spec")
got, err := LoadFromSecretMatchingLabel(ctx, client, "troubleshoot.io/kind=support-bundle", "", "support-bundle-spec")
if tt.wantErr {
assert.Error(t, err)
} else {
@@ -304,10 +371,6 @@ spec:
}
func TestUserProvidedNamespace_LoadFromSecretMatchingLabel(t *testing.T) {
type args struct {
ctx context.Context
client kubernetes.Interface
}
tests := []struct {
name string
supportBundleSecrets []corev1.Secret
@@ -322,7 +385,7 @@ func TestUserProvidedNamespace_LoadFromSecretMatchingLabel(t *testing.T) {
Name: "secret",
Namespace: "some-namespace",
Labels: map[string]string{
"troubleshoot.io/kind": "supportbundle-spec",
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string][]byte{
@@ -360,7 +423,7 @@ spec:
Name: "secret",
Namespace: "not-your-namespace",
Labels: map[string]string{
"troubleshoot.io/kind": "supportbundle-spec",
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string][]byte{
@@ -388,7 +451,105 @@ spec:
_, err := client.CoreV1().Secrets(secret.Namespace).Create(ctx, &secret, metav1.CreateOptions{})
require.NoError(t, err)
}
got, err := LoadFromSecretMatchingLabel(client, "troubleshoot.io/kind=supportbundle-spec", "some-namespace", "support-bundle-spec")
got, err := LoadFromSecretMatchingLabel(ctx, client, "troubleshoot.io/kind=support-bundle", "some-namespace", "support-bundle-spec")
if tt.wantErr {
assert.Error(t, err)
} else {
require.NoError(t, err)
assert.Equal(t, tt.want, got)
}
})
}
}
func TestRedactors_LoadFromSecretMatchingLabel(t *testing.T) {
tests := []struct {
name string
supportBundleSecrets []corev1.Secret
want []string
wantErr bool
}{
{
name: "redactor secret with matching label and key",
supportBundleSecrets: []corev1.Secret{
{
ObjectMeta: metav1.ObjectMeta{
Name: "secret",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string][]byte{
"redactor-spec": []byte(`apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: redact-some-content
spec:
redactors:
- name: replace some-content
fileSelector:
file: result.json
removals:
values:
- some-content`),
},
},
},
want: []string{
`apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: redact-some-content
spec:
redactors:
- name: replace some-content
fileSelector:
file: result.json
removals:
values:
- some-content`,
},
},
{
name: "redactor secret with matching label but wrong key",
supportBundleSecrets: []corev1.Secret{
{
ObjectMeta: metav1.ObjectMeta{
Name: "secret",
Namespace: "default",
Labels: map[string]string{
"troubleshoot.io/kind": "support-bundle",
},
},
Data: map[string][]byte{
"redactor-spec-wrong": []byte(`apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: redact-some-content
spec:
redactors:
- name: replace some-content
fileSelector:
file: result.json
removals:
values:
- some-content`),
},
},
},
want: []string(nil),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctx := context.Background()
client := testclient.NewSimpleClientset()
for _, secret := range tt.supportBundleSecrets {
_, err := client.CoreV1().Secrets(secret.Namespace).Create(ctx, &secret, metav1.CreateOptions{})
require.NoError(t, err)
}
got, err := LoadFromSecretMatchingLabel(ctx, client, "troubleshoot.io/kind=support-bundle", "", "redactor-spec")
if tt.wantErr {
assert.Error(t, err)
} else {
+342
View File
@@ -0,0 +1,342 @@
package specs
import (
"context"
"fmt"
"io"
"net/http"
"net/url"
"os"
"reflect"
"strings"
"time"
"github.com/pkg/errors"
"github.com/replicatedhq/troubleshoot/internal/util"
"github.com/replicatedhq/troubleshoot/pkg/constants"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
"github.com/replicatedhq/troubleshoot/pkg/loader"
"github.com/replicatedhq/troubleshoot/pkg/oci"
"github.com/replicatedhq/troubleshoot/pkg/types"
"github.com/spf13/viper"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
)
// SplitTroubleshootSecretLabelSelector splits a label selector into two selectors, if applicable:
// 1. troubleshoot.io/kind=support-bundle and non-troubleshoot (if contains) labels selector.
// 2. troubleshoot.sh/kind=support-bundle and non-troubleshoot (if contains) labels selector.
func SplitTroubleshootSecretLabelSelector(ctx context.Context, labelSelector labels.Selector) ([]string, error) {
klog.V(1).Infof("Split %q selector into troubleshoot and non-troubleshoot labels selector separately, if applicable", labelSelector.String())
selectorRequirements, selectorSelectable := labelSelector.Requirements()
if !selectorSelectable {
return nil, errors.Errorf("Selector %q is not selectable", labelSelector.String())
}
var troubleshootReqs, otherReqs []labels.Requirement
for _, req := range selectorRequirements {
if req.Key() == constants.TroubleshootIOLabelKey || req.Key() == constants.TroubleshootSHLabelKey {
troubleshootReqs = append(troubleshootReqs, req)
} else {
otherReqs = append(otherReqs, req)
}
}
parsedSelectorStrings := make([]string, 0)
// Combine each troubleshoot requirement with other requirements to form new selectors
s := labelSelector.String()
if len(troubleshootReqs) == 0 && s != "" {
return []string{s}, nil
}
for _, tReq := range troubleshootReqs {
reqs := append(otherReqs, tReq)
newSelector := labels.NewSelector().Add(reqs...)
parsedSelectorStrings = append(parsedSelectorStrings, newSelector.String())
}
return parsedSelectorStrings, nil
}
var httpClient = &http.Client{
Timeout: 30 * time.Second,
}
// LoadFromCLIArgs loads troubleshoot specs from args passed to a CLI command.
// This loader function is meant for troubleshoot CLI commands only, hence not making it public.
// It will contain opinionated logic for CLI commands such as interpreting viper flags,
// supporting secret/ uri format, downloading from OCI registry and other URLs, etc.
func LoadFromCLIArgs(ctx context.Context, client kubernetes.Interface, args []string, vp *viper.Viper) (*loader.TroubleshootKinds, error) {
// Let's always ensure we have a context
if ctx == nil {
ctx = context.Background()
}
rawSpecs := []string{}
for _, v := range args {
if strings.HasPrefix(v, "secret/") {
// format secret/namespace-name/secret-name[/data-key]
pathParts := strings.Split(v, "/")
if len(pathParts) > 4 {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Errorf("secret path %s must have at most 4 components", v))
}
if len(pathParts) < 3 {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Errorf("secret path %s must have at least 3 components", v))
}
data, err := LoadFromSecret(ctx, client, pathParts[1], pathParts[2])
if err != nil {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Wrap(err, "failed to get spec from secret"))
}
// If we have a key defined, then load specs from that key only.
if len(pathParts) == 4 {
spec, ok := data[pathParts[3]]
if ok {
rawSpecs = append(rawSpecs, string(spec))
}
} else {
// Append all data in the secret. Some may not be specs, but that's ok. They will be ignored.
for _, spec := range data {
rawSpecs = append(rawSpecs, string(spec))
}
}
} else if strings.HasPrefix(v, "configmap/") {
// format configmap/namespace-name/configmap-name[/data-key]
pathParts := strings.Split(v, "/")
if len(pathParts) > 4 {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Errorf("configmap path %s must have at most 4 components", v))
}
if len(pathParts) < 3 {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Errorf("configmap path %s must have at least 3 components", v))
}
data, err := LoadFromConfigMap(ctx, client, pathParts[1], pathParts[2])
if err != nil {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Wrap(err, "failed to get spec from configmap"))
}
// If we have a key defined, then load specs from that key only.
if len(pathParts) == 4 {
spec, ok := data[pathParts[3]]
if ok {
rawSpecs = append(rawSpecs, spec)
}
} else {
// Append all data in the configmap. Some may not be specs, but that's ok. They will be ignored.
for _, spec := range data {
rawSpecs = append(rawSpecs, spec)
}
}
} else if _, err := os.Stat(v); err == nil {
b, err := os.ReadFile(v)
if err != nil {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, err)
}
rawSpecs = append(rawSpecs, string(b))
} else if v == "-" {
b, err := io.ReadAll(os.Stdin)
if err != nil {
return nil, types.NewExitCodeError(constants.EXIT_CODE_CATCH_ALL, err)
}
rawSpecs = append(rawSpecs, string(b))
} else {
u, err := url.Parse(v)
if err != nil {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, err)
}
if u.Scheme == "oci" {
content, err := oci.PullSpecsFromOCI(ctx, v)
if err != nil {
if err == oci.ErrNoRelease {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Errorf("no release found for %s.\nCheck the oci:// uri for errors or contact the application vendor for support.", v))
}
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, err)
}
rawSpecs = append(rawSpecs, content...)
} else {
if !util.IsURL(v) {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, fmt.Errorf("%s is not a URL and was not found (err %s)", v, err))
}
// Download preflight specs
rawSpec, err := downloadFromHttpURL(ctx, v, map[string]string{"User-Agent": "Replicated_Preflight/v1beta2"})
if err != nil {
return nil, err
}
rawSpecs = append(rawSpecs, rawSpec)
// Download support bundle specs
rawSpec, err = downloadFromHttpURL(ctx, v, map[string]string{
"User-Agent": "Replicated_Troubleshoot/v1beta1",
"Bundle-Upload-Host": fmt.Sprintf("%s://%s", u.Scheme, u.Host),
})
if err != nil {
return nil, err
}
rawSpecs = append(rawSpecs, rawSpec)
}
}
}
kinds, err := loader.LoadSpecs(ctx, loader.LoadOptions{
RawSpecs: rawSpecs,
})
if err != nil {
return nil, err
}
if vp.GetBool("load-cluster-specs") {
clusterKinds, err := LoadFromCluster(ctx, client, vp.GetStringSlice("selector"), vp.GetString("namespace"))
if err != nil {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, err)
}
kinds.Add(clusterKinds)
}
return kinds, nil
}
func downloadFromHttpURL(ctx context.Context, url string, headers map[string]string) (string, error) {
hs := []string{}
for k, v := range headers {
hs = append(hs, fmt.Sprintf("%s: %s", k, v))
}
klog.V(1).Infof("Downloading troubleshoot specs: url=%s, headers=[%v]", url, strings.Join(hs, ", "))
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
if err != nil {
// exit code: should this be catch all or spec issues...?
return "", types.NewExitCodeError(constants.EXIT_CODE_CATCH_ALL, err)
}
for k, v := range headers {
req.Header.Set(k, v)
}
resp, err := httpClient.Do(req)
if err != nil {
// exit code: should this be catch all or spec issues...?
return "", types.NewExitCodeError(constants.EXIT_CODE_CATCH_ALL, err)
}
defer resp.Body.Close()
klog.V(1).Infof("Response status: %s", resp.Status)
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, err)
}
return string(body), nil
}
// LoadFromCluster loads troubleshoot specs from the cluster based on the provided labels.
// By default this will be troubleshoot.io/kind=support-bundle and troubleshoot.sh/kind=support-bundle
// labels. We search for secrets and configmaps with the label selector and extract the raw data.
// We then load the specs from the raw data. If the user does not have sufficient permissions
// to list & read secrets and configmaps from all namespaces, we will fallback to trying each
// namespace individually, and eventually default to the configured kubeconfig namespace.
func LoadFromCluster(ctx context.Context, client kubernetes.Interface, selectors []string, ns string) (*loader.TroubleshootKinds, error) {
if reflect.DeepEqual(selectors, []string{"troubleshoot.sh/kind=support-bundle"}) {
// Its the default selector so we append troubleshoot.io/kind=support-bundle to it due to backwards compatibility
selectors = append(selectors, "troubleshoot.io/kind=support-bundle")
}
labelSelector := strings.Join(selectors, ",")
parsedSelector, err := labels.Parse(labelSelector)
if err != nil {
return nil, errors.Wrap(err, "unable to parse selector")
}
// List of namespaces we want to search for secrets and configmaps with support bundle specs
namespaces := []string{}
if ns != "" {
// Just progress with the namespace provided
namespaces = []string{ns}
} else {
// Check if I can read secrets and configmaps in all namespaces
ican, err := k8sutil.CanIListAndGetAllSecretsAndConfigMaps(ctx, client)
if err != nil {
return nil, errors.Wrap(err, "failed to check if I can read secrets and configmaps")
}
klog.V(1).Infof("Can I read any secrets and configmaps: %v", ican)
if ican {
// I can read secrets and configmaps in all namespaces
// No need to iterate over all namespaces
namespaces = []string{""}
} else {
// Get list of all namespaces and try to find specs from each namespace
nsList, err := client.CoreV1().Namespaces().List(ctx, metav1.ListOptions{})
if err != nil {
if k8serrors.IsForbidden(err) {
kubeconfig := k8sutil.GetKubeconfig()
ns, _, err := kubeconfig.Namespace()
if err != nil {
return nil, errors.Wrap(err, "failed to get namespace from kubeconfig")
}
// If we are not allowed to list namespaces, just use the default namespace
// configured in the kubeconfig
namespaces = []string{ns}
} else {
return nil, errors.Wrap(err, "failed to list namespaces")
}
}
for _, ns := range nsList.Items {
namespaces = append(namespaces, ns.Name)
}
}
}
var rawSpecs []string
parsedSelectorStrings, err := SplitTroubleshootSecretLabelSelector(ctx, parsedSelector)
if err != nil {
klog.Errorf("failed to parse troubleshoot labels selector %s", err)
}
// Iteratively search for troubleshoot specs in all namespaces using the given selectors
for _, parsedSelectorString := range parsedSelectorStrings {
klog.V(1).Infof("Search specs from [%q] namespace using %q selector", strings.Join(namespaces, ", "), parsedSelectorString)
for _, ns := range namespaces {
for _, key := range []string{constants.SupportBundleKey, constants.PreflightKey, constants.RedactorKey} {
specs, err := LoadFromSecretMatchingLabel(ctx, client, parsedSelectorString, ns, key)
if err != nil {
if !k8serrors.IsForbidden(err) {
klog.Errorf("failed to load support bundle spec from secrets: %s", err)
} else {
klog.Warningf("Reading secrets from %q namespace forbidden", ns)
}
}
rawSpecs = append(rawSpecs, specs...)
specs, err = LoadFromConfigMapMatchingLabel(ctx, client, parsedSelectorString, ns, key)
if err != nil {
if !k8serrors.IsForbidden(err) {
klog.Errorf("failed to load support bundle spec from configmap: %s", err)
} else {
klog.Warningf("Reading configmaps from %q namespace forbidden", ns)
}
}
rawSpecs = append(rawSpecs, specs...)
}
}
}
// Load troubleshoot specs from the raw specs
return loader.LoadSpecs(ctx, loader.LoadOptions{
RawSpecs: rawSpecs,
})
}

Some files were not shown because too many files have changed in this diff Show More