Compare commits

..
125 Commits
Author SHA1 Message Date
Dmitriy Ivolgin 4f8c1f3d8b Merge pull request #639 from replicatedhq/divolgin/helm
Fix path for Helm registry credentials
2022-07-27 12:04:31 -07:00
divolgin 14f9ae8f3b Fix path for Helm registry credentials 2022-07-27 00:43:44 +00:00
xavpaice 248b393288 Merge pull request #573 from replicatedhq/pa1/update-go-mod-archiver
update go module github.com/mholt/archiver/v3
2022-07-27 08:10:52 +12:00
xavpaice 6fe887df62 Merge pull request #638 from replicatedhq/xav/go_modules/periph.io/x/periph-3.7.2
Bump periph.io/x/periph from 3.6.8+incompatible to 3.7.2
2022-07-27 07:28:08 +12:00
xavpaice 65c8980504 Merge pull request #637 from replicatedhq/dependabot-17
Update containerd to 1.6.6
2022-07-27 07:27:45 +12:00
Dmitriy Ivolgin 41d2bae380 Merge pull request #621 from mesosphere/mh/fix-multiple-crd-version
fix: use kube-aware version selector for crs collector
2022-07-26 09:27:48 -07:00
Pavan Sokke Nagaraj 912e76c97e update go mod github.com/mholt/archiver/v3 2022-07-26 08:03:45 -04:00
xavpaice f6e49c95f9 Merge branch 'main' into dependabot-17 2022-07-26 19:47:40 +12:00
xavpaice 85aa5334b0 Merge branch 'main' into xav/go_modules/periph.io/x/periph-3.7.2 2022-07-26 19:47:09 +12:00
xavpaice 29e817475a Merge pull request #636 from replicatedhq/dependabot/go_modules/github.com/go-logr/logr-1.2.3
Bump github.com/go-logr/logr from 1.2.2 to 1.2.3
2022-07-26 19:45:12 +12:00
dependabot[bot] e0caefc9df Bump github.com/go-logr/logr from 1.2.2 to 1.2.3
Bumps [github.com/go-logr/logr](https://github.com/go-logr/logr) from 1.2.2 to 1.2.3.
- [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.2...v1.2.3)

---
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>
2022-07-26 06:38:24 +00:00
xavpaice 09eef9019f Merge pull request #635 from replicatedhq/dependabot/go_modules/oras.land/oras-go-1.2.0
Bump oras.land/oras-go from 1.1.1 to 1.2.0
2022-07-26 18:37:08 +12:00
dependabot[bot] 057be29943 Bump periph.io/x/periph from 3.6.8+incompatible to 3.7.2
- [Release notes](https://github.com/google/periph/releases)

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

Module periph.io/x/periph has moved from 3.6.8 to re-arrange locations
in 3.7.2.  This reworks to take advantage of the new format.
2022-07-26 18:33:22 +12:00
Xav Paice 4ec239e94f Update containerd to 1.6.6
https://github.com/replicatedhq/troubleshoot/security/dependabot/17
suggests update of containerd, but dependabot was unable to do so.
2022-07-26 17:52:00 +12:00
dependabot[bot] 11b54a2ed3 Bump oras.land/oras-go from 1.1.1 to 1.2.0
Bumps [oras.land/oras-go](https://github.com/oras-project/oras-go) from 1.1.1 to 1.2.0.
- [Release notes](https://github.com/oras-project/oras-go/releases)
- [Commits](https://github.com/oras-project/oras-go/compare/v1.1.1...v1.2.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-26 05:46:09 +00:00
xavpaice 33a92a81e4 Merge pull request #633 from replicatedhq/dependabot/go_modules/github.com/lib/pq-1.10.6
Bump github.com/lib/pq from 1.10.4 to 1.10.6
2022-07-26 17:44:53 +12:00
dependabot[bot] 5f11410677 Bump github.com/lib/pq from 1.10.4 to 1.10.6
Bumps [github.com/lib/pq](https://github.com/lib/pq) from 1.10.4 to 1.10.6.
- [Release notes](https://github.com/lib/pq/releases)
- [Commits](https://github.com/lib/pq/compare/v1.10.4...v1.10.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-26 05:33:02 +00:00
xavpaice 6b076a7d4d Merge pull request #634 from replicatedhq/dependabot/go_modules/github.com/sirupsen/logrus-1.9.0
Bump github.com/sirupsen/logrus from 1.8.1 to 1.9.0
2022-07-26 17:31:58 +12:00
dependabot[bot] 0070a5fb10 Bump github.com/sirupsen/logrus from 1.8.1 to 1.9.0
Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus) from 1.8.1 to 1.9.0.
- [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.8.1...v1.9.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-26 05:04:08 +00:00
xavpaice be47f06217 Merge pull request #632 from replicatedhq/dependabot/go_modules/github.com/stretchr/testify-1.8.0
Bump github.com/stretchr/testify from 1.7.1 to 1.8.0
2022-07-26 17:02:49 +12:00
dependabot[bot] 16e395b90a Bump github.com/stretchr/testify from 1.7.1 to 1.8.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.1 to 1.8.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.1...v1.8.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-26 04:48:58 +00:00
xavpaice ef1a186f9e Merge pull request #631 from replicatedhq/dependabot/go_modules/sigs.k8s.io/controller-runtime-0.12.3
Bump sigs.k8s.io/controller-runtime from 0.11.0 to 0.12.3
2022-07-26 16:47:45 +12:00
dependabot[bot] 5ade1cb4b6 Bump sigs.k8s.io/controller-runtime from 0.11.0 to 0.12.3
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.11.0 to 0.12.3.
- [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.11.0...v0.12.3)

---
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>
2022-07-26 03:01:12 +00:00
xavpaice 8b90f2595d Merge pull request #583 from replicatedhq/dependabot/go_modules/github.com/spf13/viper-1.12.0
Bump github.com/spf13/viper from 1.10.0 to 1.12.0
2022-07-26 14:59:55 +12:00
xavpaice f98fa5c637 Merge branch 'main' into dependabot/go_modules/github.com/spf13/viper-1.12.0 2022-07-26 14:43:56 +12:00
xavpaice f21ba951a5 Merge pull request #619 from replicatedhq/dependabot/go_modules/k8s.io/klog/v2-2.70.1
Bump k8s.io/klog/v2 from 2.60.1 to 2.70.1
2022-07-26 14:43:25 +12:00
dependabot[bot] 5bae5efb92 Bump k8s.io/klog/v2 from 2.60.1 to 2.70.1
Bumps [k8s.io/klog/v2](https://github.com/kubernetes/klog) from 2.60.1 to 2.70.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.60.1...v2.70.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>
2022-07-26 02:27:00 +00:00
dependabot[bot] 5568f241a3 Bump github.com/spf13/viper from 1.10.0 to 1.12.0
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.10.0 to 1.12.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.10.0...v1.12.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>
2022-07-26 02:26:46 +00:00
xavpaice 19f66574c6 Merge pull request #628 from replicatedhq/dependabot/go_modules/github.com/spf13/cobra-1.5.0
Bump github.com/spf13/cobra from 1.4.0 to 1.5.0
2022-07-26 14:25:38 +12:00
xavpaice ae75f325c2 Merge branch 'main' into dependabot/go_modules/github.com/spf13/cobra-1.5.0 2022-07-26 14:10:58 +12:00
xavpaice 28cad0cf4a Merge pull request #629 from replicatedhq/dependabot/go_modules/k8s.io/cli-runtime-0.24.3
Bump k8s.io/cli-runtime from 0.24.0 to 0.24.3
2022-07-26 14:09:48 +12:00
dependabot[bot] 83d7e48999 Bump k8s.io/cli-runtime from 0.24.0 to 0.24.3
Bumps [k8s.io/cli-runtime](https://github.com/kubernetes/cli-runtime) from 0.24.0 to 0.24.3.
- [Release notes](https://github.com/kubernetes/cli-runtime/releases)
- [Commits](https://github.com/kubernetes/cli-runtime/compare/v0.24.0...v0.24.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>
2022-07-26 01:00:58 +00:00
xavpaice e2d1ce2fb0 Merge pull request #611 from replicatedhq/design
Proposal provide extendable API for bundle information
2022-07-26 12:19:20 +12:00
Chris Sanders e6cc4e6c47 Merge branch 'main' into design 2022-07-25 16:58:46 -05:00
xavpaice 8c0c83776f Merge pull request #622 from replicatedhq/el-49103-patch
Patch node_resources.go
2022-07-21 08:58:52 +12:00
dependabot[bot] ae888134a3 Bump github.com/spf13/cobra from 1.4.0 to 1.5.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.4.0...v1.5.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>
2022-07-20 08:44:49 +00:00
xavpaice 276cf7ce06 Merge branch 'main' into el-49103-patch 2022-07-20 20:43:56 +12:00
xavpaice 7132ee7405 Merge pull request #624 from replicatedhq/dependabot/go_modules/k8s.io/apiserver-0.24.3
Bump k8s.io/apiserver from 0.24.0 to 0.24.3
2022-07-20 20:42:31 +12:00
xavpaice 817ebaad41 Merge branch 'main' into dependabot/go_modules/k8s.io/apiserver-0.24.3 2022-07-20 19:55:21 +12:00
xavpaice 9e90e94ced Merge pull request #625 from replicatedhq/dependabot/go_modules/k8s.io/api-0.24.3
Bump k8s.io/api from 0.24.0 to 0.24.3
2022-07-20 19:54:25 +12:00
xavpaice fd1594520e Merge branch 'main' into dependabot/go_modules/k8s.io/api-0.24.3 2022-07-20 19:29:51 +12:00
xavpaice 9b6f8d3aff Merge pull request #626 from replicatedhq/adamancini-patch-1
add instructions to cross-compile with Go
2022-07-20 19:28:20 +12:00
ada mancini d84a919b33 add instructions to cross-compile with Go 2022-07-19 16:50:20 -04:00
dependabot[bot] fc745c1144 Bump k8s.io/api from 0.24.0 to 0.24.3
Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.24.0 to 0.24.3.
- [Release notes](https://github.com/kubernetes/api/releases)
- [Commits](https://github.com/kubernetes/api/compare/v0.24.0...v0.24.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>
2022-07-18 17:09:42 +00:00
dependabot[bot] 8f38b7c5aa Bump k8s.io/apiserver from 0.24.0 to 0.24.3
Bumps [k8s.io/apiserver](https://github.com/kubernetes/apiserver) from 0.24.0 to 0.24.3.
- [Release notes](https://github.com/kubernetes/apiserver/releases)
- [Commits](https://github.com/kubernetes/apiserver/compare/v0.24.0...v0.24.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>
2022-07-18 17:09:36 +00:00
Kira C Boyle 0203889171 Merge pull request #623 from replicatedhq/update-opencontainers-runc
update github.com/opencontainers/runc to 1.1.3 to resolve CVE-2022-29162
2022-07-18 10:07:58 -07:00
Kira Boyle 78c93418ca update github.com/opencontainers/runc to 1.1.3 to resolve CVE-2022-29162
* https://avd.aquasec.com/nvd/2022/cve-2022-29162/
2022-07-18 09:07:08 -07:00
Edgar Lanting c1d303350f Patch node_resources.go
Fix the behaviour of the node Ready/NotReady check when running a support bundle with:
`support-bundle https://kots.io`
2022-07-18 11:09:23 +02:00
Martin Hrabovcin 642d098238 fix: use kube-aware version selector for crs collector 2022-07-15 08:36:16 +02:00
Chris Sanders 532f1583b5 Merge branch 'main' into design 2022-07-13 13:14:38 -05:00
Chris Sanders ab42cd766f Update proposal for PR discussion and capture next steps 2022-07-13 13:14:05 -05:00
Dmitriy Ivolgin 050345f123 Merge pull request #618 from replicatedhq/divolgin/sc-51321/kots-does-not-automatically-re-write-private
Adding some utility interfaces for collectors
2022-07-08 15:10:05 -07:00
divolgin 8e7ea022f7 Adding some utility interfaces for collectors 2022-07-08 14:53:46 -07:00
Diamon Wiggins c1c772e59f Merge pull request #617 from replicatedhq/diamonwiggins/sc-48402/support-bundle-host-analyzers
Add HostAnalyzers to Support Bundles
2022-07-07 16:17:56 -04:00
Diamon Wiggins a1533d5ec5 adding host analyzers to kind analyzer and supportbundle 2022-07-06 12:19:44 -04:00
Ethan Mosbaugh 1820c40c43 Make sure to clean up resources when done including run pods (#615) 2022-07-02 14:40:55 -07:00
Diamon Wiggins cab3fc7f4e Redact Host Collectors in Support Bundles (#614)
Add redactors for Host Collectors
2022-07-01 18:57:58 -04:00
Dmitriy Ivolgin 3ff0e82fcc Merge pull request #593 from replicatedhq/dependabot/go_modules/github.com/hashicorp/go-getter-1.6.2
Bump github.com/hashicorp/go-getter from 1.5.9 to 1.6.2
2022-07-01 11:24:01 -07:00
Dmitriy Ivolgin 40f1f0193a Merge branch 'main' into dependabot/go_modules/github.com/hashicorp/go-getter-1.6.2 2022-07-01 11:08:13 -07:00
Edgar Lanting 2de46a18a5 Merge pull request #602 from replicatedhq/el-analyze-typo-20220615
Update analyze.go - fix typo
2022-07-01 15:50:24 +02:00
Edgar Lanting cdbf189955 Merge branch 'main' into el-analyze-typo-20220615 2022-07-01 15:32:56 +02:00
xavpaice ff5ee2b709 Merge pull request #609 from xavpaice/xav/sc37229/ceph-secrets
Add Ceph auth redactors
2022-06-30 17:54:25 +12:00
xavpaice d98c01a3b9 Merge branch 'main' into xav/sc37229/ceph-secrets 2022-06-30 17:40:19 +12:00
ada mancini 0996b3b1ad Merge pull request #612 from adamancini/sc-51130/postgres-analyzer
include the db connection error message with the outcome
2022-06-29 15:04:34 -04:00
ada mancini b617de3fd0 include the db connection error message with the outcome 2022-06-29 12:28:29 -04:00
Diamon Wiggins c9c305570b Host Run Collector (#606)
Host Run Collector
2022-06-29 12:14:56 -04:00
Diamon Wiggins 601bf75ceb Merge pull request #610 from replicatedhq/diamonwiggins/fix-flaky-ceph-test
Fix flaky Ceph analyzer test
2022-06-28 17:57:59 -04:00
Chris Sanders fe1137d8ec Change design to have collectors write to etcd rather than push to an api-server after discussion with ethan 2022-06-28 16:54:42 -05:00
Diamon Wiggins 69b34c45b2 changing flaky ceph analyzer test 2022-06-28 13:04:10 -04:00
Edgar Lanting f1cff2cd74 Merge branch 'main' into el-analyze-typo-20220615 2022-06-27 13:23:54 +02:00
Edgar Lanting 0f2976cac5 Merge pull request #595 from edgarlanting/main
Update CONTRIBUTING.md
2022-06-27 13:23:23 +02:00
Edgar Lanting 65570ac121 Merge branch 'main' into main 2022-06-27 10:56:48 +02:00
Xav Paice 4acd7e4951 Add Ceph auth redactors
Add automatic redactors for Ceph auth_dump json which includes auth keys.
2022-06-27 17:50:38 +12:00
Dmitriy Ivolgin 7b4bfa3af7 Merge pull request #607 from takirala/tga/use-storedVersion-cr-collection
fix: use `storedVersions` to determine specific CR version
2022-06-24 15:43:22 -07:00
Tarun Gupta Akirala 43a936a0d7 fix: use storedVersions to determine specific CR version 2022-06-24 12:09:10 -07:00
Edgar Lanting 27479e856f Merge branch 'main' into el-analyze-typo-20220615 2022-06-23 00:11:43 +02:00
Edgar Lanting 567fa5950c Merge branch 'main' into main 2022-06-23 00:11:17 +02:00
Alex Parker b29ef61cc5 Merge pull request #605 from replicatedhq/ajp-io-patch-1
Update K8s versions and container runtime
2022-06-22 15:44:22 -04:00
Alex Parker 34c59eb237 Update K8s versions and container runtime 2022-06-22 15:20:48 -04:00
Edgar Lanting 650916f77c Merge branch 'main' into el-analyze-typo-20220615 2022-06-20 10:25:54 +02:00
Dmitriy Ivolgin 7ec008479a Merge pull request #601 from replicatedhq/divolgin/reflect
Use reflection instead of hardcoding all alnalyzers
2022-06-17 14:12:36 -07:00
divolgin f02566c712 Use reflection instead of hardcoding all alnalyzers 2022-06-17 13:54:23 -07:00
Craig O'Donnell 354a996edc feat: adds new yamlCompare and jsonCompare analyzers (#598)
* feat: adds new yamlCompare analyzer

* feat: adds new jsonCompare analyzer

* outcome when for yamlCompare and jsonCompare
2022-06-17 14:43:56 -04:00
Edgar Lanting 31d6a0d8fd Merge branch 'main' into main 2022-06-17 10:17:51 +02:00
Dmitriy Ivolgin 1de5a79855 Merge pull request #600 from replicatedhq/divolgin/sc-50660/when-all-preflights-are-excluded-we-should
Wrapper function for analyzer's exclude flag
2022-06-16 17:44:40 -07:00
divolgin b308f4a2b2 Wrapper function for analyzer's exclude flag 2022-06-16 14:18:39 -07:00
Chris Sanders 33ddee27ed typos 2022-06-15 17:57:43 -05:00
Chris Sanders 6d7bf73aba Add initial design folder with standard-interfaces design 2022-06-15 12:22:19 -05:00
dependabot[bot] a5fceaf476 Bump github.com/hashicorp/go-getter from 1.5.9 to 1.6.2
Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.5.9 to 1.6.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.5.9...v1.6.2)

---
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>
2022-06-15 15:31:10 +00:00
Edgar Lanting 1e2e7e9aee Update analyze.go - fix typo
Fixed a typo in the comments: `analysze` -> `analyze`
2022-06-15 16:41:05 +02:00
Kira C Boyle 319a3a8d38 Merge pull request #596 from replicatedhq/kiraboyle/sc-49361/strict-preflight-is-still-being-enforced
do not return that a strict analyzer is present in an application if …
2022-06-14 12:03:54 -07:00
Kira Boyle 5e7bd06fcb do not return that a strict analyzer is present in an application if a strict analyzer is excluded 2022-06-14 10:23:42 -07:00
Edgar Lanting b92037171e Merge pull request #1 from edgarlanting/el-patch-contributing
Update CONTRIBUTING.md with small textual changes
2022-06-14 15:00:40 +02:00
Edgar Lanting fc52426a4a Update CONTRIBUTING.md with small textual changes
Changed wording in requirements for clarification
2022-06-14 14:59:40 +02:00
Ethan Mosbaugh 3a5816cd18 Merge pull request #592 from replicatedhq/disable-client-go-logs
Disable client-go logging
2022-06-13 15:04:41 -07:00
Ethan Mosbaugh 7c74f8b755 Disable client-go logging 2022-06-10 15:39:23 +00:00
Diamon Wiggins a881877fd8 Merge pull request #591 from replicatedhq/diamonwiggins/sc-48784/update-contributed-md
Update Contributing.md
2022-06-10 10:28:17 -04:00
Diamon Wiggins c044cc6021 update contributing.md 2022-06-09 11:42:13 -04:00
Alexander 009829c3ff Merge pull request #577 from nachtmaar/template-textanalyzer-message
Template message in outcome block when using textAnalyzer
2022-06-07 16:35:57 +01:00
Alexander 4404849e76 Merge branch 'main' into template-textanalyzer-message 2022-06-06 11:54:05 +01:00
Marc Campbell 374a65522d Merge pull request #588 from replicatedhq/oci-specs
Support for oci:// retreival of specs
2022-06-03 15:26:39 -07:00
Marc Campbell 5da84663b1 Support for oci:// retreival of specs 2022-06-03 12:40:15 -07:00
Nils Seip 0bbf2dff48 Merge branch 'main' into template-textanalyzer-message 2022-06-03 19:41:14 +02:00
Pavan Sokke Nagaraj 156965fd10 Merge pull request #586 from replicatedhq/pa1/fix-client-gen
remove redundant client-gen code generated in wrong path
2022-06-02 20:48:43 -04:00
Pavan Sokke Nagaraj 3da43b18c9 remove redundant client-gen code 2022-06-02 19:33:47 -04:00
Ethan Mosbaugh 78314a5fc4 Merge pull request #587 from replicatedhq/template-delims
Allow for repl{{ template delim
2022-06-02 13:09:51 -07:00
Ethan Mosbaugh 9792289ac1 Remove namespace template from examples 2022-06-02 19:54:31 +00:00
Ethan Mosbaugh 6018068349 Allow for repl{{ template delim 2022-06-02 19:24:23 +00:00
Ethan Mosbaugh 7f829bb3ca Merge pull request #585 from replicatedhq/e2e-test-local 2022-06-02 06:53:55 -07:00
Ethan Mosbaugh d3cf4fc7f4 Run e2e tests locally 2022-06-02 13:41:00 +00:00
Nils Seip e85e9cd464 Merge branch 'main' into template-textanalyzer-message 2022-05-30 09:32:01 +02:00
Pavan Sokke Nagaraj a0a6a5bf19 Merge pull request #581 from replicatedhq/pa1/fix-deployment-status-panic
fix panic: return nil result when no files to check deployment status analyzer
2022-05-27 15:55:14 -04:00
Pavan Sokke Nagaraj 750ebc1277 return nil when no matching analyzer result 2022-05-27 14:33:35 -04:00
Nils Seip 6f997a47a3 Merge branch 'main' into template-textanalyzer-message 2022-05-27 16:49:00 +02:00
Ethan Mosbaugh af1afd09ca Merge pull request #580 from replicatedhq/k8s-1.24-support
Add support for k8s 1.24+
2022-05-24 11:57:10 -07:00
Ethan Mosbaugh 74b4802b46 Add support for k8s 1.24+ 2022-05-24 11:05:59 -07:00
nachtmaar 3d6841c11e Fix typos 2022-05-20 17:28:44 +02:00
nachtmaar 8adf58b717 Return err instead of panic 2022-05-20 17:23:22 +02:00
nachtmaar 44c07c2a00 Rename CRD -> CR 2022-05-20 17:13:14 +02:00
nachtmaar 9179dc8fec Add test for pass outcome black 2022-05-20 17:01:48 +02:00
nachtmaar a9df4552b4 Use warn log level in warn test 2022-05-20 15:54:12 +02:00
nachtmaar c5505bc017 Rename tests 2022-05-20 15:47:19 +02:00
nachtmaar 3ceffbc4b2 Add test for warn outcome block 2022-05-20 15:45:22 +02:00
nachtmaar 5967105ad2 Make test data more generic 2022-05-20 15:35:47 +02:00
nachtmaar 7eb6263dc1 Template messages in outcome block for textAnalyzer 2022-05-18 15:46:42 +02:00
109 changed files with 3202 additions and 5533 deletions
+1 -26
View File
@@ -104,32 +104,7 @@ jobs:
name: preflight
path: bin/
- run: chmod +x bin/preflight
- run: |
./bin/preflight --interactive=false --format=json examples/preflight/e2e.yaml > result.json
cat result.json
EXIT_STATUS=0
if grep -q "was not collected" result.json; then
echo "Some files were not collected"
EXIT_STATUS=1
fi
if (( `jq '.pass | length' result.json` < 1 )); then
echo "No passing preflights found"
EXIT_STATUS=1
fi
if (( `jq '.warn | length' result.json` > 0 )); then
echo "Warnings found"
EXIT_STATUS=1
fi
if (( `jq '.fail | length' result.json` > 0 )); then
echo "Failed preflights found"
EXIT_STATUS=1
fi
exit $EXIT_STATUS
- run: make e2e-test
compile-supportbundle:
runs-on: ubuntu-latest
+43 -2
View File
@@ -6,6 +6,47 @@ Thank you for your interest in Troubleshoot, we welcome your participation. Plea
- [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.
## Pull Requests
## Development Environment
If you are interested in contributing a change to the code or documentation please open a pull request with your set of changes. The pull request will be reviewed in a timely manner.
To get started we recommend:
1. Go (v1.17 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
5. Run `make run-troubleshoot` to generate a support bundle with the `sample-troubleshoot.yaml` in the root of the repo
> 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`
### Testing
To run the tests locally run the following:
```bash
make test
```
Additionally, e2e tests can be run with:
```bash
make support-bundle preflight e2e-test
```
A Kubernetes cluster as well as `jq` are required to run e2e tests.
## Contribution workflow
This is a rough outline of how to prepare a contribution:
- Create a fork of this repo.
- Create a topic branch from where you want to base your work (branched from `main` is a safe choice).
- Make commits of logical units.
- 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.
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.
+6 -1
View File
@@ -41,10 +41,14 @@ all: test support-bundle preflight collect
ffi: fmt vet
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/troubleshoot.so -buildmode=c-shared ffi/main.go
# Run tests
.PHONY: test
test: generate fmt vet
go test ${BUILDFLAGS} ./pkg/... ./cmd/... -coverprofile cover.out
.PHONY: e2e-test
e2e-test:
./test/validate-preflight-e2e.sh
.PHONY: support-bundle
support-bundle:
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/support-bundle github.com/replicatedhq/troubleshoot/cmd/troubleshoot
@@ -74,6 +78,7 @@ generate: controller-gen client-gen
$(CONTROLLER_GEN) \
object:headerFile=./hack/boilerplate.go.txt paths=./pkg/apis/...
$(CLIENT_GEN) \
--output-base=./../../../ \
--output-package=github.com/replicatedhq/troubleshoot/pkg/client \
--clientset-name troubleshootclientset \
--input-base github.com/replicatedhq/troubleshoot/pkg/apis \
+9 -1
View File
@@ -4,10 +4,12 @@ import (
"os"
"strings"
"github.com/go-logr/logr"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
"github.com/replicatedhq/troubleshoot/pkg/logger"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/klog/v2"
)
func RootCmd() *cobra.Command {
@@ -18,7 +20,12 @@ func RootCmd() *cobra.Command {
Long: `Run a series of analyzers on a support bundle archive`,
SilenceUsage: true,
PreRun: func(cmd *cobra.Command, args []string) {
viper.BindPFlags(cmd.Flags())
v := viper.GetViper()
v.BindPFlags(cmd.Flags())
if !v.GetBool("debug") {
klog.SetLogger(logr.Discard())
}
},
RunE: func(cmd *cobra.Command, args []string) error {
v := viper.GetViper()
@@ -32,6 +39,7 @@ func RootCmd() *cobra.Command {
cobra.OnInitialize(initConfig)
cmd.Flags().String("analyzers", "", "filename or url of the analyzers to use")
cmd.Flags().Bool("debug", false, "enable debug logging")
viper.BindPFlags(cmd.Flags())
+9 -1
View File
@@ -4,10 +4,12 @@ import (
"os"
"strings"
"github.com/go-logr/logr"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
"github.com/replicatedhq/troubleshoot/pkg/logger"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/klog/v2"
)
func RootCmd() *cobra.Command {
@@ -18,7 +20,12 @@ func RootCmd() *cobra.Command {
Long: `Run a collector and output the results.`,
SilenceUsage: true,
PreRun: func(cmd *cobra.Command, args []string) {
viper.BindPFlags(cmd.Flags())
v := viper.GetViper()
v.BindPFlags(cmd.Flags())
if !v.GetBool("debug") {
klog.SetLogger(logr.Discard())
}
},
RunE: func(cmd *cobra.Command, args []string) error {
v := viper.GetViper()
@@ -39,6 +46,7 @@ func RootCmd() *cobra.Command {
cmd.Flags().String("collector-pull-policy", "", "the pull policy of the collector image")
cmd.Flags().String("selector", "", "selector (label query) to filter remote collection nodes on.")
cmd.Flags().Bool("collect-without-permissions", false, "always generate a support bundle, even if it some require additional permissions")
cmd.Flags().Bool("debug", false, "enable debug logging")
// 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")
+9 -1
View File
@@ -4,9 +4,11 @@ import (
"os"
"strings"
"github.com/go-logr/logr"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/klog/v2"
)
func RootCmd() *cobra.Command {
@@ -18,7 +20,12 @@ func RootCmd() *cobra.Command {
that a cluster meets the requirements to run an application.`,
SilenceUsage: true,
PreRun: func(cmd *cobra.Command, args []string) {
viper.BindPFlags(cmd.Flags())
v := viper.GetViper()
v.BindPFlags(cmd.Flags())
if !v.GetBool("debug") {
klog.SetLogger(logr.Discard())
}
},
RunE: func(cmd *cobra.Command, args []string) error {
v := viper.GetViper()
@@ -39,6 +46,7 @@ that a cluster meets the requirements to run an application.`,
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("-", "_"))
+37 -17
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"os/signal"
"strings"
@@ -19,6 +20,7 @@ import (
troubleshootclientsetscheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
"github.com/replicatedhq/troubleshoot/pkg/docrewrite"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
"github.com/replicatedhq/troubleshoot/pkg/oci"
"github.com/replicatedhq/troubleshoot/pkg/preflight"
"github.com/replicatedhq/troubleshoot/pkg/specs"
"github.com/spf13/viper"
@@ -65,27 +67,45 @@ func runPreflights(v *viper.Viper, arg string) error {
preflightContent = b
} else {
if !util.IsURL(arg) {
return fmt.Errorf("%s is not a URL and was not found (err %s)", arg, err)
}
req, err := http.NewRequest("GET", arg, nil)
if err != nil {
return err
}
req.Header.Set("User-Agent", "Replicated_Preflight/v1beta2")
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
u, err := url.Parse(arg)
if err != nil {
return err
}
preflightContent = body
if u.Scheme == "oci" {
content, err := oci.PullPreflightFromOCI(arg)
if err != nil {
if err == oci.ErrNoRelease {
return errors.Errorf("no release found for %s.\nCheck the oci:// uri for errors or contact the application vendor for support.", arg)
}
return err
}
preflightContent = content
} else {
if !util.IsURL(arg) {
return fmt.Errorf("%s is not a URL and was not found (err %s)", arg, err)
}
req, err := http.NewRequest("GET", arg, nil)
if err != nil {
return err
}
req.Header.Set("User-Agent", "Replicated_Preflight/v1beta2")
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
preflightContent = body
}
}
preflightContent, err = docrewrite.ConvertToV1Beta2(preflightContent)
+9 -1
View File
@@ -5,11 +5,13 @@ import (
"os"
"strings"
"github.com/go-logr/logr"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/replicatedhq/troubleshoot/pkg/k8sutil"
"github.com/replicatedhq/troubleshoot/pkg/logger"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/klog/v2"
)
func RootCmd() *cobra.Command {
@@ -21,7 +23,12 @@ func RootCmd() *cobra.Command {
from a server that can be used to assist when troubleshooting a Kubernetes cluster.`,
SilenceUsage: true,
PreRun: func(cmd *cobra.Command, args []string) {
viper.BindPFlags(cmd.Flags())
v := viper.GetViper()
v.BindPFlags(cmd.Flags())
if !v.GetBool("debug") {
klog.SetLogger(logr.Discard())
}
},
RunE: func(cmd *cobra.Command, args []string) error {
v := viper.GetViper()
@@ -43,6 +50,7 @@ from a server that can be used to assist when troubleshooting a Kubernetes clust
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")
// 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")
+74
View File
@@ -0,0 +1,74 @@
# Provide an extendable API for accessing bundle information
## Goals
* Provide API based access to collected information, decoupling other projects from troubleshoot on-disk format
* Reuse existing APIs when they exist to make the bundle compatible with existing tools without modification
* Plan for extensibility for accessing information beyond just the standard kubernetes api
## Non Goals
* Compatibility with previous on-disk formats
* Compatibility with existing collectors without modification
* There should be a plan to allow the implementation of existing collectors
## Background
While using the information gathered in a support bundle users were finding it hard to find information while manually reviewing the various files collected in the bundle. Users have to understand the folder structure, files structure, and process JSON files to find information about the cluster. The [sbctl](https://github.com/replicatedhq/sbctl) project was created to prove out the utility of providing api based access so that users could use existing tools which they already understood. This has been a very successful experiment with feedback being that most users now use this utility as their primary, or only, interface to the support bundle information.
There are some drawbacks to the current approach. The `sbctl` project is tightly coupled to troubleshoot on-disk formats, each kubernetes API must be implemented in `sbctl` individually and will require being kept up to date as APIs change, and `sbctl` has no plan today to provide similar API based access to information other than the standard kubernetes api.
This proposal is meant to take the learnings from `sbctl` and consider implementing it as a first class feature of troubleshoot while attempting to address the current maintenance and expandability limitations.
## High-Level Design
To help address standard access to API data, troubleshoot will start an etcd instance which collectors can then use to store collected information rather than writing to custom on-disk locations. Collectors that only need to collect Kubernetes API information then do not need to serve up data as the API server will be used to provide access to the collected data. Storing data directly in etcd will allow troubleshoot to later serve up this same information by again starting an api-server and etcd using the previously collected etcd data store. This should remove almost all maintenance from troubleshoot for implementing API calls to access the collected information.
There will also be information that is desired to be stored that doesn't have any native representation in the api-server today. Examples could include custom collectors which execute into containers and extensions like [metrics server](https://github.com/kubernetes-sigs/metrics-server). These components can be addressed using the built in [Kubernetes API Aggregation Layer](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/) which is how `metrics server` itself works to extend and provide api based access to node information. By registering additional API extensions troubleshoot plugins can implement both a collection and an API for retrieving custom information which is accessible in the same fashion as the rest of the api-server.
The additional benefit to this, which can be demonstrated with `metrics-server`, is that collectors can be written for any other extension API and be compatible with existing tools the same way using the api-server provides compatibility with `kubectl`. Using `metrics-server` as an example, a collector can be written to collect node information which can be stored locally. The collector can then implement the standard [GET Endpoints](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/) from the metrics-server and reply to them with the results it collected. By doing so, all tools that work with metrics-server today, like `kubectl top` will also work with information served from a support bundle. Additionally, the collector implementation handles any custom file formats without exposing that to any other tool making it easy to maintain.
Any other access to the filesystem directly will be modified to instead use the provided api-server. This means analyzers will not directly reference files on disk and will instead run against the api-server to analyze the collected information. This decouples analyzers from how collectors store data providing clean separation of concerns for maintaining both collectors and analyzers. Decoupling these also creates a natural way to implement analyzers that use data from multiple collectors. This could also allow analyzers to run against existing clusters providing a use for analyzers independent of support bundle collection. This could encourage additional community contributions of analyzers.
An initially unintended benefit of using the Aggregation Layer is that any HostCollector using this implementation would be very close to an implementation of an extension which you could install in clusters. This could make HostCollectors also useful to install as a service in a live cluster for operations information about hosts.
## Detailed Design
### Outstanding design questions
1. How reasonable is it to start an api-server as part of troubleshoot? Consider the following known implementations that do something like this:
* [envtest](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/envtest) - requires binaries present on the machine
* [microk8s implementation](https://github.com/canonical/microk8s/blob/master/build-scripts/patches/0000-Kubelite-integration.patch) - bundles slightly modified binaries
* [k0s uses upstream binaries statically compiled](https://docs.k0sproject.io/v1.23.8+k0s.0/architecture/) - bundles statically compiled binaries that self extract and uses a process monitor to run them
2. Can you in fact push metadat like "Status" into an api-server or do we have to write directly to etcd?
* If we can't push to the api-server is just writing the information directly into etcd something we can do and have a reasonable expectation of compatibility?
3. Is the overhead to write an Aggregation API going to add an unnecessary burden to writing new collector plugins? Can these be templated into a reasonably to ease collector creation?
## Limitations
Using the actual API server will provide limitations on the version skew which can be collected/displayed. This could be addressed by including multiple versions of the kubernetes-api server to allow serving a wide range of support bundles. This limitation likely already exists today but would exist in the tooling that is trying to collect, analyzer, or server the data.
## Assumptions
* Serving logs hasn't been designed yet, and presumably can be addressed in the detailed design to provide logs to the api-server in place of kubelet. Ideally this can be done using the standard upstream kubernetes-api server it is undesirable to fork it.
* Running the api-server, etcd, and any other supporting services (like kubelet) as go routines while adding some overhead to the collection process won't cause a significant burden on ram or cpu to collect support bundles.
## Testing
## Alternatives Considered
### Keep sbctl separate
The current `sbctl` project could be left to run it's course independent of this project. This leaves the troubleshoot project reliant on a separate project to provide a good user experience for anything other than analyzers.
## Security Considerations
Consideration to how Redactors are implemented needs to be considered.
## References
Original PR discussion found [here](https://github.com/replicatedhq/troubleshoot/pull/611)
+21
View File
@@ -0,0 +1,21 @@
# Title
## Goals
## Non Goals
## Background
## High-Level Design
## Detailed Design
## Limitations
## Assumptions
## Testing
## Alternatives Considered
## Security Considerations
+9 -9
View File
@@ -7,15 +7,15 @@ spec:
- clusterVersion:
outcomes:
- fail:
when: "< 1.13.0"
message: This application requires at least Kubernetes 1.13.0 or later, and recommends 1.15.0.
when: "< 1.20.0"
message: This application requires at least Kubernetes 1.20.0, and recommends 1.22.0.
uri: https://www.kubernetes.io
- warn:
when: "< 1.15.0"
message: Your cluster meets the minimum version of Kubernetes, but we recommend you update to 1.15.0 or later.
when: "< 1.22.0"
message: Your cluster meets the minimum version of Kubernetes, but we recommend you update to 1.22.0 or later.
uri: https://kubernetes.io
- pass:
when: ">= 1.15.0"
when: ">= 1.22.0"
message: Your cluster meets the recommended and required versions of Kubernetes.
- customResourceDefinition:
checkName: Ingress
@@ -28,10 +28,10 @@ spec:
- containerRuntime:
outcomes:
- pass:
when: "== docker"
message: Docker container runtime was found.
when: "== containerd"
message: containerd container runtime was found.
- fail:
message: Did not find Docker container runtime.
message: Did not find containerd container runtime.
- storageClass:
checkName: Required storage classes
storageClassName: "default"
@@ -121,4 +121,4 @@ spec:
message: All nodes are recommended to have at least 100 GB of ephemeral storage.
uri: https://kurl.sh/docs/install-with-kurl/system-requirements
- pass:
message: All nodes have at least 100 GB of ephemeral storage.
message: All nodes have at least 100 GB of ephemeral storage.
@@ -8,7 +8,7 @@ spec:
selector:
- app=example
- component=nginx
namespace: repl{{ Namespace }}
namespace: default
limits:
maxAge: 720h # 30*24
maxLines: 10000
@@ -1,110 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package troubleshootclientset
import (
"fmt"
troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
)
type Interface interface {
Discovery() discovery.DiscoveryInterface
TroubleshootV1beta1() troubleshootv1beta1.TroubleshootV1beta1Interface
TroubleshootV1beta2() troubleshootv1beta2.TroubleshootV1beta2Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
troubleshootV1beta1 *troubleshootv1beta1.TroubleshootV1beta1Client
troubleshootV1beta2 *troubleshootv1beta2.TroubleshootV1beta2Client
}
// TroubleshootV1beta1 retrieves the TroubleshootV1beta1Client
func (c *Clientset) TroubleshootV1beta1() troubleshootv1beta1.TroubleshootV1beta1Interface {
return c.troubleshootV1beta1
}
// TroubleshootV1beta2 retrieves the TroubleshootV1beta2Client
func (c *Clientset) TroubleshootV1beta2() troubleshootv1beta2.TroubleshootV1beta2Interface {
return c.troubleshootV1beta2
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
if c == nil {
return nil
}
return c.DiscoveryClient
}
// NewForConfig creates a new Clientset for the given config.
// If config's RateLimiter is not set and QPS and Burst are acceptable,
// NewForConfig will generate a rate-limiter in configShallowCopy.
func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
if configShallowCopy.Burst <= 0 {
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
}
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}
var cs Clientset
var err error
cs.troubleshootV1beta1, err = troubleshootv1beta1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.troubleshootV1beta2, err = troubleshootv1beta2.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
return &cs, nil
}
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.troubleshootV1beta1 = troubleshootv1beta1.NewForConfigOrDie(c)
cs.troubleshootV1beta2 = troubleshootv1beta2.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
}
// New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.troubleshootV1beta1 = troubleshootv1beta1.New(c)
cs.troubleshootV1beta2 = troubleshootv1beta2.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
}
@@ -1,19 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated clientset.
package troubleshootclientset
@@ -1,91 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
clientset "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset"
troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1"
faketroubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2"
faketroubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/discovery"
fakediscovery "k8s.io/client-go/discovery/fake"
"k8s.io/client-go/testing"
)
// NewSimpleClientset returns a clientset that will respond with the provided objects.
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
// without applying any validations and/or defaults. It shouldn't be considered a replacement
// for a real clientset and is mostly useful in simple unit tests.
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
for _, obj := range objects {
if err := o.Add(obj); err != nil {
panic(err)
}
}
cs := &Clientset{tracker: o}
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
cs.AddReactor("*", "*", testing.ObjectReaction(o))
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
gvr := action.GetResource()
ns := action.GetNamespace()
watch, err := o.Watch(gvr, ns)
if err != nil {
return false, nil, err
}
return true, watch, nil
})
return cs
}
// Clientset implements clientset.Interface. Meant to be embedded into a
// struct to get a default implementation. This makes faking out just the method
// you want to test easier.
type Clientset struct {
testing.Fake
discovery *fakediscovery.FakeDiscovery
tracker testing.ObjectTracker
}
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return c.discovery
}
func (c *Clientset) Tracker() testing.ObjectTracker {
return c.tracker
}
var (
_ clientset.Interface = &Clientset{}
_ testing.FakeClient = &Clientset{}
)
// TroubleshootV1beta1 retrieves the TroubleshootV1beta1Client
func (c *Clientset) TroubleshootV1beta1() troubleshootv1beta1.TroubleshootV1beta1Interface {
return &faketroubleshootv1beta1.FakeTroubleshootV1beta1{Fake: &c.Fake}
}
// TroubleshootV1beta2 retrieves the TroubleshootV1beta2Client
func (c *Clientset) TroubleshootV1beta2() troubleshootv1beta2.TroubleshootV1beta2Interface {
return &faketroubleshootv1beta2.FakeTroubleshootV1beta2{Fake: &c.Fake}
}
@@ -1,19 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated fake clientset.
package fake
@@ -1,57 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)
var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
troubleshootv1beta1.AddToScheme,
troubleshootv1beta2.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(scheme))
}
@@ -1,19 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package contains the scheme of the automatically generated clientset.
package scheme
@@ -1,57 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package scheme
import (
troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)
var Scheme = runtime.NewScheme()
var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
troubleshootv1beta1.AddToScheme,
troubleshootv1beta2.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(Scheme))
}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"context"
"time"
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// AnalyzersGetter has a method to return a AnalyzerInterface.
// A group's client should implement this interface.
type AnalyzersGetter interface {
Analyzers(namespace string) AnalyzerInterface
}
// AnalyzerInterface has methods to work with Analyzer resources.
type AnalyzerInterface interface {
Create(ctx context.Context, analyzer *v1beta1.Analyzer, opts v1.CreateOptions) (*v1beta1.Analyzer, error)
Update(ctx context.Context, analyzer *v1beta1.Analyzer, opts v1.UpdateOptions) (*v1beta1.Analyzer, error)
UpdateStatus(ctx context.Context, analyzer *v1beta1.Analyzer, opts v1.UpdateOptions) (*v1beta1.Analyzer, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.Analyzer, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.AnalyzerList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Analyzer, err error)
AnalyzerExpansion
}
// analyzers implements AnalyzerInterface
type analyzers struct {
client rest.Interface
ns string
}
// newAnalyzers returns a Analyzers
func newAnalyzers(c *TroubleshootV1beta1Client, namespace string) *analyzers {
return &analyzers{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the analyzer, and returns the corresponding analyzer object, and an error if there is any.
func (c *analyzers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Analyzer, err error) {
result = &v1beta1.Analyzer{}
err = c.client.Get().
Namespace(c.ns).
Resource("analyzers").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Analyzers that match those selectors.
func (c *analyzers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.AnalyzerList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.AnalyzerList{}
err = c.client.Get().
Namespace(c.ns).
Resource("analyzers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested analyzers.
func (c *analyzers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("analyzers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a analyzer and creates it. Returns the server's representation of the analyzer, and an error, if there is any.
func (c *analyzers) Create(ctx context.Context, analyzer *v1beta1.Analyzer, opts v1.CreateOptions) (result *v1beta1.Analyzer, err error) {
result = &v1beta1.Analyzer{}
err = c.client.Post().
Namespace(c.ns).
Resource("analyzers").
VersionedParams(&opts, scheme.ParameterCodec).
Body(analyzer).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a analyzer and updates it. Returns the server's representation of the analyzer, and an error, if there is any.
func (c *analyzers) Update(ctx context.Context, analyzer *v1beta1.Analyzer, opts v1.UpdateOptions) (result *v1beta1.Analyzer, err error) {
result = &v1beta1.Analyzer{}
err = c.client.Put().
Namespace(c.ns).
Resource("analyzers").
Name(analyzer.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(analyzer).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *analyzers) UpdateStatus(ctx context.Context, analyzer *v1beta1.Analyzer, opts v1.UpdateOptions) (result *v1beta1.Analyzer, err error) {
result = &v1beta1.Analyzer{}
err = c.client.Put().
Namespace(c.ns).
Resource("analyzers").
Name(analyzer.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(analyzer).
Do(ctx).
Into(result)
return
}
// Delete takes name of the analyzer and deletes it. Returns an error if one occurs.
func (c *analyzers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("analyzers").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *analyzers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("analyzers").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched analyzer.
func (c *analyzers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Analyzer, err error) {
result = &v1beta1.Analyzer{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("analyzers").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"context"
"time"
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// CollectorsGetter has a method to return a CollectorInterface.
// A group's client should implement this interface.
type CollectorsGetter interface {
Collectors(namespace string) CollectorInterface
}
// CollectorInterface has methods to work with Collector resources.
type CollectorInterface interface {
Create(ctx context.Context, collector *v1beta1.Collector, opts v1.CreateOptions) (*v1beta1.Collector, error)
Update(ctx context.Context, collector *v1beta1.Collector, opts v1.UpdateOptions) (*v1beta1.Collector, error)
UpdateStatus(ctx context.Context, collector *v1beta1.Collector, opts v1.UpdateOptions) (*v1beta1.Collector, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.Collector, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.CollectorList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Collector, err error)
CollectorExpansion
}
// collectors implements CollectorInterface
type collectors struct {
client rest.Interface
ns string
}
// newCollectors returns a Collectors
func newCollectors(c *TroubleshootV1beta1Client, namespace string) *collectors {
return &collectors{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the collector, and returns the corresponding collector object, and an error if there is any.
func (c *collectors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Collector, err error) {
result = &v1beta1.Collector{}
err = c.client.Get().
Namespace(c.ns).
Resource("collectors").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Collectors that match those selectors.
func (c *collectors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.CollectorList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.CollectorList{}
err = c.client.Get().
Namespace(c.ns).
Resource("collectors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested collectors.
func (c *collectors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("collectors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a collector and creates it. Returns the server's representation of the collector, and an error, if there is any.
func (c *collectors) Create(ctx context.Context, collector *v1beta1.Collector, opts v1.CreateOptions) (result *v1beta1.Collector, err error) {
result = &v1beta1.Collector{}
err = c.client.Post().
Namespace(c.ns).
Resource("collectors").
VersionedParams(&opts, scheme.ParameterCodec).
Body(collector).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a collector and updates it. Returns the server's representation of the collector, and an error, if there is any.
func (c *collectors) Update(ctx context.Context, collector *v1beta1.Collector, opts v1.UpdateOptions) (result *v1beta1.Collector, err error) {
result = &v1beta1.Collector{}
err = c.client.Put().
Namespace(c.ns).
Resource("collectors").
Name(collector.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(collector).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *collectors) UpdateStatus(ctx context.Context, collector *v1beta1.Collector, opts v1.UpdateOptions) (result *v1beta1.Collector, err error) {
result = &v1beta1.Collector{}
err = c.client.Put().
Namespace(c.ns).
Resource("collectors").
Name(collector.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(collector).
Do(ctx).
Into(result)
return
}
// Delete takes name of the collector and deletes it. Returns an error if one occurs.
func (c *collectors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("collectors").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *collectors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("collectors").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched collector.
func (c *collectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Collector, err error) {
result = &v1beta1.Collector{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("collectors").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,19 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1beta1
@@ -1,19 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// Package fake has the automatically generated clients.
package fake
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeAnalyzers implements AnalyzerInterface
type FakeAnalyzers struct {
Fake *FakeTroubleshootV1beta1
ns string
}
var analyzersResource = schema.GroupVersionResource{Group: "troubleshoot.replicated.com", Version: "v1beta1", Resource: "analyzers"}
var analyzersKind = schema.GroupVersionKind{Group: "troubleshoot.replicated.com", Version: "v1beta1", Kind: "Analyzer"}
// Get takes name of the analyzer, and returns the corresponding analyzer object, and an error if there is any.
func (c *FakeAnalyzers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Analyzer, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(analyzersResource, c.ns, name), &v1beta1.Analyzer{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Analyzer), err
}
// List takes label and field selectors, and returns the list of Analyzers that match those selectors.
func (c *FakeAnalyzers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.AnalyzerList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(analyzersResource, analyzersKind, c.ns, opts), &v1beta1.AnalyzerList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.AnalyzerList{ListMeta: obj.(*v1beta1.AnalyzerList).ListMeta}
for _, item := range obj.(*v1beta1.AnalyzerList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested analyzers.
func (c *FakeAnalyzers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(analyzersResource, c.ns, opts))
}
// Create takes the representation of a analyzer and creates it. Returns the server's representation of the analyzer, and an error, if there is any.
func (c *FakeAnalyzers) Create(ctx context.Context, analyzer *v1beta1.Analyzer, opts v1.CreateOptions) (result *v1beta1.Analyzer, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(analyzersResource, c.ns, analyzer), &v1beta1.Analyzer{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Analyzer), err
}
// Update takes the representation of a analyzer and updates it. Returns the server's representation of the analyzer, and an error, if there is any.
func (c *FakeAnalyzers) Update(ctx context.Context, analyzer *v1beta1.Analyzer, opts v1.UpdateOptions) (result *v1beta1.Analyzer, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(analyzersResource, c.ns, analyzer), &v1beta1.Analyzer{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Analyzer), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeAnalyzers) UpdateStatus(ctx context.Context, analyzer *v1beta1.Analyzer, opts v1.UpdateOptions) (*v1beta1.Analyzer, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(analyzersResource, "status", c.ns, analyzer), &v1beta1.Analyzer{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Analyzer), err
}
// Delete takes name of the analyzer and deletes it. Returns an error if one occurs.
func (c *FakeAnalyzers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(analyzersResource, c.ns, name), &v1beta1.Analyzer{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeAnalyzers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(analyzersResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.AnalyzerList{})
return err
}
// Patch applies the patch and returns the patched analyzer.
func (c *FakeAnalyzers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Analyzer, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(analyzersResource, c.ns, name, pt, data, subresources...), &v1beta1.Analyzer{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Analyzer), err
}
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeCollectors implements CollectorInterface
type FakeCollectors struct {
Fake *FakeTroubleshootV1beta1
ns string
}
var collectorsResource = schema.GroupVersionResource{Group: "troubleshoot.replicated.com", Version: "v1beta1", Resource: "collectors"}
var collectorsKind = schema.GroupVersionKind{Group: "troubleshoot.replicated.com", Version: "v1beta1", Kind: "Collector"}
// Get takes name of the collector, and returns the corresponding collector object, and an error if there is any.
func (c *FakeCollectors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Collector, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(collectorsResource, c.ns, name), &v1beta1.Collector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Collector), err
}
// List takes label and field selectors, and returns the list of Collectors that match those selectors.
func (c *FakeCollectors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.CollectorList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(collectorsResource, collectorsKind, c.ns, opts), &v1beta1.CollectorList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.CollectorList{ListMeta: obj.(*v1beta1.CollectorList).ListMeta}
for _, item := range obj.(*v1beta1.CollectorList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested collectors.
func (c *FakeCollectors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(collectorsResource, c.ns, opts))
}
// Create takes the representation of a collector and creates it. Returns the server's representation of the collector, and an error, if there is any.
func (c *FakeCollectors) Create(ctx context.Context, collector *v1beta1.Collector, opts v1.CreateOptions) (result *v1beta1.Collector, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(collectorsResource, c.ns, collector), &v1beta1.Collector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Collector), err
}
// Update takes the representation of a collector and updates it. Returns the server's representation of the collector, and an error, if there is any.
func (c *FakeCollectors) Update(ctx context.Context, collector *v1beta1.Collector, opts v1.UpdateOptions) (result *v1beta1.Collector, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(collectorsResource, c.ns, collector), &v1beta1.Collector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Collector), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeCollectors) UpdateStatus(ctx context.Context, collector *v1beta1.Collector, opts v1.UpdateOptions) (*v1beta1.Collector, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(collectorsResource, "status", c.ns, collector), &v1beta1.Collector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Collector), err
}
// Delete takes name of the collector and deletes it. Returns an error if one occurs.
func (c *FakeCollectors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(collectorsResource, c.ns, name), &v1beta1.Collector{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeCollectors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(collectorsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.CollectorList{})
return err
}
// Patch applies the patch and returns the patched collector.
func (c *FakeCollectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Collector, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(collectorsResource, c.ns, name, pt, data, subresources...), &v1beta1.Collector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Collector), err
}
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakePreflights implements PreflightInterface
type FakePreflights struct {
Fake *FakeTroubleshootV1beta1
ns string
}
var preflightsResource = schema.GroupVersionResource{Group: "troubleshoot.replicated.com", Version: "v1beta1", Resource: "preflights"}
var preflightsKind = schema.GroupVersionKind{Group: "troubleshoot.replicated.com", Version: "v1beta1", Kind: "Preflight"}
// Get takes name of the preflight, and returns the corresponding preflight object, and an error if there is any.
func (c *FakePreflights) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Preflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(preflightsResource, c.ns, name), &v1beta1.Preflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Preflight), err
}
// List takes label and field selectors, and returns the list of Preflights that match those selectors.
func (c *FakePreflights) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.PreflightList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(preflightsResource, preflightsKind, c.ns, opts), &v1beta1.PreflightList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.PreflightList{ListMeta: obj.(*v1beta1.PreflightList).ListMeta}
for _, item := range obj.(*v1beta1.PreflightList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested preflights.
func (c *FakePreflights) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(preflightsResource, c.ns, opts))
}
// Create takes the representation of a preflight and creates it. Returns the server's representation of the preflight, and an error, if there is any.
func (c *FakePreflights) Create(ctx context.Context, preflight *v1beta1.Preflight, opts v1.CreateOptions) (result *v1beta1.Preflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(preflightsResource, c.ns, preflight), &v1beta1.Preflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Preflight), err
}
// Update takes the representation of a preflight and updates it. Returns the server's representation of the preflight, and an error, if there is any.
func (c *FakePreflights) Update(ctx context.Context, preflight *v1beta1.Preflight, opts v1.UpdateOptions) (result *v1beta1.Preflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(preflightsResource, c.ns, preflight), &v1beta1.Preflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Preflight), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakePreflights) UpdateStatus(ctx context.Context, preflight *v1beta1.Preflight, opts v1.UpdateOptions) (*v1beta1.Preflight, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(preflightsResource, "status", c.ns, preflight), &v1beta1.Preflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Preflight), err
}
// Delete takes name of the preflight and deletes it. Returns an error if one occurs.
func (c *FakePreflights) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(preflightsResource, c.ns, name), &v1beta1.Preflight{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakePreflights) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(preflightsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.PreflightList{})
return err
}
// Patch applies the patch and returns the patched preflight.
func (c *FakePreflights) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Preflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(preflightsResource, c.ns, name, pt, data, subresources...), &v1beta1.Preflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Preflight), err
}
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeRedactors implements RedactorInterface
type FakeRedactors struct {
Fake *FakeTroubleshootV1beta1
ns string
}
var redactorsResource = schema.GroupVersionResource{Group: "troubleshoot.replicated.com", Version: "v1beta1", Resource: "redactors"}
var redactorsKind = schema.GroupVersionKind{Group: "troubleshoot.replicated.com", Version: "v1beta1", Kind: "Redactor"}
// Get takes name of the redactor, and returns the corresponding redactor object, and an error if there is any.
func (c *FakeRedactors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Redactor, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(redactorsResource, c.ns, name), &v1beta1.Redactor{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Redactor), err
}
// List takes label and field selectors, and returns the list of Redactors that match those selectors.
func (c *FakeRedactors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.RedactorList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(redactorsResource, redactorsKind, c.ns, opts), &v1beta1.RedactorList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.RedactorList{ListMeta: obj.(*v1beta1.RedactorList).ListMeta}
for _, item := range obj.(*v1beta1.RedactorList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested redactors.
func (c *FakeRedactors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(redactorsResource, c.ns, opts))
}
// Create takes the representation of a redactor and creates it. Returns the server's representation of the redactor, and an error, if there is any.
func (c *FakeRedactors) Create(ctx context.Context, redactor *v1beta1.Redactor, opts v1.CreateOptions) (result *v1beta1.Redactor, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(redactorsResource, c.ns, redactor), &v1beta1.Redactor{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Redactor), err
}
// Update takes the representation of a redactor and updates it. Returns the server's representation of the redactor, and an error, if there is any.
func (c *FakeRedactors) Update(ctx context.Context, redactor *v1beta1.Redactor, opts v1.UpdateOptions) (result *v1beta1.Redactor, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(redactorsResource, c.ns, redactor), &v1beta1.Redactor{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Redactor), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeRedactors) UpdateStatus(ctx context.Context, redactor *v1beta1.Redactor, opts v1.UpdateOptions) (*v1beta1.Redactor, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(redactorsResource, "status", c.ns, redactor), &v1beta1.Redactor{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Redactor), err
}
// Delete takes name of the redactor and deletes it. Returns an error if one occurs.
func (c *FakeRedactors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(redactorsResource, c.ns, name), &v1beta1.Redactor{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeRedactors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(redactorsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.RedactorList{})
return err
}
// Patch applies the patch and returns the patched redactor.
func (c *FakeRedactors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Redactor, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(redactorsResource, c.ns, name, pt, data, subresources...), &v1beta1.Redactor{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Redactor), err
}
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeSupportBundles implements SupportBundleInterface
type FakeSupportBundles struct {
Fake *FakeTroubleshootV1beta1
ns string
}
var supportbundlesResource = schema.GroupVersionResource{Group: "troubleshoot.replicated.com", Version: "v1beta1", Resource: "supportbundles"}
var supportbundlesKind = schema.GroupVersionKind{Group: "troubleshoot.replicated.com", Version: "v1beta1", Kind: "SupportBundle"}
// Get takes name of the supportBundle, and returns the corresponding supportBundle object, and an error if there is any.
func (c *FakeSupportBundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.SupportBundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(supportbundlesResource, c.ns, name), &v1beta1.SupportBundle{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.SupportBundle), err
}
// List takes label and field selectors, and returns the list of SupportBundles that match those selectors.
func (c *FakeSupportBundles) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.SupportBundleList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(supportbundlesResource, supportbundlesKind, c.ns, opts), &v1beta1.SupportBundleList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.SupportBundleList{ListMeta: obj.(*v1beta1.SupportBundleList).ListMeta}
for _, item := range obj.(*v1beta1.SupportBundleList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested supportBundles.
func (c *FakeSupportBundles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(supportbundlesResource, c.ns, opts))
}
// Create takes the representation of a supportBundle and creates it. Returns the server's representation of the supportBundle, and an error, if there is any.
func (c *FakeSupportBundles) Create(ctx context.Context, supportBundle *v1beta1.SupportBundle, opts v1.CreateOptions) (result *v1beta1.SupportBundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(supportbundlesResource, c.ns, supportBundle), &v1beta1.SupportBundle{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.SupportBundle), err
}
// Update takes the representation of a supportBundle and updates it. Returns the server's representation of the supportBundle, and an error, if there is any.
func (c *FakeSupportBundles) Update(ctx context.Context, supportBundle *v1beta1.SupportBundle, opts v1.UpdateOptions) (result *v1beta1.SupportBundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(supportbundlesResource, c.ns, supportBundle), &v1beta1.SupportBundle{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.SupportBundle), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeSupportBundles) UpdateStatus(ctx context.Context, supportBundle *v1beta1.SupportBundle, opts v1.UpdateOptions) (*v1beta1.SupportBundle, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(supportbundlesResource, "status", c.ns, supportBundle), &v1beta1.SupportBundle{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.SupportBundle), err
}
// Delete takes name of the supportBundle and deletes it. Returns an error if one occurs.
func (c *FakeSupportBundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(supportbundlesResource, c.ns, name), &v1beta1.SupportBundle{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeSupportBundles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(supportbundlesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.SupportBundleList{})
return err
}
// Patch applies the patch and returns the patched supportBundle.
func (c *FakeSupportBundles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.SupportBundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(supportbundlesResource, c.ns, name, pt, data, subresources...), &v1beta1.SupportBundle{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.SupportBundle), err
}
@@ -1,55 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeTroubleshootV1beta1 struct {
*testing.Fake
}
func (c *FakeTroubleshootV1beta1) Analyzers(namespace string) v1beta1.AnalyzerInterface {
return &FakeAnalyzers{c, namespace}
}
func (c *FakeTroubleshootV1beta1) Collectors(namespace string) v1beta1.CollectorInterface {
return &FakeCollectors{c, namespace}
}
func (c *FakeTroubleshootV1beta1) Preflights(namespace string) v1beta1.PreflightInterface {
return &FakePreflights{c, namespace}
}
func (c *FakeTroubleshootV1beta1) Redactors(namespace string) v1beta1.RedactorInterface {
return &FakeRedactors{c, namespace}
}
func (c *FakeTroubleshootV1beta1) SupportBundles(namespace string) v1beta1.SupportBundleInterface {
return &FakeSupportBundles{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeTroubleshootV1beta1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}
@@ -1,28 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
type AnalyzerExpansion interface{}
type CollectorExpansion interface{}
type PreflightExpansion interface{}
type RedactorExpansion interface{}
type SupportBundleExpansion interface{}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"context"
"time"
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// PreflightsGetter has a method to return a PreflightInterface.
// A group's client should implement this interface.
type PreflightsGetter interface {
Preflights(namespace string) PreflightInterface
}
// PreflightInterface has methods to work with Preflight resources.
type PreflightInterface interface {
Create(ctx context.Context, preflight *v1beta1.Preflight, opts v1.CreateOptions) (*v1beta1.Preflight, error)
Update(ctx context.Context, preflight *v1beta1.Preflight, opts v1.UpdateOptions) (*v1beta1.Preflight, error)
UpdateStatus(ctx context.Context, preflight *v1beta1.Preflight, opts v1.UpdateOptions) (*v1beta1.Preflight, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.Preflight, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.PreflightList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Preflight, err error)
PreflightExpansion
}
// preflights implements PreflightInterface
type preflights struct {
client rest.Interface
ns string
}
// newPreflights returns a Preflights
func newPreflights(c *TroubleshootV1beta1Client, namespace string) *preflights {
return &preflights{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the preflight, and returns the corresponding preflight object, and an error if there is any.
func (c *preflights) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Preflight, err error) {
result = &v1beta1.Preflight{}
err = c.client.Get().
Namespace(c.ns).
Resource("preflights").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Preflights that match those selectors.
func (c *preflights) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.PreflightList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.PreflightList{}
err = c.client.Get().
Namespace(c.ns).
Resource("preflights").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested preflights.
func (c *preflights) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("preflights").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a preflight and creates it. Returns the server's representation of the preflight, and an error, if there is any.
func (c *preflights) Create(ctx context.Context, preflight *v1beta1.Preflight, opts v1.CreateOptions) (result *v1beta1.Preflight, err error) {
result = &v1beta1.Preflight{}
err = c.client.Post().
Namespace(c.ns).
Resource("preflights").
VersionedParams(&opts, scheme.ParameterCodec).
Body(preflight).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a preflight and updates it. Returns the server's representation of the preflight, and an error, if there is any.
func (c *preflights) Update(ctx context.Context, preflight *v1beta1.Preflight, opts v1.UpdateOptions) (result *v1beta1.Preflight, err error) {
result = &v1beta1.Preflight{}
err = c.client.Put().
Namespace(c.ns).
Resource("preflights").
Name(preflight.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(preflight).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *preflights) UpdateStatus(ctx context.Context, preflight *v1beta1.Preflight, opts v1.UpdateOptions) (result *v1beta1.Preflight, err error) {
result = &v1beta1.Preflight{}
err = c.client.Put().
Namespace(c.ns).
Resource("preflights").
Name(preflight.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(preflight).
Do(ctx).
Into(result)
return
}
// Delete takes name of the preflight and deletes it. Returns an error if one occurs.
func (c *preflights) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("preflights").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *preflights) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("preflights").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched preflight.
func (c *preflights) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Preflight, err error) {
result = &v1beta1.Preflight{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("preflights").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"context"
"time"
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// RedactorsGetter has a method to return a RedactorInterface.
// A group's client should implement this interface.
type RedactorsGetter interface {
Redactors(namespace string) RedactorInterface
}
// RedactorInterface has methods to work with Redactor resources.
type RedactorInterface interface {
Create(ctx context.Context, redactor *v1beta1.Redactor, opts v1.CreateOptions) (*v1beta1.Redactor, error)
Update(ctx context.Context, redactor *v1beta1.Redactor, opts v1.UpdateOptions) (*v1beta1.Redactor, error)
UpdateStatus(ctx context.Context, redactor *v1beta1.Redactor, opts v1.UpdateOptions) (*v1beta1.Redactor, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.Redactor, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.RedactorList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Redactor, err error)
RedactorExpansion
}
// redactors implements RedactorInterface
type redactors struct {
client rest.Interface
ns string
}
// newRedactors returns a Redactors
func newRedactors(c *TroubleshootV1beta1Client, namespace string) *redactors {
return &redactors{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the redactor, and returns the corresponding redactor object, and an error if there is any.
func (c *redactors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Redactor, err error) {
result = &v1beta1.Redactor{}
err = c.client.Get().
Namespace(c.ns).
Resource("redactors").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Redactors that match those selectors.
func (c *redactors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.RedactorList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.RedactorList{}
err = c.client.Get().
Namespace(c.ns).
Resource("redactors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested redactors.
func (c *redactors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("redactors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a redactor and creates it. Returns the server's representation of the redactor, and an error, if there is any.
func (c *redactors) Create(ctx context.Context, redactor *v1beta1.Redactor, opts v1.CreateOptions) (result *v1beta1.Redactor, err error) {
result = &v1beta1.Redactor{}
err = c.client.Post().
Namespace(c.ns).
Resource("redactors").
VersionedParams(&opts, scheme.ParameterCodec).
Body(redactor).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a redactor and updates it. Returns the server's representation of the redactor, and an error, if there is any.
func (c *redactors) Update(ctx context.Context, redactor *v1beta1.Redactor, opts v1.UpdateOptions) (result *v1beta1.Redactor, err error) {
result = &v1beta1.Redactor{}
err = c.client.Put().
Namespace(c.ns).
Resource("redactors").
Name(redactor.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(redactor).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *redactors) UpdateStatus(ctx context.Context, redactor *v1beta1.Redactor, opts v1.UpdateOptions) (result *v1beta1.Redactor, err error) {
result = &v1beta1.Redactor{}
err = c.client.Put().
Namespace(c.ns).
Resource("redactors").
Name(redactor.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(redactor).
Do(ctx).
Into(result)
return
}
// Delete takes name of the redactor and deletes it. Returns an error if one occurs.
func (c *redactors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("redactors").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *redactors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("redactors").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched redactor.
func (c *redactors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Redactor, err error) {
result = &v1beta1.Redactor{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("redactors").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"context"
"time"
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// SupportBundlesGetter has a method to return a SupportBundleInterface.
// A group's client should implement this interface.
type SupportBundlesGetter interface {
SupportBundles(namespace string) SupportBundleInterface
}
// SupportBundleInterface has methods to work with SupportBundle resources.
type SupportBundleInterface interface {
Create(ctx context.Context, supportBundle *v1beta1.SupportBundle, opts v1.CreateOptions) (*v1beta1.SupportBundle, error)
Update(ctx context.Context, supportBundle *v1beta1.SupportBundle, opts v1.UpdateOptions) (*v1beta1.SupportBundle, error)
UpdateStatus(ctx context.Context, supportBundle *v1beta1.SupportBundle, opts v1.UpdateOptions) (*v1beta1.SupportBundle, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.SupportBundle, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.SupportBundleList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.SupportBundle, err error)
SupportBundleExpansion
}
// supportBundles implements SupportBundleInterface
type supportBundles struct {
client rest.Interface
ns string
}
// newSupportBundles returns a SupportBundles
func newSupportBundles(c *TroubleshootV1beta1Client, namespace string) *supportBundles {
return &supportBundles{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the supportBundle, and returns the corresponding supportBundle object, and an error if there is any.
func (c *supportBundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.SupportBundle, err error) {
result = &v1beta1.SupportBundle{}
err = c.client.Get().
Namespace(c.ns).
Resource("supportbundles").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of SupportBundles that match those selectors.
func (c *supportBundles) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.SupportBundleList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.SupportBundleList{}
err = c.client.Get().
Namespace(c.ns).
Resource("supportbundles").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested supportBundles.
func (c *supportBundles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("supportbundles").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a supportBundle and creates it. Returns the server's representation of the supportBundle, and an error, if there is any.
func (c *supportBundles) Create(ctx context.Context, supportBundle *v1beta1.SupportBundle, opts v1.CreateOptions) (result *v1beta1.SupportBundle, err error) {
result = &v1beta1.SupportBundle{}
err = c.client.Post().
Namespace(c.ns).
Resource("supportbundles").
VersionedParams(&opts, scheme.ParameterCodec).
Body(supportBundle).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a supportBundle and updates it. Returns the server's representation of the supportBundle, and an error, if there is any.
func (c *supportBundles) Update(ctx context.Context, supportBundle *v1beta1.SupportBundle, opts v1.UpdateOptions) (result *v1beta1.SupportBundle, err error) {
result = &v1beta1.SupportBundle{}
err = c.client.Put().
Namespace(c.ns).
Resource("supportbundles").
Name(supportBundle.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(supportBundle).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *supportBundles) UpdateStatus(ctx context.Context, supportBundle *v1beta1.SupportBundle, opts v1.UpdateOptions) (result *v1beta1.SupportBundle, err error) {
result = &v1beta1.SupportBundle{}
err = c.client.Put().
Namespace(c.ns).
Resource("supportbundles").
Name(supportBundle.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(supportBundle).
Do(ctx).
Into(result)
return
}
// Delete takes name of the supportBundle and deletes it. Returns an error if one occurs.
func (c *supportBundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("supportbundles").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *supportBundles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("supportbundles").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched supportBundle.
func (c *supportBundles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.SupportBundle, err error) {
result = &v1beta1.SupportBundle{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("supportbundles").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,108 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
"github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
rest "k8s.io/client-go/rest"
)
type TroubleshootV1beta1Interface interface {
RESTClient() rest.Interface
AnalyzersGetter
CollectorsGetter
PreflightsGetter
RedactorsGetter
SupportBundlesGetter
}
// TroubleshootV1beta1Client is used to interact with features provided by the troubleshoot.replicated.com group.
type TroubleshootV1beta1Client struct {
restClient rest.Interface
}
func (c *TroubleshootV1beta1Client) Analyzers(namespace string) AnalyzerInterface {
return newAnalyzers(c, namespace)
}
func (c *TroubleshootV1beta1Client) Collectors(namespace string) CollectorInterface {
return newCollectors(c, namespace)
}
func (c *TroubleshootV1beta1Client) Preflights(namespace string) PreflightInterface {
return newPreflights(c, namespace)
}
func (c *TroubleshootV1beta1Client) Redactors(namespace string) RedactorInterface {
return newRedactors(c, namespace)
}
func (c *TroubleshootV1beta1Client) SupportBundles(namespace string) SupportBundleInterface {
return newSupportBundles(c, namespace)
}
// NewForConfig creates a new TroubleshootV1beta1Client for the given config.
func NewForConfig(c *rest.Config) (*TroubleshootV1beta1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &TroubleshootV1beta1Client{client}, nil
}
// NewForConfigOrDie creates a new TroubleshootV1beta1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *TroubleshootV1beta1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new TroubleshootV1beta1Client for the given RESTClient.
func New(c rest.Interface) *TroubleshootV1beta1Client {
return &TroubleshootV1beta1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1beta1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *TroubleshootV1beta1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta2
import (
"context"
"time"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// AnalyzersGetter has a method to return a AnalyzerInterface.
// A group's client should implement this interface.
type AnalyzersGetter interface {
Analyzers(namespace string) AnalyzerInterface
}
// AnalyzerInterface has methods to work with Analyzer resources.
type AnalyzerInterface interface {
Create(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.CreateOptions) (*v1beta2.Analyzer, error)
Update(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (*v1beta2.Analyzer, error)
UpdateStatus(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (*v1beta2.Analyzer, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.Analyzer, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta2.AnalyzerList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Analyzer, err error)
AnalyzerExpansion
}
// analyzers implements AnalyzerInterface
type analyzers struct {
client rest.Interface
ns string
}
// newAnalyzers returns a Analyzers
func newAnalyzers(c *TroubleshootV1beta2Client, namespace string) *analyzers {
return &analyzers{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the analyzer, and returns the corresponding analyzer object, and an error if there is any.
func (c *analyzers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Analyzer, err error) {
result = &v1beta2.Analyzer{}
err = c.client.Get().
Namespace(c.ns).
Resource("analyzers").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Analyzers that match those selectors.
func (c *analyzers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.AnalyzerList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta2.AnalyzerList{}
err = c.client.Get().
Namespace(c.ns).
Resource("analyzers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested analyzers.
func (c *analyzers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("analyzers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a analyzer and creates it. Returns the server's representation of the analyzer, and an error, if there is any.
func (c *analyzers) Create(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.CreateOptions) (result *v1beta2.Analyzer, err error) {
result = &v1beta2.Analyzer{}
err = c.client.Post().
Namespace(c.ns).
Resource("analyzers").
VersionedParams(&opts, scheme.ParameterCodec).
Body(analyzer).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a analyzer and updates it. Returns the server's representation of the analyzer, and an error, if there is any.
func (c *analyzers) Update(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (result *v1beta2.Analyzer, err error) {
result = &v1beta2.Analyzer{}
err = c.client.Put().
Namespace(c.ns).
Resource("analyzers").
Name(analyzer.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(analyzer).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *analyzers) UpdateStatus(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (result *v1beta2.Analyzer, err error) {
result = &v1beta2.Analyzer{}
err = c.client.Put().
Namespace(c.ns).
Resource("analyzers").
Name(analyzer.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(analyzer).
Do(ctx).
Into(result)
return
}
// Delete takes name of the analyzer and deletes it. Returns an error if one occurs.
func (c *analyzers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("analyzers").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *analyzers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("analyzers").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched analyzer.
func (c *analyzers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Analyzer, err error) {
result = &v1beta2.Analyzer{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("analyzers").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta2
import (
"context"
"time"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// CollectorsGetter has a method to return a CollectorInterface.
// A group's client should implement this interface.
type CollectorsGetter interface {
Collectors(namespace string) CollectorInterface
}
// CollectorInterface has methods to work with Collector resources.
type CollectorInterface interface {
Create(ctx context.Context, collector *v1beta2.Collector, opts v1.CreateOptions) (*v1beta2.Collector, error)
Update(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (*v1beta2.Collector, error)
UpdateStatus(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (*v1beta2.Collector, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.Collector, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta2.CollectorList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Collector, err error)
CollectorExpansion
}
// collectors implements CollectorInterface
type collectors struct {
client rest.Interface
ns string
}
// newCollectors returns a Collectors
func newCollectors(c *TroubleshootV1beta2Client, namespace string) *collectors {
return &collectors{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the collector, and returns the corresponding collector object, and an error if there is any.
func (c *collectors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Collector, err error) {
result = &v1beta2.Collector{}
err = c.client.Get().
Namespace(c.ns).
Resource("collectors").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Collectors that match those selectors.
func (c *collectors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.CollectorList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta2.CollectorList{}
err = c.client.Get().
Namespace(c.ns).
Resource("collectors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested collectors.
func (c *collectors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("collectors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a collector and creates it. Returns the server's representation of the collector, and an error, if there is any.
func (c *collectors) Create(ctx context.Context, collector *v1beta2.Collector, opts v1.CreateOptions) (result *v1beta2.Collector, err error) {
result = &v1beta2.Collector{}
err = c.client.Post().
Namespace(c.ns).
Resource("collectors").
VersionedParams(&opts, scheme.ParameterCodec).
Body(collector).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a collector and updates it. Returns the server's representation of the collector, and an error, if there is any.
func (c *collectors) Update(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (result *v1beta2.Collector, err error) {
result = &v1beta2.Collector{}
err = c.client.Put().
Namespace(c.ns).
Resource("collectors").
Name(collector.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(collector).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *collectors) UpdateStatus(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (result *v1beta2.Collector, err error) {
result = &v1beta2.Collector{}
err = c.client.Put().
Namespace(c.ns).
Resource("collectors").
Name(collector.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(collector).
Do(ctx).
Into(result)
return
}
// Delete takes name of the collector and deletes it. Returns an error if one occurs.
func (c *collectors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("collectors").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *collectors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("collectors").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched collector.
func (c *collectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Collector, err error) {
result = &v1beta2.Collector{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("collectors").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,19 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1beta2
@@ -1,19 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// Package fake has the automatically generated clients.
package fake
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeAnalyzers implements AnalyzerInterface
type FakeAnalyzers struct {
Fake *FakeTroubleshootV1beta2
ns string
}
var analyzersResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "analyzers"}
var analyzersKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "Analyzer"}
// Get takes name of the analyzer, and returns the corresponding analyzer object, and an error if there is any.
func (c *FakeAnalyzers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Analyzer, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(analyzersResource, c.ns, name), &v1beta2.Analyzer{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Analyzer), err
}
// List takes label and field selectors, and returns the list of Analyzers that match those selectors.
func (c *FakeAnalyzers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.AnalyzerList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(analyzersResource, analyzersKind, c.ns, opts), &v1beta2.AnalyzerList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.AnalyzerList{ListMeta: obj.(*v1beta2.AnalyzerList).ListMeta}
for _, item := range obj.(*v1beta2.AnalyzerList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested analyzers.
func (c *FakeAnalyzers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(analyzersResource, c.ns, opts))
}
// Create takes the representation of a analyzer and creates it. Returns the server's representation of the analyzer, and an error, if there is any.
func (c *FakeAnalyzers) Create(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.CreateOptions) (result *v1beta2.Analyzer, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(analyzersResource, c.ns, analyzer), &v1beta2.Analyzer{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Analyzer), err
}
// Update takes the representation of a analyzer and updates it. Returns the server's representation of the analyzer, and an error, if there is any.
func (c *FakeAnalyzers) Update(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (result *v1beta2.Analyzer, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(analyzersResource, c.ns, analyzer), &v1beta2.Analyzer{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Analyzer), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeAnalyzers) UpdateStatus(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (*v1beta2.Analyzer, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(analyzersResource, "status", c.ns, analyzer), &v1beta2.Analyzer{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Analyzer), err
}
// Delete takes name of the analyzer and deletes it. Returns an error if one occurs.
func (c *FakeAnalyzers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(analyzersResource, c.ns, name), &v1beta2.Analyzer{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeAnalyzers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(analyzersResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.AnalyzerList{})
return err
}
// Patch applies the patch and returns the patched analyzer.
func (c *FakeAnalyzers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Analyzer, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(analyzersResource, c.ns, name, pt, data, subresources...), &v1beta2.Analyzer{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Analyzer), err
}
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeCollectors implements CollectorInterface
type FakeCollectors struct {
Fake *FakeTroubleshootV1beta2
ns string
}
var collectorsResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "collectors"}
var collectorsKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "Collector"}
// Get takes name of the collector, and returns the corresponding collector object, and an error if there is any.
func (c *FakeCollectors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Collector, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(collectorsResource, c.ns, name), &v1beta2.Collector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Collector), err
}
// List takes label and field selectors, and returns the list of Collectors that match those selectors.
func (c *FakeCollectors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.CollectorList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(collectorsResource, collectorsKind, c.ns, opts), &v1beta2.CollectorList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.CollectorList{ListMeta: obj.(*v1beta2.CollectorList).ListMeta}
for _, item := range obj.(*v1beta2.CollectorList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested collectors.
func (c *FakeCollectors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(collectorsResource, c.ns, opts))
}
// Create takes the representation of a collector and creates it. Returns the server's representation of the collector, and an error, if there is any.
func (c *FakeCollectors) Create(ctx context.Context, collector *v1beta2.Collector, opts v1.CreateOptions) (result *v1beta2.Collector, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(collectorsResource, c.ns, collector), &v1beta2.Collector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Collector), err
}
// Update takes the representation of a collector and updates it. Returns the server's representation of the collector, and an error, if there is any.
func (c *FakeCollectors) Update(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (result *v1beta2.Collector, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(collectorsResource, c.ns, collector), &v1beta2.Collector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Collector), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeCollectors) UpdateStatus(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (*v1beta2.Collector, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(collectorsResource, "status", c.ns, collector), &v1beta2.Collector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Collector), err
}
// Delete takes name of the collector and deletes it. Returns an error if one occurs.
func (c *FakeCollectors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(collectorsResource, c.ns, name), &v1beta2.Collector{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeCollectors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(collectorsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.CollectorList{})
return err
}
// Patch applies the patch and returns the patched collector.
func (c *FakeCollectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Collector, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(collectorsResource, c.ns, name, pt, data, subresources...), &v1beta2.Collector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Collector), err
}
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeHostCollectors implements HostCollectorInterface
type FakeHostCollectors struct {
Fake *FakeTroubleshootV1beta2
ns string
}
var hostcollectorsResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "hostcollectors"}
var hostcollectorsKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "HostCollector"}
// Get takes name of the hostCollector, and returns the corresponding hostCollector object, and an error if there is any.
func (c *FakeHostCollectors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.HostCollector, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(hostcollectorsResource, c.ns, name), &v1beta2.HostCollector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.HostCollector), err
}
// List takes label and field selectors, and returns the list of HostCollectors that match those selectors.
func (c *FakeHostCollectors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.HostCollectorList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(hostcollectorsResource, hostcollectorsKind, c.ns, opts), &v1beta2.HostCollectorList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.HostCollectorList{ListMeta: obj.(*v1beta2.HostCollectorList).ListMeta}
for _, item := range obj.(*v1beta2.HostCollectorList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested hostCollectors.
func (c *FakeHostCollectors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(hostcollectorsResource, c.ns, opts))
}
// Create takes the representation of a hostCollector and creates it. Returns the server's representation of the hostCollector, and an error, if there is any.
func (c *FakeHostCollectors) Create(ctx context.Context, hostCollector *v1beta2.HostCollector, opts v1.CreateOptions) (result *v1beta2.HostCollector, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(hostcollectorsResource, c.ns, hostCollector), &v1beta2.HostCollector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.HostCollector), err
}
// Update takes the representation of a hostCollector and updates it. Returns the server's representation of the hostCollector, and an error, if there is any.
func (c *FakeHostCollectors) Update(ctx context.Context, hostCollector *v1beta2.HostCollector, opts v1.UpdateOptions) (result *v1beta2.HostCollector, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(hostcollectorsResource, c.ns, hostCollector), &v1beta2.HostCollector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.HostCollector), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeHostCollectors) UpdateStatus(ctx context.Context, hostCollector *v1beta2.HostCollector, opts v1.UpdateOptions) (*v1beta2.HostCollector, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(hostcollectorsResource, "status", c.ns, hostCollector), &v1beta2.HostCollector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.HostCollector), err
}
// Delete takes name of the hostCollector and deletes it. Returns an error if one occurs.
func (c *FakeHostCollectors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(hostcollectorsResource, c.ns, name), &v1beta2.HostCollector{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeHostCollectors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(hostcollectorsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.HostCollectorList{})
return err
}
// Patch applies the patch and returns the patched hostCollector.
func (c *FakeHostCollectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.HostCollector, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(hostcollectorsResource, c.ns, name, pt, data, subresources...), &v1beta2.HostCollector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.HostCollector), err
}
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeHostPreflights implements HostPreflightInterface
type FakeHostPreflights struct {
Fake *FakeTroubleshootV1beta2
ns string
}
var hostpreflightsResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "hostpreflights"}
var hostpreflightsKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "HostPreflight"}
// Get takes name of the hostPreflight, and returns the corresponding hostPreflight object, and an error if there is any.
func (c *FakeHostPreflights) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.HostPreflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(hostpreflightsResource, c.ns, name), &v1beta2.HostPreflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.HostPreflight), err
}
// List takes label and field selectors, and returns the list of HostPreflights that match those selectors.
func (c *FakeHostPreflights) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.HostPreflightList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(hostpreflightsResource, hostpreflightsKind, c.ns, opts), &v1beta2.HostPreflightList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.HostPreflightList{ListMeta: obj.(*v1beta2.HostPreflightList).ListMeta}
for _, item := range obj.(*v1beta2.HostPreflightList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested hostPreflights.
func (c *FakeHostPreflights) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(hostpreflightsResource, c.ns, opts))
}
// Create takes the representation of a hostPreflight and creates it. Returns the server's representation of the hostPreflight, and an error, if there is any.
func (c *FakeHostPreflights) Create(ctx context.Context, hostPreflight *v1beta2.HostPreflight, opts v1.CreateOptions) (result *v1beta2.HostPreflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(hostpreflightsResource, c.ns, hostPreflight), &v1beta2.HostPreflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.HostPreflight), err
}
// Update takes the representation of a hostPreflight and updates it. Returns the server's representation of the hostPreflight, and an error, if there is any.
func (c *FakeHostPreflights) Update(ctx context.Context, hostPreflight *v1beta2.HostPreflight, opts v1.UpdateOptions) (result *v1beta2.HostPreflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(hostpreflightsResource, c.ns, hostPreflight), &v1beta2.HostPreflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.HostPreflight), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeHostPreflights) UpdateStatus(ctx context.Context, hostPreflight *v1beta2.HostPreflight, opts v1.UpdateOptions) (*v1beta2.HostPreflight, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(hostpreflightsResource, "status", c.ns, hostPreflight), &v1beta2.HostPreflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.HostPreflight), err
}
// Delete takes name of the hostPreflight and deletes it. Returns an error if one occurs.
func (c *FakeHostPreflights) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(hostpreflightsResource, c.ns, name), &v1beta2.HostPreflight{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeHostPreflights) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(hostpreflightsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.HostPreflightList{})
return err
}
// Patch applies the patch and returns the patched hostPreflight.
func (c *FakeHostPreflights) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.HostPreflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(hostpreflightsResource, c.ns, name, pt, data, subresources...), &v1beta2.HostPreflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.HostPreflight), err
}
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakePreflights implements PreflightInterface
type FakePreflights struct {
Fake *FakeTroubleshootV1beta2
ns string
}
var preflightsResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "preflights"}
var preflightsKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "Preflight"}
// Get takes name of the preflight, and returns the corresponding preflight object, and an error if there is any.
func (c *FakePreflights) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Preflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(preflightsResource, c.ns, name), &v1beta2.Preflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Preflight), err
}
// List takes label and field selectors, and returns the list of Preflights that match those selectors.
func (c *FakePreflights) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.PreflightList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(preflightsResource, preflightsKind, c.ns, opts), &v1beta2.PreflightList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.PreflightList{ListMeta: obj.(*v1beta2.PreflightList).ListMeta}
for _, item := range obj.(*v1beta2.PreflightList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested preflights.
func (c *FakePreflights) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(preflightsResource, c.ns, opts))
}
// Create takes the representation of a preflight and creates it. Returns the server's representation of the preflight, and an error, if there is any.
func (c *FakePreflights) Create(ctx context.Context, preflight *v1beta2.Preflight, opts v1.CreateOptions) (result *v1beta2.Preflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(preflightsResource, c.ns, preflight), &v1beta2.Preflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Preflight), err
}
// Update takes the representation of a preflight and updates it. Returns the server's representation of the preflight, and an error, if there is any.
func (c *FakePreflights) Update(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (result *v1beta2.Preflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(preflightsResource, c.ns, preflight), &v1beta2.Preflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Preflight), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakePreflights) UpdateStatus(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (*v1beta2.Preflight, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(preflightsResource, "status", c.ns, preflight), &v1beta2.Preflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Preflight), err
}
// Delete takes name of the preflight and deletes it. Returns an error if one occurs.
func (c *FakePreflights) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(preflightsResource, c.ns, name), &v1beta2.Preflight{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakePreflights) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(preflightsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.PreflightList{})
return err
}
// Patch applies the patch and returns the patched preflight.
func (c *FakePreflights) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Preflight, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(preflightsResource, c.ns, name, pt, data, subresources...), &v1beta2.Preflight{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Preflight), err
}
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeRedactors implements RedactorInterface
type FakeRedactors struct {
Fake *FakeTroubleshootV1beta2
ns string
}
var redactorsResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "redactors"}
var redactorsKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "Redactor"}
// Get takes name of the redactor, and returns the corresponding redactor object, and an error if there is any.
func (c *FakeRedactors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Redactor, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(redactorsResource, c.ns, name), &v1beta2.Redactor{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Redactor), err
}
// List takes label and field selectors, and returns the list of Redactors that match those selectors.
func (c *FakeRedactors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.RedactorList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(redactorsResource, redactorsKind, c.ns, opts), &v1beta2.RedactorList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.RedactorList{ListMeta: obj.(*v1beta2.RedactorList).ListMeta}
for _, item := range obj.(*v1beta2.RedactorList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested redactors.
func (c *FakeRedactors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(redactorsResource, c.ns, opts))
}
// Create takes the representation of a redactor and creates it. Returns the server's representation of the redactor, and an error, if there is any.
func (c *FakeRedactors) Create(ctx context.Context, redactor *v1beta2.Redactor, opts v1.CreateOptions) (result *v1beta2.Redactor, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(redactorsResource, c.ns, redactor), &v1beta2.Redactor{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Redactor), err
}
// Update takes the representation of a redactor and updates it. Returns the server's representation of the redactor, and an error, if there is any.
func (c *FakeRedactors) Update(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (result *v1beta2.Redactor, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(redactorsResource, c.ns, redactor), &v1beta2.Redactor{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Redactor), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeRedactors) UpdateStatus(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (*v1beta2.Redactor, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(redactorsResource, "status", c.ns, redactor), &v1beta2.Redactor{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Redactor), err
}
// Delete takes name of the redactor and deletes it. Returns an error if one occurs.
func (c *FakeRedactors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(redactorsResource, c.ns, name), &v1beta2.Redactor{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeRedactors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(redactorsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.RedactorList{})
return err
}
// Patch applies the patch and returns the patched redactor.
func (c *FakeRedactors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Redactor, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(redactorsResource, c.ns, name, pt, data, subresources...), &v1beta2.Redactor{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.Redactor), err
}
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeRemoteCollectors implements RemoteCollectorInterface
type FakeRemoteCollectors struct {
Fake *FakeTroubleshootV1beta2
ns string
}
var remotecollectorsResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "remotecollectors"}
var remotecollectorsKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "RemoteCollector"}
// Get takes name of the remoteCollector, and returns the corresponding remoteCollector object, and an error if there is any.
func (c *FakeRemoteCollectors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.RemoteCollector, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(remotecollectorsResource, c.ns, name), &v1beta2.RemoteCollector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.RemoteCollector), err
}
// List takes label and field selectors, and returns the list of RemoteCollectors that match those selectors.
func (c *FakeRemoteCollectors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.RemoteCollectorList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(remotecollectorsResource, remotecollectorsKind, c.ns, opts), &v1beta2.RemoteCollectorList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.RemoteCollectorList{ListMeta: obj.(*v1beta2.RemoteCollectorList).ListMeta}
for _, item := range obj.(*v1beta2.RemoteCollectorList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested remoteCollectors.
func (c *FakeRemoteCollectors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(remotecollectorsResource, c.ns, opts))
}
// Create takes the representation of a remoteCollector and creates it. Returns the server's representation of the remoteCollector, and an error, if there is any.
func (c *FakeRemoteCollectors) Create(ctx context.Context, remoteCollector *v1beta2.RemoteCollector, opts v1.CreateOptions) (result *v1beta2.RemoteCollector, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(remotecollectorsResource, c.ns, remoteCollector), &v1beta2.RemoteCollector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.RemoteCollector), err
}
// Update takes the representation of a remoteCollector and updates it. Returns the server's representation of the remoteCollector, and an error, if there is any.
func (c *FakeRemoteCollectors) Update(ctx context.Context, remoteCollector *v1beta2.RemoteCollector, opts v1.UpdateOptions) (result *v1beta2.RemoteCollector, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(remotecollectorsResource, c.ns, remoteCollector), &v1beta2.RemoteCollector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.RemoteCollector), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeRemoteCollectors) UpdateStatus(ctx context.Context, remoteCollector *v1beta2.RemoteCollector, opts v1.UpdateOptions) (*v1beta2.RemoteCollector, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(remotecollectorsResource, "status", c.ns, remoteCollector), &v1beta2.RemoteCollector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.RemoteCollector), err
}
// Delete takes name of the remoteCollector and deletes it. Returns an error if one occurs.
func (c *FakeRemoteCollectors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(remotecollectorsResource, c.ns, name), &v1beta2.RemoteCollector{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeRemoteCollectors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(remotecollectorsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.RemoteCollectorList{})
return err
}
// Patch applies the patch and returns the patched remoteCollector.
func (c *FakeRemoteCollectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.RemoteCollector, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(remotecollectorsResource, c.ns, name, pt, data, subresources...), &v1beta2.RemoteCollector{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.RemoteCollector), err
}
@@ -1,141 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeSupportBundles implements SupportBundleInterface
type FakeSupportBundles struct {
Fake *FakeTroubleshootV1beta2
ns string
}
var supportbundlesResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "supportbundles"}
var supportbundlesKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "SupportBundle"}
// Get takes name of the supportBundle, and returns the corresponding supportBundle object, and an error if there is any.
func (c *FakeSupportBundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.SupportBundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(supportbundlesResource, c.ns, name), &v1beta2.SupportBundle{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.SupportBundle), err
}
// List takes label and field selectors, and returns the list of SupportBundles that match those selectors.
func (c *FakeSupportBundles) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.SupportBundleList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(supportbundlesResource, supportbundlesKind, c.ns, opts), &v1beta2.SupportBundleList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.SupportBundleList{ListMeta: obj.(*v1beta2.SupportBundleList).ListMeta}
for _, item := range obj.(*v1beta2.SupportBundleList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested supportBundles.
func (c *FakeSupportBundles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(supportbundlesResource, c.ns, opts))
}
// Create takes the representation of a supportBundle and creates it. Returns the server's representation of the supportBundle, and an error, if there is any.
func (c *FakeSupportBundles) Create(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.CreateOptions) (result *v1beta2.SupportBundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(supportbundlesResource, c.ns, supportBundle), &v1beta2.SupportBundle{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.SupportBundle), err
}
// Update takes the representation of a supportBundle and updates it. Returns the server's representation of the supportBundle, and an error, if there is any.
func (c *FakeSupportBundles) Update(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (result *v1beta2.SupportBundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(supportbundlesResource, c.ns, supportBundle), &v1beta2.SupportBundle{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.SupportBundle), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeSupportBundles) UpdateStatus(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (*v1beta2.SupportBundle, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(supportbundlesResource, "status", c.ns, supportBundle), &v1beta2.SupportBundle{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.SupportBundle), err
}
// Delete takes name of the supportBundle and deletes it. Returns an error if one occurs.
func (c *FakeSupportBundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(supportbundlesResource, c.ns, name), &v1beta2.SupportBundle{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeSupportBundles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(supportbundlesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.SupportBundleList{})
return err
}
// Patch applies the patch and returns the patched supportBundle.
func (c *FakeSupportBundles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.SupportBundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(supportbundlesResource, c.ns, name, pt, data, subresources...), &v1beta2.SupportBundle{})
if obj == nil {
return nil, err
}
return obj.(*v1beta2.SupportBundle), err
}
@@ -1,67 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeTroubleshootV1beta2 struct {
*testing.Fake
}
func (c *FakeTroubleshootV1beta2) Analyzers(namespace string) v1beta2.AnalyzerInterface {
return &FakeAnalyzers{c, namespace}
}
func (c *FakeTroubleshootV1beta2) Collectors(namespace string) v1beta2.CollectorInterface {
return &FakeCollectors{c, namespace}
}
func (c *FakeTroubleshootV1beta2) HostCollectors(namespace string) v1beta2.HostCollectorInterface {
return &FakeHostCollectors{c, namespace}
}
func (c *FakeTroubleshootV1beta2) HostPreflights(namespace string) v1beta2.HostPreflightInterface {
return &FakeHostPreflights{c, namespace}
}
func (c *FakeTroubleshootV1beta2) Preflights(namespace string) v1beta2.PreflightInterface {
return &FakePreflights{c, namespace}
}
func (c *FakeTroubleshootV1beta2) Redactors(namespace string) v1beta2.RedactorInterface {
return &FakeRedactors{c, namespace}
}
func (c *FakeTroubleshootV1beta2) RemoteCollectors(namespace string) v1beta2.RemoteCollectorInterface {
return &FakeRemoteCollectors{c, namespace}
}
func (c *FakeTroubleshootV1beta2) SupportBundles(namespace string) v1beta2.SupportBundleInterface {
return &FakeSupportBundles{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeTroubleshootV1beta2) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}
@@ -1,34 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta2
type AnalyzerExpansion interface{}
type CollectorExpansion interface{}
type HostCollectorExpansion interface{}
type HostPreflightExpansion interface{}
type PreflightExpansion interface{}
type RedactorExpansion interface{}
type RemoteCollectorExpansion interface{}
type SupportBundleExpansion interface{}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta2
import (
"context"
"time"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// HostCollectorsGetter has a method to return a HostCollectorInterface.
// A group's client should implement this interface.
type HostCollectorsGetter interface {
HostCollectors(namespace string) HostCollectorInterface
}
// HostCollectorInterface has methods to work with HostCollector resources.
type HostCollectorInterface interface {
Create(ctx context.Context, hostCollector *v1beta2.HostCollector, opts v1.CreateOptions) (*v1beta2.HostCollector, error)
Update(ctx context.Context, hostCollector *v1beta2.HostCollector, opts v1.UpdateOptions) (*v1beta2.HostCollector, error)
UpdateStatus(ctx context.Context, hostCollector *v1beta2.HostCollector, opts v1.UpdateOptions) (*v1beta2.HostCollector, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.HostCollector, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta2.HostCollectorList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.HostCollector, err error)
HostCollectorExpansion
}
// hostCollectors implements HostCollectorInterface
type hostCollectors struct {
client rest.Interface
ns string
}
// newHostCollectors returns a HostCollectors
func newHostCollectors(c *TroubleshootV1beta2Client, namespace string) *hostCollectors {
return &hostCollectors{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the hostCollector, and returns the corresponding hostCollector object, and an error if there is any.
func (c *hostCollectors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.HostCollector, err error) {
result = &v1beta2.HostCollector{}
err = c.client.Get().
Namespace(c.ns).
Resource("hostcollectors").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of HostCollectors that match those selectors.
func (c *hostCollectors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.HostCollectorList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta2.HostCollectorList{}
err = c.client.Get().
Namespace(c.ns).
Resource("hostcollectors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested hostCollectors.
func (c *hostCollectors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("hostcollectors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a hostCollector and creates it. Returns the server's representation of the hostCollector, and an error, if there is any.
func (c *hostCollectors) Create(ctx context.Context, hostCollector *v1beta2.HostCollector, opts v1.CreateOptions) (result *v1beta2.HostCollector, err error) {
result = &v1beta2.HostCollector{}
err = c.client.Post().
Namespace(c.ns).
Resource("hostcollectors").
VersionedParams(&opts, scheme.ParameterCodec).
Body(hostCollector).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a hostCollector and updates it. Returns the server's representation of the hostCollector, and an error, if there is any.
func (c *hostCollectors) Update(ctx context.Context, hostCollector *v1beta2.HostCollector, opts v1.UpdateOptions) (result *v1beta2.HostCollector, err error) {
result = &v1beta2.HostCollector{}
err = c.client.Put().
Namespace(c.ns).
Resource("hostcollectors").
Name(hostCollector.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(hostCollector).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *hostCollectors) UpdateStatus(ctx context.Context, hostCollector *v1beta2.HostCollector, opts v1.UpdateOptions) (result *v1beta2.HostCollector, err error) {
result = &v1beta2.HostCollector{}
err = c.client.Put().
Namespace(c.ns).
Resource("hostcollectors").
Name(hostCollector.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(hostCollector).
Do(ctx).
Into(result)
return
}
// Delete takes name of the hostCollector and deletes it. Returns an error if one occurs.
func (c *hostCollectors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("hostcollectors").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *hostCollectors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("hostcollectors").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched hostCollector.
func (c *hostCollectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.HostCollector, err error) {
result = &v1beta2.HostCollector{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("hostcollectors").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta2
import (
"context"
"time"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// HostPreflightsGetter has a method to return a HostPreflightInterface.
// A group's client should implement this interface.
type HostPreflightsGetter interface {
HostPreflights(namespace string) HostPreflightInterface
}
// HostPreflightInterface has methods to work with HostPreflight resources.
type HostPreflightInterface interface {
Create(ctx context.Context, hostPreflight *v1beta2.HostPreflight, opts v1.CreateOptions) (*v1beta2.HostPreflight, error)
Update(ctx context.Context, hostPreflight *v1beta2.HostPreflight, opts v1.UpdateOptions) (*v1beta2.HostPreflight, error)
UpdateStatus(ctx context.Context, hostPreflight *v1beta2.HostPreflight, opts v1.UpdateOptions) (*v1beta2.HostPreflight, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.HostPreflight, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta2.HostPreflightList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.HostPreflight, err error)
HostPreflightExpansion
}
// hostPreflights implements HostPreflightInterface
type hostPreflights struct {
client rest.Interface
ns string
}
// newHostPreflights returns a HostPreflights
func newHostPreflights(c *TroubleshootV1beta2Client, namespace string) *hostPreflights {
return &hostPreflights{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the hostPreflight, and returns the corresponding hostPreflight object, and an error if there is any.
func (c *hostPreflights) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.HostPreflight, err error) {
result = &v1beta2.HostPreflight{}
err = c.client.Get().
Namespace(c.ns).
Resource("hostpreflights").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of HostPreflights that match those selectors.
func (c *hostPreflights) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.HostPreflightList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta2.HostPreflightList{}
err = c.client.Get().
Namespace(c.ns).
Resource("hostpreflights").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested hostPreflights.
func (c *hostPreflights) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("hostpreflights").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a hostPreflight and creates it. Returns the server's representation of the hostPreflight, and an error, if there is any.
func (c *hostPreflights) Create(ctx context.Context, hostPreflight *v1beta2.HostPreflight, opts v1.CreateOptions) (result *v1beta2.HostPreflight, err error) {
result = &v1beta2.HostPreflight{}
err = c.client.Post().
Namespace(c.ns).
Resource("hostpreflights").
VersionedParams(&opts, scheme.ParameterCodec).
Body(hostPreflight).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a hostPreflight and updates it. Returns the server's representation of the hostPreflight, and an error, if there is any.
func (c *hostPreflights) Update(ctx context.Context, hostPreflight *v1beta2.HostPreflight, opts v1.UpdateOptions) (result *v1beta2.HostPreflight, err error) {
result = &v1beta2.HostPreflight{}
err = c.client.Put().
Namespace(c.ns).
Resource("hostpreflights").
Name(hostPreflight.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(hostPreflight).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *hostPreflights) UpdateStatus(ctx context.Context, hostPreflight *v1beta2.HostPreflight, opts v1.UpdateOptions) (result *v1beta2.HostPreflight, err error) {
result = &v1beta2.HostPreflight{}
err = c.client.Put().
Namespace(c.ns).
Resource("hostpreflights").
Name(hostPreflight.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(hostPreflight).
Do(ctx).
Into(result)
return
}
// Delete takes name of the hostPreflight and deletes it. Returns an error if one occurs.
func (c *hostPreflights) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("hostpreflights").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *hostPreflights) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("hostpreflights").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched hostPreflight.
func (c *hostPreflights) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.HostPreflight, err error) {
result = &v1beta2.HostPreflight{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("hostpreflights").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta2
import (
"context"
"time"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// PreflightsGetter has a method to return a PreflightInterface.
// A group's client should implement this interface.
type PreflightsGetter interface {
Preflights(namespace string) PreflightInterface
}
// PreflightInterface has methods to work with Preflight resources.
type PreflightInterface interface {
Create(ctx context.Context, preflight *v1beta2.Preflight, opts v1.CreateOptions) (*v1beta2.Preflight, error)
Update(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (*v1beta2.Preflight, error)
UpdateStatus(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (*v1beta2.Preflight, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.Preflight, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta2.PreflightList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Preflight, err error)
PreflightExpansion
}
// preflights implements PreflightInterface
type preflights struct {
client rest.Interface
ns string
}
// newPreflights returns a Preflights
func newPreflights(c *TroubleshootV1beta2Client, namespace string) *preflights {
return &preflights{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the preflight, and returns the corresponding preflight object, and an error if there is any.
func (c *preflights) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Preflight, err error) {
result = &v1beta2.Preflight{}
err = c.client.Get().
Namespace(c.ns).
Resource("preflights").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Preflights that match those selectors.
func (c *preflights) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.PreflightList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta2.PreflightList{}
err = c.client.Get().
Namespace(c.ns).
Resource("preflights").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested preflights.
func (c *preflights) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("preflights").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a preflight and creates it. Returns the server's representation of the preflight, and an error, if there is any.
func (c *preflights) Create(ctx context.Context, preflight *v1beta2.Preflight, opts v1.CreateOptions) (result *v1beta2.Preflight, err error) {
result = &v1beta2.Preflight{}
err = c.client.Post().
Namespace(c.ns).
Resource("preflights").
VersionedParams(&opts, scheme.ParameterCodec).
Body(preflight).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a preflight and updates it. Returns the server's representation of the preflight, and an error, if there is any.
func (c *preflights) Update(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (result *v1beta2.Preflight, err error) {
result = &v1beta2.Preflight{}
err = c.client.Put().
Namespace(c.ns).
Resource("preflights").
Name(preflight.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(preflight).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *preflights) UpdateStatus(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (result *v1beta2.Preflight, err error) {
result = &v1beta2.Preflight{}
err = c.client.Put().
Namespace(c.ns).
Resource("preflights").
Name(preflight.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(preflight).
Do(ctx).
Into(result)
return
}
// Delete takes name of the preflight and deletes it. Returns an error if one occurs.
func (c *preflights) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("preflights").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *preflights) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("preflights").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched preflight.
func (c *preflights) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Preflight, err error) {
result = &v1beta2.Preflight{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("preflights").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta2
import (
"context"
"time"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// RedactorsGetter has a method to return a RedactorInterface.
// A group's client should implement this interface.
type RedactorsGetter interface {
Redactors(namespace string) RedactorInterface
}
// RedactorInterface has methods to work with Redactor resources.
type RedactorInterface interface {
Create(ctx context.Context, redactor *v1beta2.Redactor, opts v1.CreateOptions) (*v1beta2.Redactor, error)
Update(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (*v1beta2.Redactor, error)
UpdateStatus(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (*v1beta2.Redactor, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.Redactor, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta2.RedactorList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Redactor, err error)
RedactorExpansion
}
// redactors implements RedactorInterface
type redactors struct {
client rest.Interface
ns string
}
// newRedactors returns a Redactors
func newRedactors(c *TroubleshootV1beta2Client, namespace string) *redactors {
return &redactors{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the redactor, and returns the corresponding redactor object, and an error if there is any.
func (c *redactors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Redactor, err error) {
result = &v1beta2.Redactor{}
err = c.client.Get().
Namespace(c.ns).
Resource("redactors").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Redactors that match those selectors.
func (c *redactors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.RedactorList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta2.RedactorList{}
err = c.client.Get().
Namespace(c.ns).
Resource("redactors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested redactors.
func (c *redactors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("redactors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a redactor and creates it. Returns the server's representation of the redactor, and an error, if there is any.
func (c *redactors) Create(ctx context.Context, redactor *v1beta2.Redactor, opts v1.CreateOptions) (result *v1beta2.Redactor, err error) {
result = &v1beta2.Redactor{}
err = c.client.Post().
Namespace(c.ns).
Resource("redactors").
VersionedParams(&opts, scheme.ParameterCodec).
Body(redactor).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a redactor and updates it. Returns the server's representation of the redactor, and an error, if there is any.
func (c *redactors) Update(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (result *v1beta2.Redactor, err error) {
result = &v1beta2.Redactor{}
err = c.client.Put().
Namespace(c.ns).
Resource("redactors").
Name(redactor.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(redactor).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *redactors) UpdateStatus(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (result *v1beta2.Redactor, err error) {
result = &v1beta2.Redactor{}
err = c.client.Put().
Namespace(c.ns).
Resource("redactors").
Name(redactor.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(redactor).
Do(ctx).
Into(result)
return
}
// Delete takes name of the redactor and deletes it. Returns an error if one occurs.
func (c *redactors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("redactors").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *redactors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("redactors").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched redactor.
func (c *redactors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Redactor, err error) {
result = &v1beta2.Redactor{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("redactors").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta2
import (
"context"
"time"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// RemoteCollectorsGetter has a method to return a RemoteCollectorInterface.
// A group's client should implement this interface.
type RemoteCollectorsGetter interface {
RemoteCollectors(namespace string) RemoteCollectorInterface
}
// RemoteCollectorInterface has methods to work with RemoteCollector resources.
type RemoteCollectorInterface interface {
Create(ctx context.Context, remoteCollector *v1beta2.RemoteCollector, opts v1.CreateOptions) (*v1beta2.RemoteCollector, error)
Update(ctx context.Context, remoteCollector *v1beta2.RemoteCollector, opts v1.UpdateOptions) (*v1beta2.RemoteCollector, error)
UpdateStatus(ctx context.Context, remoteCollector *v1beta2.RemoteCollector, opts v1.UpdateOptions) (*v1beta2.RemoteCollector, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.RemoteCollector, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta2.RemoteCollectorList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.RemoteCollector, err error)
RemoteCollectorExpansion
}
// remoteCollectors implements RemoteCollectorInterface
type remoteCollectors struct {
client rest.Interface
ns string
}
// newRemoteCollectors returns a RemoteCollectors
func newRemoteCollectors(c *TroubleshootV1beta2Client, namespace string) *remoteCollectors {
return &remoteCollectors{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the remoteCollector, and returns the corresponding remoteCollector object, and an error if there is any.
func (c *remoteCollectors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.RemoteCollector, err error) {
result = &v1beta2.RemoteCollector{}
err = c.client.Get().
Namespace(c.ns).
Resource("remotecollectors").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of RemoteCollectors that match those selectors.
func (c *remoteCollectors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.RemoteCollectorList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta2.RemoteCollectorList{}
err = c.client.Get().
Namespace(c.ns).
Resource("remotecollectors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested remoteCollectors.
func (c *remoteCollectors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("remotecollectors").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a remoteCollector and creates it. Returns the server's representation of the remoteCollector, and an error, if there is any.
func (c *remoteCollectors) Create(ctx context.Context, remoteCollector *v1beta2.RemoteCollector, opts v1.CreateOptions) (result *v1beta2.RemoteCollector, err error) {
result = &v1beta2.RemoteCollector{}
err = c.client.Post().
Namespace(c.ns).
Resource("remotecollectors").
VersionedParams(&opts, scheme.ParameterCodec).
Body(remoteCollector).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a remoteCollector and updates it. Returns the server's representation of the remoteCollector, and an error, if there is any.
func (c *remoteCollectors) Update(ctx context.Context, remoteCollector *v1beta2.RemoteCollector, opts v1.UpdateOptions) (result *v1beta2.RemoteCollector, err error) {
result = &v1beta2.RemoteCollector{}
err = c.client.Put().
Namespace(c.ns).
Resource("remotecollectors").
Name(remoteCollector.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(remoteCollector).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *remoteCollectors) UpdateStatus(ctx context.Context, remoteCollector *v1beta2.RemoteCollector, opts v1.UpdateOptions) (result *v1beta2.RemoteCollector, err error) {
result = &v1beta2.RemoteCollector{}
err = c.client.Put().
Namespace(c.ns).
Resource("remotecollectors").
Name(remoteCollector.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(remoteCollector).
Do(ctx).
Into(result)
return
}
// Delete takes name of the remoteCollector and deletes it. Returns an error if one occurs.
func (c *remoteCollectors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("remotecollectors").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *remoteCollectors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("remotecollectors").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched remoteCollector.
func (c *remoteCollectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.RemoteCollector, err error) {
result = &v1beta2.RemoteCollector{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("remotecollectors").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,194 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta2
import (
"context"
"time"
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// SupportBundlesGetter has a method to return a SupportBundleInterface.
// A group's client should implement this interface.
type SupportBundlesGetter interface {
SupportBundles(namespace string) SupportBundleInterface
}
// SupportBundleInterface has methods to work with SupportBundle resources.
type SupportBundleInterface interface {
Create(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.CreateOptions) (*v1beta2.SupportBundle, error)
Update(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (*v1beta2.SupportBundle, error)
UpdateStatus(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (*v1beta2.SupportBundle, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.SupportBundle, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta2.SupportBundleList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.SupportBundle, err error)
SupportBundleExpansion
}
// supportBundles implements SupportBundleInterface
type supportBundles struct {
client rest.Interface
ns string
}
// newSupportBundles returns a SupportBundles
func newSupportBundles(c *TroubleshootV1beta2Client, namespace string) *supportBundles {
return &supportBundles{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the supportBundle, and returns the corresponding supportBundle object, and an error if there is any.
func (c *supportBundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.SupportBundle, err error) {
result = &v1beta2.SupportBundle{}
err = c.client.Get().
Namespace(c.ns).
Resource("supportbundles").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of SupportBundles that match those selectors.
func (c *supportBundles) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.SupportBundleList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta2.SupportBundleList{}
err = c.client.Get().
Namespace(c.ns).
Resource("supportbundles").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested supportBundles.
func (c *supportBundles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("supportbundles").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a supportBundle and creates it. Returns the server's representation of the supportBundle, and an error, if there is any.
func (c *supportBundles) Create(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.CreateOptions) (result *v1beta2.SupportBundle, err error) {
result = &v1beta2.SupportBundle{}
err = c.client.Post().
Namespace(c.ns).
Resource("supportbundles").
VersionedParams(&opts, scheme.ParameterCodec).
Body(supportBundle).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a supportBundle and updates it. Returns the server's representation of the supportBundle, and an error, if there is any.
func (c *supportBundles) Update(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (result *v1beta2.SupportBundle, err error) {
result = &v1beta2.SupportBundle{}
err = c.client.Put().
Namespace(c.ns).
Resource("supportbundles").
Name(supportBundle.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(supportBundle).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *supportBundles) UpdateStatus(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (result *v1beta2.SupportBundle, err error) {
result = &v1beta2.SupportBundle{}
err = c.client.Put().
Namespace(c.ns).
Resource("supportbundles").
Name(supportBundle.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(supportBundle).
Do(ctx).
Into(result)
return
}
// Delete takes name of the supportBundle and deletes it. Returns an error if one occurs.
func (c *supportBundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("supportbundles").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *supportBundles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("supportbundles").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched supportBundle.
func (c *supportBundles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.SupportBundle, err error) {
result = &v1beta2.SupportBundle{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("supportbundles").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -1,123 +0,0 @@
/*
Copyright 2019 Replicated, Inc..
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta2
import (
v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme"
rest "k8s.io/client-go/rest"
)
type TroubleshootV1beta2Interface interface {
RESTClient() rest.Interface
AnalyzersGetter
CollectorsGetter
HostCollectorsGetter
HostPreflightsGetter
PreflightsGetter
RedactorsGetter
RemoteCollectorsGetter
SupportBundlesGetter
}
// TroubleshootV1beta2Client is used to interact with features provided by the troubleshoot.sh group.
type TroubleshootV1beta2Client struct {
restClient rest.Interface
}
func (c *TroubleshootV1beta2Client) Analyzers(namespace string) AnalyzerInterface {
return newAnalyzers(c, namespace)
}
func (c *TroubleshootV1beta2Client) Collectors(namespace string) CollectorInterface {
return newCollectors(c, namespace)
}
func (c *TroubleshootV1beta2Client) HostCollectors(namespace string) HostCollectorInterface {
return newHostCollectors(c, namespace)
}
func (c *TroubleshootV1beta2Client) HostPreflights(namespace string) HostPreflightInterface {
return newHostPreflights(c, namespace)
}
func (c *TroubleshootV1beta2Client) Preflights(namespace string) PreflightInterface {
return newPreflights(c, namespace)
}
func (c *TroubleshootV1beta2Client) Redactors(namespace string) RedactorInterface {
return newRedactors(c, namespace)
}
func (c *TroubleshootV1beta2Client) RemoteCollectors(namespace string) RemoteCollectorInterface {
return newRemoteCollectors(c, namespace)
}
func (c *TroubleshootV1beta2Client) SupportBundles(namespace string) SupportBundleInterface {
return newSupportBundles(c, namespace)
}
// NewForConfig creates a new TroubleshootV1beta2Client for the given config.
func NewForConfig(c *rest.Config) (*TroubleshootV1beta2Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &TroubleshootV1beta2Client{client}, nil
}
// NewForConfigOrDie creates a new TroubleshootV1beta2Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *TroubleshootV1beta2Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new TroubleshootV1beta2Client for the given RESTClient.
func New(c rest.Interface) *TroubleshootV1beta2Client {
return &TroubleshootV1beta2Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1beta2.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *TroubleshootV1beta2Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}
+81 -70
View File
@@ -6,8 +6,9 @@ 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.7.1+incompatible
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/go-redis/redis/v7 v7.4.1
github.com/go-sql-driver/mysql v1.6.0
github.com/gobwas/glob v0.2.3
@@ -15,109 +16,115 @@ require (
github.com/google/gofuzz v1.2.0
github.com/google/uuid v1.3.0
github.com/gorilla/handlers v1.5.1
github.com/hashicorp/go-getter v1.5.9
github.com/hashicorp/go-getter v1.6.2
github.com/hashicorp/go-multierror v1.1.1
github.com/lib/pq v1.10.4
github.com/lib/pq v1.10.6
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.14
github.com/mholt/archiver v3.1.1+incompatible
github.com/mholt/archiver/v3 v3.5.1
github.com/opencontainers/image-spec v1.0.3-0.20211202193544-a5463b7f9c84
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.8.1
github.com/spf13/cobra v1.3.0
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.5.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.10.0
github.com/stretchr/testify v1.7.0
github.com/spf13/viper v1.12.0
github.com/stretchr/testify v1.8.0
github.com/tj/go-spin v1.1.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.23.1
k8s.io/apiextensions-apiserver v0.23.0
k8s.io/apimachinery v0.23.1
k8s.io/apiserver v0.23.0
k8s.io/cli-runtime v0.23.1
k8s.io/client-go v0.23.1
periph.io/x/periph v3.6.8+incompatible
sigs.k8s.io/controller-runtime v0.11.0
k8s.io/api v0.24.3
k8s.io/apiextensions-apiserver v0.24.2
k8s.io/apimachinery v0.24.3
k8s.io/apiserver v0.24.3
k8s.io/cli-runtime v0.24.3
k8s.io/client-go v0.24.3
k8s.io/klog/v2 v2.70.1
oras.land/oras-go v1.2.0
sigs.k8s.io/controller-runtime v0.12.3
)
require (
cloud.google.com/go v0.99.0 // indirect
cloud.google.com/go/storage v1.10.0 // indirect
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
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.18 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
github.com/Azure/go-autorest/autorest v0.11.24 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.18 // 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.2 // 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/aws/aws-sdk-go v1.15.78 // indirect
github.com/andybalholm/brotli v1.0.1 // indirect
github.com/aws/aws-sdk-go v1.43.16 // 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.1 // indirect
github.com/containerd/containerd v1.5.10 // 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/docker v20.10.12+incompatible // 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/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/dsnet/compress v0.0.1 // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/frankban/quicktest v1.14.0 // indirect
github.com/fsnotify/fsnotify v1.5.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/go-logr/logr v1.2.0 // 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/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/snappy v0.0.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.8 // 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.1.1 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/googleapis/gax-go/v2 v2.4.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.0.0 // 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/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 // 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/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/magiconair/properties v1.8.5 // 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
@@ -126,34 +133,38 @@ require (
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // 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 v0.0.0-20150314170334-ad45545899c7 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
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/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
github.com/morikuni/aec v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
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/image-spec v1.0.3-0.20211202193544-a5463b7f9c84 // indirect
github.com/opencontainers/runc v1.1.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.0 // 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.4 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pierrec/lz4 v2.6.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.11.0 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.28.0 // indirect
github.com/prometheus/procfs v0.6.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.6.0 // indirect
github.com/spf13/cast v1.4.1 // 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.2.0 // indirect
github.com/subosito/gotenv v1.3.0 // indirect
github.com/sylabs/sif/v2 v2.3.1 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/tchap/go-patricia v2.3.0+incompatible // indirect
@@ -166,29 +177,29 @@ require (
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-20220315160706-3147a52a75dd // indirect
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // 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-20210723032227-1f47c861a9ac // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/api v0.62.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
google.golang.org/api v0.81.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.42.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect
google.golang.org/grpc v1.46.2 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
sigs.k8s.io/kustomize/api v0.10.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
periph.io/x/host/v3 v3.7.2
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/kustomize/api v0.11.4 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
+358 -106
View File
File diff suppressed because it is too large Load Diff
+53
View File
@@ -2,6 +2,7 @@ package analyzer
import (
"fmt"
"reflect"
"strconv"
"github.com/pkg/errors"
@@ -339,6 +340,36 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
}
return results, nil
}
if analyzer.YamlCompare != nil {
isExcluded, err := isExcluded(analyzer.YamlCompare.Exclude)
if err != nil {
return nil, err
}
if isExcluded {
return nil, nil
}
result, err := analyzeYamlCompare(analyzer.YamlCompare, getFile)
if err != nil {
return nil, err
}
result.Strict = analyzer.YamlCompare.Strict.BoolOrDefaultFalse()
return []*AnalyzeResult{result}, nil
}
if analyzer.JsonCompare != nil {
isExcluded, err := isExcluded(analyzer.JsonCompare.Exclude)
if err != nil {
return nil, err
}
if isExcluded {
return nil, nil
}
result, err := analyzeJsonCompare(analyzer.JsonCompare, getFile)
if err != nil {
return nil, err
}
result.Strict = analyzer.JsonCompare.Strict.BoolOrDefaultFalse()
return []*AnalyzeResult{result}, nil
}
if analyzer.Postgres != nil {
isExcluded, err := isExcluded(analyzer.Postgres.Exclude)
if err != nil {
@@ -472,3 +503,25 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
return nil, errors.New("invalid analyzer")
}
func GetExcludeFlag(analyzer *troubleshootv1beta2.Analyze) *multitype.BoolOrString {
if analyzer == nil {
return nil
}
reflected := reflect.ValueOf(analyzer).Elem()
for i := 0; i < reflected.NumField(); i++ {
if reflected.Field(i).IsNil() {
continue
}
field := reflect.Indirect(reflected.Field(i)).FieldByName("Exclude")
exclude, ok := field.Interface().(*multitype.BoolOrString)
if !ok {
continue
}
return exclude
}
return nil
}
+67
View File
@@ -0,0 +1,67 @@
package analyzer
import (
"testing"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/replicatedhq/troubleshoot/pkg/multitype"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_GetExcludeFlag(t *testing.T) {
tests := []struct {
name string
analyzer *troubleshootv1beta2.Analyze
want bool
}{
{
name: "nil case",
analyzer: nil,
want: false,
},
{
name: "true is set",
analyzer: &troubleshootv1beta2.Analyze{
TextAnalyze: &troubleshootv1beta2.TextAnalyze{
AnalyzeMeta: troubleshootv1beta2.AnalyzeMeta{
Exclude: multitype.FromBool(true),
},
},
},
want: true,
},
{
name: "false is set",
analyzer: &troubleshootv1beta2.Analyze{
ClusterVersion: &troubleshootv1beta2.ClusterVersion{
AnalyzeMeta: troubleshootv1beta2.AnalyzeMeta{
Exclude: multitype.FromBool(false),
},
},
},
want: false,
},
{
name: "nothing is set",
analyzer: &troubleshootv1beta2.Analyze{
Postgres: &troubleshootv1beta2.DatabaseAnalyze{
AnalyzeMeta: troubleshootv1beta2.AnalyzeMeta{},
},
},
want: false,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
req := require.New(t)
gotWrapped := GetExcludeFlag(test.analyzer)
got, err := gotWrapped.Bool()
req.NoError(err)
assert.Equal(t, test.want, got)
})
}
}
+2 -8
View File
@@ -219,14 +219,14 @@ func Test_cephStatus(t *testing.T) {
}`,
},
{
name: "warn case with multiple health status messages",
name: "warn case with health status message and summary",
analyzer: troubleshootv1beta2.CephStatusAnalyze{},
expectResult: AnalyzeResult{
IsPass: false,
IsWarn: true,
IsFail: false,
Title: "Ceph Status",
Message: "Ceph status is HEALTH_WARN\nPOOL_NO_REDUNDANCY: 11 pool(s) have no replicas configured\nPOOL_PG_NUM_NOT_POWER_OF_TWO: 8 pool(s) have non-power-of-two pg_num",
Message: "Ceph status is HEALTH_WARN\nPOOL_NO_REDUNDANCY: 11 pool(s) have no replicas configured",
URI: "https://rook.io/docs/rook/v1.4/ceph-common-issues.html",
IconKey: "rook",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/rook.svg?w=11&h=16",
@@ -244,12 +244,6 @@ func Test_cephStatus(t *testing.T) {
"count": 11
},
"muted": false
},
"POOL_PG_NUM_NOT_POWER_OF_TWO": {
"severity": "HEALTH_WARN",
"summary": {
"message": "8 pool(s) have non-power-of-two pg_num"
}
}
}
}
+4
View File
@@ -55,6 +55,10 @@ func analyzeOneDeploymentStatus(analyzer *troubleshootv1beta2.DeploymentStatus,
}
}
if result == nil {
return nil, nil
}
return []*AnalyzeResult{result}, nil
}
+3
View File
@@ -73,6 +73,9 @@ func ParseNodesForProviders(nodes []corev1.Node) (providers, string) {
if k == "node-role.kubernetes.io/master" {
foundMaster = true
}
if k == "node-role.kubernetes.io/control-plane" {
foundMaster = true
}
if k == "kubernetes.azure.com/role" {
foundProviders.aks = true
stringProvider = "aks"
+18 -11
View File
@@ -22,7 +22,7 @@ type fileContentProvider struct {
}
// Analyze local will analyze a locally available (already downloaded) bundle
func AnalyzeLocal(localBundlePath string, analyzers []*troubleshootv1beta2.Analyze) ([]*AnalyzeResult, error) {
func AnalyzeLocal(localBundlePath string, analyzers []*troubleshootv1beta2.Analyze, hostAnalyzers []*troubleshootv1beta2.HostAnalyze) ([]*AnalyzeResult, error) {
rootDir, err := FindBundleRootDir(localBundlePath)
if err != nil {
return nil, errors.Wrap(err, "failed to find root dir")
@@ -46,6 +46,11 @@ func AnalyzeLocal(localBundlePath string, analyzers []*troubleshootv1beta2.Analy
}
}
for _, hostAnalyzer := range hostAnalyzers {
analyzeResult := HostAnalyze(hostAnalyzer, fcp.getFileContents, fcp.getChildFileContents)
analyzeResults = append(analyzeResults, analyzeResult...)
}
return analyzeResults, nil
}
@@ -71,22 +76,24 @@ func DownloadAndAnalyze(bundleURL string, analyzersSpec string) ([]*AnalyzeResul
}
analyzers := []*troubleshootv1beta2.Analyze{}
hostAnalyzers := []*troubleshootv1beta2.HostAnalyze{}
if analyzersSpec == "" {
defaultAnalyzers, err := getDefaultAnalyzers()
defaultAnalyzers, _, err := getDefaultAnalyzers()
if err != nil {
return nil, errors.Wrap(err, "failed to get default analyzers")
}
analyzers = defaultAnalyzers
} else {
parsedAnalyzers, err := parseAnalyzers(analyzersSpec)
parsedAnalyzers, parsedHostAnalyzers, err := parseAnalyzers(analyzersSpec)
if err != nil {
return nil, errors.Wrap(err, "failed to parse analyzers")
}
analyzers = parsedAnalyzers
hostAnalyzers = parsedHostAnalyzers
}
return AnalyzeLocal(rootDir, analyzers)
return AnalyzeLocal(rootDir, analyzers, hostAnalyzers)
}
func downloadTroubleshootBundle(bundleURL string, destDir string) error {
@@ -174,33 +181,33 @@ func ExtractTroubleshootBundle(reader io.Reader, destDir string) error {
return nil
}
func parseAnalyzers(spec string) ([]*troubleshootv1beta2.Analyze, error) {
func parseAnalyzers(spec string) ([]*troubleshootv1beta2.Analyze, []*troubleshootv1beta2.HostAnalyze, error) {
troubleshootscheme.AddToScheme(scheme.Scheme)
decode := scheme.Codecs.UniversalDeserializer().Decode
convertedSpec, err := docrewrite.ConvertToV1Beta2([]byte(spec))
if err != nil {
return nil, errors.Wrap(err, "failed to convert to v1beta2")
return nil, nil, errors.Wrap(err, "failed to convert to v1beta2")
}
obj, gvk, err := decode(convertedSpec, nil, nil)
if err != nil {
return nil, errors.Wrap(err, "failed to decode analyzers")
return nil, nil, errors.Wrap(err, "failed to decode analyzers")
}
// SupportBundle overwrites Analyzer if defined
if gvk.Group == "troubleshoot.sh" && gvk.Version == "v1beta2" && gvk.Kind == "SupportBundle" {
supportBundle := obj.(*troubleshootv1beta2.SupportBundle)
return supportBundle.Spec.Analyzers, nil
return supportBundle.Spec.Analyzers, supportBundle.Spec.HostAnalyzers, nil
} else if gvk.Group == "troubleshoot.sh" && gvk.Version == "v1beta2" && gvk.Kind == "Analyzer" {
analyzer := obj.(*troubleshootv1beta2.Analyzer)
return analyzer.Spec.Analyzers, nil
return analyzer.Spec.Analyzers, analyzer.Spec.HostAnalyzers, nil
}
return nil, errors.Errorf("invalid gvk %q", gvk)
return nil, nil, errors.Errorf("invalid gvk %q", gvk)
}
func getDefaultAnalyzers() ([]*troubleshootv1beta2.Analyze, error) {
func getDefaultAnalyzers() ([]*troubleshootv1beta2.Analyze, []*troubleshootv1beta2.HostAnalyze, error) {
spec := `apiVersion: troubleshoot.sh/v1beta2
kind: Analyzer
metadata:
+112
View File
@@ -0,0 +1,112 @@
package analyzer
import (
"encoding/json"
"path/filepath"
"reflect"
"strconv"
"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
iutils "github.com/replicatedhq/troubleshoot/pkg/interfaceutils"
)
func analyzeJsonCompare(analyzer *troubleshootv1beta2.JsonCompare, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) {
fullPath := filepath.Join(analyzer.CollectorName, analyzer.FileName)
collected, err := getCollectedFileContents(fullPath)
if err != nil {
return nil, errors.Wrapf(err, "failed to read collected file name: %s", fullPath)
}
var actual interface{}
err = json.Unmarshal(collected, &actual)
if err != nil {
return nil, errors.Wrap(err, "failed to parse collected data as json")
}
if analyzer.Path != "" {
actual, err = iutils.GetAtPath(actual, analyzer.Path)
if err != nil {
return nil, errors.Wrapf(err, "failed to get object at path: %s", analyzer.Path)
}
}
var expected interface{}
err = json.Unmarshal([]byte(analyzer.Value), &expected)
if err != nil {
return nil, errors.Wrap(err, "failed to parse expected value as json")
}
title := analyzer.CheckName
if title == "" {
title = analyzer.CollectorName
}
result := &AnalyzeResult{
Title: title,
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
}
equal := reflect.DeepEqual(actual, expected)
for _, outcome := range analyzer.Outcomes {
if outcome.Fail != nil {
when := false
if outcome.Fail.When != "" {
when, err = strconv.ParseBool(outcome.Fail.When)
if err != nil {
return nil, errors.Wrapf(err, "failed to process when statement: %s", outcome.Fail.When)
}
}
if when == equal {
result.IsFail = true
result.Message = outcome.Fail.Message
result.URI = outcome.Fail.URI
return result, nil
}
} else if outcome.Warn != nil {
when := false
if outcome.Warn.When != "" {
when, err = strconv.ParseBool(outcome.Warn.When)
if err != nil {
return nil, errors.Wrapf(err, "failed to process when statement: %s", outcome.Warn.When)
}
}
if when == equal {
result.IsWarn = true
result.Message = outcome.Warn.Message
result.URI = outcome.Warn.URI
return result, nil
}
} else if outcome.Pass != nil {
when := true // default to passing when values are equal
if outcome.Pass.When != "" {
when, err = strconv.ParseBool(outcome.Pass.When)
if err != nil {
return nil, errors.Wrapf(err, "failed to process when statement: %s", outcome.Pass.When)
}
}
if when == equal {
result.IsPass = true
result.Message = outcome.Pass.Message
result.URI = outcome.Pass.URI
return result, nil
}
}
}
return &AnalyzeResult{
Title: title,
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
IsFail: true,
Message: "Invalid analyzer",
}, nil
}
+563
View File
@@ -0,0 +1,563 @@
package analyzer
import (
"testing"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/stretchr/testify/require"
)
func Test_jsonCompare(t *testing.T) {
tests := []struct {
name string
isError bool
analyzer troubleshootv1beta2.JsonCompare
expectResult AnalyzeResult
fileContents []byte
}{
{
name: "basic comparison",
analyzer: troubleshootv1beta2.JsonCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "json-compare-1",
FileName: "json-compare-1.json",
Value: `{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"morestuff": [
{
"foo": {
"bar": 123
}
}
]
}`,
},
expectResult: AnalyzeResult{
IsPass: true,
IsWarn: false,
IsFail: false,
Title: "json-compare-1",
Message: "pass",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"morestuff": [
{
"foo": {
"bar": 123
}
}
]
}`),
},
{
name: "basic comparison, but fail on match",
analyzer: troubleshootv1beta2.JsonCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
When: "false",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
When: "true",
},
},
},
CollectorName: "json-compare-1-1",
FileName: "json-compare-1-1.json",
Value: `{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"morestuff": [
{
"foo": {
"bar": 123
}
}
]
}`,
},
expectResult: AnalyzeResult{
IsPass: false,
IsWarn: false,
IsFail: true,
Title: "json-compare-1-1",
Message: "fail",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"morestuff": [
{
"foo": {
"bar": 123
}
}
]
}`),
},
{
name: "comparison using path 1",
analyzer: troubleshootv1beta2.JsonCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "json-compare-2",
FileName: "json-compare-2.json",
Path: "morestuff",
Value: `[
{
"foo": {
"bar": 123
}
}
]`,
},
expectResult: AnalyzeResult{
IsPass: true,
IsWarn: false,
IsFail: false,
Title: "json-compare-2",
Message: "pass",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"morestuff": [
{
"foo": {
"bar": 123
}
}
]
}`),
},
{
name: "comparison using path 2",
analyzer: troubleshootv1beta2.JsonCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "json-compare-3",
FileName: "json-compare-3.json",
Path: "morestuff.[0].foo.bar",
Value: `123`,
},
expectResult: AnalyzeResult{
IsPass: true,
IsWarn: false,
IsFail: false,
Title: "json-compare-3",
Message: "pass",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"morestuff": [
{
"foo": {
"bar": 123
}
}
]
}`),
},
{
name: "comparison using path 2, but warn on match",
analyzer: troubleshootv1beta2.JsonCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
When: "false",
},
},
{
Warn: &troubleshootv1beta2.SingleOutcome{
Message: "warn",
When: "true",
},
},
},
CollectorName: "json-compare-3-1",
FileName: "json-compare-3-1.json",
Path: "morestuff.[0].foo.bar",
Value: `123`,
},
expectResult: AnalyzeResult{
IsPass: false,
IsWarn: true,
IsFail: false,
Title: "json-compare-3-1",
Message: "warn",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"morestuff": [
{
"foo": {
"bar": 123
}
}
]
}`),
},
{
name: "basic comparison fail",
analyzer: troubleshootv1beta2.JsonCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "json-compare-4",
FileName: "json-compare-4.json",
Value: `{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"morestuff": [
{
"foo": {
"bar": 123
}
}
]
}`,
},
expectResult: AnalyzeResult{
IsPass: false,
IsWarn: false,
IsFail: true,
Title: "json-compare-4",
Message: "fail",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"otherstuff": [
{
"foo": {
"bar": 123
}
}
]
}`),
},
{
name: "comparison using path fail 1",
analyzer: troubleshootv1beta2.JsonCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "json-compare-5",
FileName: "json-compare-5.json",
Path: "morestuff",
Value: `[
{
"foo": {
"bar": 321
}
}
]`,
},
expectResult: AnalyzeResult{
IsPass: false,
IsWarn: false,
IsFail: true,
Title: "json-compare-5",
Message: "fail",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"morestuff": [
{
"foo": {
"bar": 123
}
}
]
}`),
},
{
name: "comparison using path, but pass when not matching",
analyzer: troubleshootv1beta2.JsonCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
When: "false",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
When: "true",
},
},
},
CollectorName: "json-compare-5-1",
FileName: "json-compare-5-1.json",
Path: "morestuff",
Value: `[
{
"foo": {
"bar": 321
}
}
]`,
},
expectResult: AnalyzeResult{
IsPass: true,
IsWarn: false,
IsFail: false,
Title: "json-compare-5-1",
Message: "pass",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"morestuff": [
{
"foo": {
"bar": 123
}
}
]
}`),
},
{
name: "basic comparison warn",
analyzer: troubleshootv1beta2.JsonCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Warn: &troubleshootv1beta2.SingleOutcome{
Message: "warn",
},
},
},
CollectorName: "json-compare-6",
FileName: "json-compare-6.json",
Value: `{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"morestuff": [
{
"foo": {
"bar": 123
}
}
]
}`,
},
expectResult: AnalyzeResult{
IsPass: false,
IsWarn: true,
IsFail: false,
Title: "json-compare-6",
Message: "warn",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`{
"foo": "bar",
"stuff": {
"foo": "bar",
"bar": true
},
"otherstuff": [
{
"foo": {
"bar": 123
}
}
]
}`),
},
{
name: "invalid json error",
isError: true,
analyzer: troubleshootv1beta2.JsonCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "json-compare-7",
FileName: "json-compare-7.json",
Path: "morestuff",
Value: `[
{
"foo": {
"bar": 123
}
}
]`,
},
fileContents: []byte(`{ "this: - is-invalid: json }`),
},
{
name: "no json error",
isError: true,
analyzer: troubleshootv1beta2.JsonCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "json-compare-8",
FileName: "json-compare-8.json",
Path: "morestuff",
Value: `[
{
"foo": {
"bar": 123
}
}
]`,
},
fileContents: []byte(``),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
req := require.New(t)
getCollectedFileContents := func(n string) ([]byte, error) {
return test.fileContents, nil
}
actual, err := analyzeJsonCompare(&test.analyzer, getCollectedFileContents)
if !test.isError {
req.NoError(err)
req.Equal(test.expectResult, *actual)
} else {
req.Error(err)
}
})
}
}
+1 -1
View File
@@ -172,7 +172,7 @@ func compareNodeResourceConditionalToActual(conditional string, matchingNodes []
for _, node := range matchingNodes {
for _, condition := range node.Status.Conditions {
if string(condition.Type) == match[2] && condition.Status == desiredValue {
if string(condition.Type) == match[2] && string(condition.Status) == desiredValue {
res = true
return
}
+7 -7
View File
@@ -39,12 +39,6 @@ func analyzePostgres(analyzer *troubleshootv1beta2.DatabaseAnalyze, getCollected
IconURI: "https://troubleshoot.sh/images/analyzer-icons/postgres-analyze.svg",
}
if databaseConnection.Error != "" {
result.IsFail = true
result.Message = databaseConnection.Error
return result, nil
}
for _, outcome := range analyzer.Outcomes {
if outcome.Fail != nil {
if outcome.Fail.When == "" {
@@ -61,8 +55,14 @@ func analyzePostgres(analyzer *troubleshootv1beta2.DatabaseAnalyze, getCollected
}
if isMatch {
if databaseConnection.Error != "" {
result.Message = outcome.Fail.Message + " " + databaseConnection.Error
} else {
result.Message = outcome.Fail.Message
}
result.IsFail = true
result.Message = outcome.Fail.Message
result.URI = outcome.Fail.URI
return result, nil
+31 -3
View File
@@ -1,11 +1,13 @@
package analyzer
import (
"bytes"
"fmt"
"path/filepath"
"regexp"
"strconv"
"strings"
"text/template"
"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
@@ -169,7 +171,11 @@ func analyzeRegexGroups(pattern string, collected []byte, outcomes []*troublesho
if isMatch {
result.IsFail = true
result.Message = outcome.Fail.Message
tplMessage, err := templateRegExGroup(outcome.Fail.Message, foundMatches)
if err != nil {
return result, errors.Wrap(err, "failed to template message in outcome.Fail block")
}
result.Message = tplMessage
result.URI = outcome.Fail.URI
return result, nil
@@ -182,7 +188,11 @@ func analyzeRegexGroups(pattern string, collected []byte, outcomes []*troublesho
if isMatch {
result.IsWarn = true
result.Message = outcome.Warn.Message
tplMessage, err := templateRegExGroup(outcome.Warn.Message, foundMatches)
if err != nil {
return result, errors.Wrap(err, "failed to template message in outcome.Warn block")
}
result.Message = tplMessage
result.URI = outcome.Warn.URI
return result, nil
@@ -195,7 +205,11 @@ func analyzeRegexGroups(pattern string, collected []byte, outcomes []*troublesho
if isMatch {
result.IsPass = true
result.Message = outcome.Pass.Message
tplMessage, err := templateRegExGroup(outcome.Pass.Message, foundMatches)
if err != nil {
return result, errors.Wrap(err, "failed to template message in outcome.Pass block")
}
result.Message = tplMessage
result.URI = outcome.Pass.URI
return result, nil
@@ -206,6 +220,20 @@ func analyzeRegexGroups(pattern string, collected []byte, outcomes []*troublesho
return result, nil
}
// templateRegExGroup takes a tpl and replaces the variables using matches.
func templateRegExGroup(tpl string, matches map[string]string) (string, error) {
t, err := template.New("").Parse(tpl)
if err != nil {
return "", err
}
var msg bytes.Buffer
err = t.Execute(&msg, matches)
if err != nil {
return "", err
}
return msg.String(), nil
}
func compareRegex(conditional string, foundMatches map[string]string) (bool, error) {
if conditional == "" {
return true, nil
+105
View File
@@ -477,6 +477,111 @@ func Test_textAnalyze(t *testing.T) {
"text-collector-1/cfile-1.txt": []byte("value: 2\nother: 10"),
},
},
// This test ensures that the Outcomes.Pass.Message can be templated using the findings of the regular expression groups.
{
name: "Outcome pass message is templated with regex groups",
analyzer: troubleshootv1beta2.TextAnalyze{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
When: `Feature == insert-feature-name-here`,
Message: "Feature {{ .Feature }} is enabled for CR {{ .CRName }} in namespace {{ .Namespace }}",
},
},
},
CollectorName: "text-collector-templated-regex-message",
FileName: "cfile-1.txt",
RegexGroups: `"name":\s*"(?P<CRName>.*?)".*namespace":\s*"(?P<Namespace>.*?)".*feature":\s*.*"(?P<Feature>insert-feature-name-here.*?)"`,
},
expectResult: []AnalyzeResult{
{
IsPass: true,
IsWarn: false,
IsFail: false,
Title: "text-collector-templated-regex-message",
Message: "Feature insert-feature-name-here is enabled for CR insert-cr-name-here in namespace default",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg?w=13&h=16",
},
},
files: map[string][]byte{
"text-collector-templated-regex-message/cfile-1.txt": []byte(`{"level":"INFO","timestamp":"2022-05-17T20:37:41Z","caller":"controller/controller.go:317","message":"Feature enabled","context":{"name":"insert-cr-name-here","namespace":"default","feature":"insert-feature-name-here"}}`),
},
},
// This test ensures that the Outcomes.Warn.Message can be templated using the findings of the regular expression groups.
{
name: "Outcome warn message is templated with regex groups",
analyzer: troubleshootv1beta2.TextAnalyze{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
When: `Warning == ""`,
Message: "No warning found",
},
},
// The Warn case is triggered if warning != ""
{
Warn: &troubleshootv1beta2.SingleOutcome{
Message: "Warning for CR with name {{ .CRName }} in namespace {{ .Namespace }}",
},
},
},
CollectorName: "text-collector-templated-regex-message",
FileName: "cfile-1.txt",
RegexGroups: `"name":\s*"(?P<CRName>.*?)".*namespace":\s*"(?P<Namespace>.*?)".*warning":\s*.*"(?P<Error>mywarning.*?)"`,
},
expectResult: []AnalyzeResult{
{
IsPass: false,
IsWarn: true,
IsFail: false,
Title: "text-collector-templated-regex-message",
Message: "Warning for CR with name insert-cr-name-here in namespace default",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg?w=13&h=16",
},
},
files: map[string][]byte{
"text-collector-templated-regex-message/cfile-1.txt": []byte(`{"level":"WARN","timestamp":"2022-05-17T20:37:41Z","caller":"controller/controller.go:317","message":"Reconciler error","context":{"name":"insert-cr-name-here","namespace":"default","warning":"mywarning"}}`),
},
},
// This test ensures that the Outcomes.Fail.Message can be templated using the findings of the regular expression groups.
{
name: "Outcome fail message is templated with regex groups",
analyzer: troubleshootv1beta2.TextAnalyze{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
When: `Error == ""`,
Message: "No error found",
},
},
// The Fail case is triggered if warning != ""
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "Error for CR with name {{ .CRName }} in namespace {{ .Namespace }}",
},
},
},
CollectorName: "text-collector-templated-regex-message",
FileName: "cfile-1.txt",
RegexGroups: `"name":\s*"(?P<CRName>.*?)".*namespace":\s*"(?P<Namespace>.*?)".*error":\s*.*"(?P<Error>myerror.*?)"`,
},
expectResult: []AnalyzeResult{
{
IsPass: false,
IsWarn: false,
IsFail: true,
Title: "text-collector-templated-regex-message",
Message: "Error for CR with name insert-cr-name-here in namespace default",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg?w=13&h=16",
},
},
files: map[string][]byte{
"text-collector-templated-regex-message/cfile-1.txt": []byte(`{"level":"ERROR","timestamp":"2022-05-17T20:37:41Z","caller":"controller/controller.go:317","message":"Reconciler error","context":{"name":"insert-cr-name-here","namespace":"default","error":"myerror"}}`),
},
},
}
for _, test := range tests {
+109
View File
@@ -0,0 +1,109 @@
package analyzer
import (
"path/filepath"
"reflect"
"strconv"
"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
iutils "github.com/replicatedhq/troubleshoot/pkg/interfaceutils"
"gopkg.in/yaml.v2"
)
func analyzeYamlCompare(analyzer *troubleshootv1beta2.YamlCompare, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) {
fullPath := filepath.Join(analyzer.CollectorName, analyzer.FileName)
collected, err := getCollectedFileContents(fullPath)
if err != nil {
return nil, errors.Wrapf(err, "failed to read collected file name: %s", fullPath)
}
var actual interface{}
err = yaml.Unmarshal(collected, &actual)
if err != nil {
return nil, errors.Wrap(err, "failed to parse collected data as yaml doc")
}
if analyzer.Path != "" {
actual, err = iutils.GetAtPath(actual, analyzer.Path)
if err != nil {
return nil, errors.Wrapf(err, "failed to get object at path: %s", analyzer.Path)
}
}
var expected interface{}
err = yaml.Unmarshal([]byte(analyzer.Value), &expected)
if err != nil {
return nil, errors.Wrap(err, "failed to parse expected value as yaml doc")
}
title := analyzer.CheckName
if title == "" {
title = analyzer.CollectorName
}
result := &AnalyzeResult{
Title: title,
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
}
equal := reflect.DeepEqual(actual, expected)
for _, outcome := range analyzer.Outcomes {
if outcome.Fail != nil {
when := false
if outcome.Fail.When != "" {
when, err = strconv.ParseBool(outcome.Fail.When)
if err != nil {
return nil, errors.Wrapf(err, "failed to process when statement: %s", outcome.Fail.When)
}
}
if when == equal {
result.IsFail = true
result.Message = outcome.Fail.Message
result.URI = outcome.Fail.URI
return result, nil
}
} else if outcome.Warn != nil {
when := false
if outcome.Warn.When != "" {
when, err = strconv.ParseBool(outcome.Warn.When)
if err != nil {
return nil, errors.Wrapf(err, "failed to process when statement: %s", outcome.Warn.When)
}
}
if when == equal {
result.IsWarn = true
result.Message = outcome.Warn.Message
result.URI = outcome.Warn.URI
return result, nil
}
} else if outcome.Pass != nil {
when := true // default to passing when values are equal
if outcome.Pass.When != "" {
when, err = strconv.ParseBool(outcome.Pass.When)
if err != nil {
return nil, errors.Wrapf(err, "failed to process when statement: %s", outcome.Pass.When)
}
}
if when == equal {
result.IsPass = true
result.Message = outcome.Pass.Message
result.URI = outcome.Pass.URI
return result, nil
}
}
}
return &AnalyzeResult{
Title: title,
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
IsFail: true,
Message: "Invalid analyzer",
}, nil
}
+452
View File
@@ -0,0 +1,452 @@
package analyzer
import (
"testing"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/stretchr/testify/require"
)
func Test_yamlCompare(t *testing.T) {
tests := []struct {
name string
isError bool
analyzer troubleshootv1beta2.YamlCompare
expectResult AnalyzeResult
fileContents []byte
}{
{
name: "basic comparison",
analyzer: troubleshootv1beta2.YamlCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "yaml-compare-1",
FileName: "yaml-compare-1.yaml",
Value: `foo: bar
stuff:
foo: bar
bar: foo
morestuff:
- foo:
bar: baz`,
},
expectResult: AnalyzeResult{
IsPass: true,
IsWarn: false,
IsFail: false,
Title: "yaml-compare-1",
Message: "pass",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`foo: bar
stuff:
foo: bar
bar: foo
morestuff:
- foo:
bar: baz`),
},
{
name: "basic comparison, but fail on match",
analyzer: troubleshootv1beta2.YamlCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
When: "false",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
When: "true",
},
},
},
CollectorName: "yaml-compare-1-1",
FileName: "yaml-compare-1-1.yaml",
Value: `foo: bar
stuff:
foo: bar
bar: foo
morestuff:
- foo:
bar: baz`,
},
expectResult: AnalyzeResult{
IsPass: false,
IsWarn: false,
IsFail: true,
Title: "yaml-compare-1-1",
Message: "fail",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`foo: bar
stuff:
foo: bar
bar: foo
morestuff:
- foo:
bar: baz`),
},
{
name: "comparison using path 1",
analyzer: troubleshootv1beta2.YamlCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "yaml-compare-2",
FileName: "yaml-compare-2.yaml",
Path: "morestuff",
Value: `- foo:
bar: baz`,
},
expectResult: AnalyzeResult{
IsPass: true,
IsWarn: false,
IsFail: false,
Title: "yaml-compare-2",
Message: "pass",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`foo: bar
stuff:
foo: bar
bar: foo
morestuff:
- foo:
bar: baz`),
},
{
name: "comparison using path, but warn when matching",
analyzer: troubleshootv1beta2.YamlCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
When: "false",
},
},
{
Warn: &troubleshootv1beta2.SingleOutcome{
Message: "warn",
When: "true",
},
},
},
CollectorName: "yaml-compare-2-1",
FileName: "yaml-compare-2-1.yaml",
Path: "morestuff",
Value: `- foo:
bar: baz`,
},
expectResult: AnalyzeResult{
IsPass: false,
IsWarn: true,
IsFail: false,
Title: "yaml-compare-2-1",
Message: "warn",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`foo: bar
stuff:
foo: bar
bar: foo
morestuff:
- foo:
bar: baz`),
},
{
name: "comparison using path 2",
analyzer: troubleshootv1beta2.YamlCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "yaml-compare-3",
FileName: "yaml-compare-3.yaml",
Path: "morestuff.[0].foo",
Value: `bar: baz`,
},
expectResult: AnalyzeResult{
IsPass: true,
IsWarn: false,
IsFail: false,
Title: "yaml-compare-3",
Message: "pass",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`foo: bar
stuff:
foo: bar
bar: foo
morestuff:
- foo:
bar: baz`),
},
{
name: "basic comparison fail",
analyzer: troubleshootv1beta2.YamlCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "yaml-compare-4",
FileName: "yaml-compare-4.yaml",
Value: `foo: bar
stuff:
foo: bar
bar: foo
morestuff:
- foo:
bar: baz`,
},
expectResult: AnalyzeResult{
IsPass: false,
IsWarn: false,
IsFail: true,
Title: "yaml-compare-4",
Message: "fail",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`foo: bar
stuff:
foo: bar
bar: foo
otherstuff:
- foo:
bar: baz`),
},
{
name: "basic comparison pass when not matching",
analyzer: troubleshootv1beta2.YamlCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
When: "false",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
When: "true",
},
},
},
CollectorName: "yaml-compare-4-1",
FileName: "yaml-compare-4-1.yaml",
Value: `foo: bar
stuff:
foo: bar
bar: foo
morestuff:
- foo:
bar: baz`,
},
expectResult: AnalyzeResult{
IsPass: true,
IsWarn: false,
IsFail: false,
Title: "yaml-compare-4-1",
Message: "pass",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`foo: bar
stuff:
foo: bar
bar: foo
otherstuff:
- foo:
bar: baz`),
},
{
name: "comparison using path fail 1",
analyzer: troubleshootv1beta2.YamlCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "yaml-compare-5",
FileName: "yaml-compare-5.yaml",
Path: "morestuff",
Value: `- bar:
foo: baz`,
},
expectResult: AnalyzeResult{
IsPass: false,
IsWarn: false,
IsFail: true,
Title: "yaml-compare-5",
Message: "fail",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`foo: bar
stuff:
foo: bar
bar: foo
morestuff:
- foo:
bar: baz`),
},
{
name: "basic comparison warn",
analyzer: troubleshootv1beta2.YamlCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Warn: &troubleshootv1beta2.SingleOutcome{
Message: "warn",
},
},
},
CollectorName: "yaml-compare-6",
FileName: "yaml-compare-6.yaml",
Value: `foo: bar
stuff:
foo: bar
bar: foo
morestuff:
- foo:
bar: baz`,
},
expectResult: AnalyzeResult{
IsPass: false,
IsWarn: true,
IsFail: false,
Title: "yaml-compare-6",
Message: "warn",
IconKey: "kubernetes_text_analyze",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
},
fileContents: []byte(`foo: bar
stuff:
foo: bar
bar: foo
otherstuff:
- foo:
bar: baz`),
},
{
name: "invalid yaml error",
isError: true,
analyzer: troubleshootv1beta2.YamlCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "yaml-compare-7",
FileName: "yaml-compare-7.yaml",
Path: "morestuff",
Value: `- foo:
bar: baz`,
},
fileContents: []byte(`{ "this: - is-invalid: yaml }`),
},
{
name: "no yaml error",
isError: true,
analyzer: troubleshootv1beta2.YamlCompare{
Outcomes: []*troubleshootv1beta2.Outcome{
{
Pass: &troubleshootv1beta2.SingleOutcome{
Message: "pass",
},
},
{
Fail: &troubleshootv1beta2.SingleOutcome{
Message: "fail",
},
},
},
CollectorName: "yaml-compare-8",
FileName: "yaml-compare-8.yaml",
Path: "morestuff",
Value: `- foo:
bar: baz`,
},
fileContents: []byte(``),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
req := require.New(t)
getCollectedFileContents := func(n string) ([]byte, error) {
return test.fileContents, nil
}
actual, err := analyzeYamlCompare(&test.analyzer, getCollectedFileContents)
if !test.isError {
req.NoError(err)
req.Equal(test.expectResult, *actual)
} else {
req.Error(err)
}
})
}
}
@@ -131,6 +131,24 @@ type TextAnalyze struct {
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
}
type YamlCompare struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
FileName string `json:"fileName,omitempty" yaml:"fileName,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
Value string `json:"value,omitempty" yaml:"value,omitempty"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
}
type JsonCompare struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
FileName string `json:"fileName,omitempty" yaml:"fileName,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
Value string `json:"value,omitempty" yaml:"value,omitempty"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
}
type DatabaseAnalyze struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
@@ -175,9 +193,10 @@ type SysctlAnalyze struct {
}
type AnalyzeMeta struct {
CheckName string `json:"checkName,omitempty" yaml:"checkName,omitempty"`
Exclude *multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
Strict *multitype.BoolOrString `json:"strict,omitempty" yaml:"strict,omitempty"`
CheckName string `json:"checkName,omitempty" yaml:"checkName,omitempty"`
Exclude *multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
Strict *multitype.BoolOrString `json:"strict,omitempty" yaml:"strict,omitempty"`
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
}
type Analyze struct {
@@ -197,6 +216,8 @@ type Analyze struct {
Distribution *Distribution `json:"distribution,omitempty" yaml:"distribution,omitempty"`
NodeResources *NodeResources `json:"nodeResources,omitempty" yaml:"nodeResources,omitempty"`
TextAnalyze *TextAnalyze `json:"textAnalyze,omitempty" yaml:"textAnalyze,omitempty"`
YamlCompare *YamlCompare `json:"yamlCompare,omitempty" yaml:"yamlCompare,omitempty"`
JsonCompare *JsonCompare `json:"jsonCompare,omitempty" yaml:"jsonCompare,omitempty"`
Postgres *DatabaseAnalyze `json:"postgres,omitempty" yaml:"postgres,omitempty"`
Mysql *DatabaseAnalyze `json:"mysql,omitempty" yaml:"mysql,omitempty"`
Redis *DatabaseAnalyze `json:"redis,omitempty" yaml:"redis,omitempty"`
@@ -22,7 +22,8 @@ import (
// AnalyzerSpec defines the desired state of Analyzer
type AnalyzerSpec struct {
Analyzers []*Analyze `json:"analyzers,omitempty"`
Analyzers []*Analyze `json:"analyzers,omitempty"`
HostAnalyzers []*HostAnalyze `json:"hostAnalyzers,omitempty" yaml:"hostAnalyzers,omitempty"`
}
// AnalyzerStatus defines the observed state of Analyzer
@@ -0,0 +1,105 @@
package v1beta2
import (
corev1 "k8s.io/api/core/v1"
)
func (c *Run) GetImage() string {
return c.Image
}
func (c *Run) SetImage(image string) {
c.Image = image
}
func (c *Run) GetImagePullSecret() *ImagePullSecrets {
return c.ImagePullSecret
}
func (c *Run) SetImagePullSecret(secrets *ImagePullSecrets) {
c.ImagePullSecret = secrets
}
func (c *Run) GetNamespace() string {
return c.Namespace
}
func (c *CopyFromHost) GetImage() string {
return c.Image
}
func (c *CopyFromHost) SetImage(image string) {
c.Image = image
}
func (c *CopyFromHost) GetImagePullSecret() *ImagePullSecrets {
return c.ImagePullSecret
}
func (c *CopyFromHost) SetImagePullSecret(secrets *ImagePullSecrets) {
c.ImagePullSecret = secrets
}
func (c *CopyFromHost) GetNamespace() string {
return c.Namespace
}
func (c *Sysctl) GetImage() string {
return c.Image
}
func (c *Sysctl) SetImage(image string) {
c.Image = image
}
func (c *Sysctl) GetImagePullSecret() *ImagePullSecrets {
return c.ImagePullSecret
}
func (c *Sysctl) SetImagePullSecret(secrets *ImagePullSecrets) {
c.ImagePullSecret = secrets
}
func (c *Sysctl) GetNamespace() string {
return c.Namespace
}
func (c *Collectd) GetImage() string {
return c.Image
}
func (c *Collectd) SetImage(image string) {
c.Image = image
}
func (c *Collectd) GetImagePullSecret() *ImagePullSecrets {
return c.ImagePullSecret
}
func (c *Collectd) SetImagePullSecret(secrets *ImagePullSecrets) {
c.ImagePullSecret = secrets
}
func (c *Collectd) GetNamespace() string {
return c.Namespace
}
func (c *RunPod) GetPodSpec() corev1.PodSpec {
return c.PodSpec
}
func (c *RunPod) SetPodSpec(podSpec corev1.PodSpec) {
c.PodSpec = podSpec
}
func (c *RunPod) GetImagePullSecret() *ImagePullSecrets {
return c.ImagePullSecret
}
func (c *RunPod) SetImagePullSecret(secrets *ImagePullSecrets) {
c.ImagePullSecret = secrets
}
func (c *RunPod) GetNamespace() string {
return c.Namespace
}
@@ -2,6 +2,7 @@ package v1beta2
import (
"fmt"
"reflect"
"strings"
"github.com/replicatedhq/troubleshoot/pkg/multitype"
@@ -538,3 +539,20 @@ func pickNamespaceOrDefault(collectorNS string, overrideNS string) string {
}
return "default"
}
func GetCollector(collector *Collect) interface{} {
if collector == nil {
return nil
}
reflected := reflect.ValueOf(collector).Elem()
for i := 0; i < reflected.NumField(); i++ {
if reflected.Field(i).IsNil() {
continue
}
return reflect.Indirect(reflected.Field(i)).Addr().Interface()
}
return nil
}
@@ -150,6 +150,12 @@ type HostServices struct {
HostCollectorMeta `json:",inline" yaml:",inline"`
}
type HostRun struct {
HostCollectorMeta `json:",inline" yaml:",inline"`
Command string `json:"command"`
Args []string `json:"args"`
}
type HostCollect struct {
CPU *CPU `json:"cpu,omitempty" yaml:"cpu,omitempty"`
Memory *Memory `json:"memory,omitempty" yaml:"memory,omitempty"`
@@ -169,6 +175,7 @@ type HostCollect struct {
Certificate *Certificate `json:"certificate,omitempty" yaml:"certificate,omitempty"`
HostServices *HostServices `json:"hostServices,omitempty" yaml:"hostServices,omitempty"`
HostOS *HostOS `json:"hostOS,omitempty" yaml:"hostOS,omitempty"`
HostRun *HostRun `json:"run,omitempty" yaml:"run,omitempty"`
}
func (c *HostCollect) GetName() string {
@@ -26,6 +26,7 @@ type SupportBundleSpec struct {
Collectors []*Collect `json:"collectors,omitempty" yaml:"collectors,omitempty"`
HostCollectors []*HostCollect `json:"hostCollectors,omitempty" yaml:"hostCollectors,omitempty"`
Analyzers []*Analyze `json:"analyzers,omitempty" yaml:"analyzers,omitempty"`
HostAnalyzers []*HostAnalyze `json:"hostAnalyzers,omitempty" yaml:"hostAnalyzers,omitempty"`
}
// SupportBundleStatus defines the observed state of SupportBundle
@@ -134,6 +134,16 @@ func (in *Analyze) DeepCopyInto(out *Analyze) {
*out = new(TextAnalyze)
(*in).DeepCopyInto(*out)
}
if in.YamlCompare != nil {
in, out := &in.YamlCompare, &out.YamlCompare
*out = new(YamlCompare)
(*in).DeepCopyInto(*out)
}
if in.JsonCompare != nil {
in, out := &in.JsonCompare, &out.JsonCompare
*out = new(JsonCompare)
(*in).DeepCopyInto(*out)
}
if in.Postgres != nil {
in, out := &in.Postgres, &out.Postgres
*out = new(DatabaseAnalyze)
@@ -226,6 +236,13 @@ func (in *AnalyzeMeta) DeepCopyInto(out *AnalyzeMeta) {
*out = new(multitype.BoolOrString)
**out = **in
}
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalyzeMeta.
@@ -338,6 +355,17 @@ func (in *AnalyzerSpec) DeepCopyInto(out *AnalyzerSpec) {
}
}
}
if in.HostAnalyzers != nil {
in, out := &in.HostAnalyzers, &out.HostAnalyzers
*out = make([]*HostAnalyze, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(HostAnalyze)
(*in).DeepCopyInto(*out)
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalyzerSpec.
@@ -1620,6 +1648,11 @@ func (in *HostCollect) DeepCopyInto(out *HostCollect) {
*out = new(HostOS)
(*in).DeepCopyInto(*out)
}
if in.HostRun != nil {
in, out := &in.HostRun, &out.HostRun
*out = new(HostRun)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostCollect.
@@ -1975,6 +2008,27 @@ func (in *HostPreflightStatus) DeepCopy() *HostPreflightStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HostRun) DeepCopyInto(out *HostRun) {
*out = *in
in.HostCollectorMeta.DeepCopyInto(&out.HostCollectorMeta)
if in.Args != nil {
in, out := &in.Args, &out.Args
*out = make([]string, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostRun.
func (in *HostRun) DeepCopy() *HostRun {
if in == nil {
return nil
}
out := new(HostRun)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HostServices) DeepCopyInto(out *HostServices) {
*out = *in
@@ -2276,6 +2330,33 @@ func (in *JobStatus) DeepCopy() *JobStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JsonCompare) DeepCopyInto(out *JsonCompare) {
*out = *in
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(Outcome)
(*in).DeepCopyInto(*out)
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JsonCompare.
func (in *JsonCompare) DeepCopy() *JsonCompare {
if in == nil {
return nil
}
out := new(JsonCompare)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KernelModulesAnalyze) DeepCopyInto(out *KernelModulesAnalyze) {
*out = *in
@@ -3748,6 +3829,17 @@ func (in *SupportBundleSpec) DeepCopyInto(out *SupportBundleSpec) {
}
}
}
if in.HostAnalyzers != nil {
in, out := &in.HostAnalyzers, &out.HostAnalyzers
*out = make([]*HostAnalyze, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(HostAnalyze)
(*in).DeepCopyInto(*out)
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundleSpec.
@@ -4079,3 +4171,30 @@ func (in *WeaveReportAnalyze) DeepCopy() *WeaveReportAnalyze {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *YamlCompare) DeepCopyInto(out *YamlCompare) {
*out = *in
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(Outcome)
(*in).DeepCopyInto(*out)
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new YamlCompare.
func (in *YamlCompare) DeepCopy() *YamlCompare {
if in == nil {
return nil
}
out := new(YamlCompare)
in.DeepCopyInto(out)
return out
}
@@ -75,7 +75,10 @@ func (c *Clientset) Tracker() testing.ObjectTracker {
return c.tracker
}
var _ clientset.Interface = &Clientset{}
var (
_ clientset.Interface = &Clientset{}
_ testing.FakeClient = &Clientset{}
)
// TroubleshootV1beta1 retrieves the TroubleshootV1beta1Client
func (c *Clientset) TroubleshootV1beta1() troubleshootv1beta1.TroubleshootV1beta1Interface {
+37 -1
View File
@@ -8,6 +8,7 @@ import (
"fmt"
"path" // this code uses 'path' and not 'path/filepath' because we don't want backslashes on windows
"path/filepath"
"sort"
"strings"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
@@ -23,6 +24,7 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/version"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
@@ -767,6 +769,18 @@ func crs(ctx context.Context, dyn dynamic.Interface, client *kubernetes.Clientse
return crsV1beta(ctx, dyn, config, namespaces)
}
// Selects the newest version by kube-aware priority.
func selectCRDVersionByPriority(versions []string) string {
if len(versions) == 0 {
return ""
}
sort.Slice(versions, func(i, j int) bool {
return version.CompareKubeAwareVersionStrings(versions[i], versions[j]) < 0
})
return versions[len(versions)-1]
}
func crsV1(ctx context.Context, client dynamic.Interface, config *rest.Config, namespaces []string) (map[string][]byte, map[string]string) {
customResources := make(map[string][]byte)
errorList := make(map[string]string)
@@ -795,7 +809,15 @@ func crsV1(ctx context.Context, client dynamic.Interface, config *rest.Config, n
var version string
if len(crd.Spec.Versions) > 0 {
version = crd.Spec.Versions[0].Name
versions := []string{}
for _, v := range crd.Spec.Versions {
versions = append(versions, v.Name)
}
version = versions[0]
if len(versions) > 1 {
version = selectCRDVersionByPriority(versions)
}
}
gvr := schema.GroupVersionResource{
Group: crd.Spec.Group,
@@ -899,6 +921,20 @@ func crsV1beta(ctx context.Context, client dynamic.Interface, config *rest.Confi
Version: crd.Spec.Version,
Resource: crd.Spec.Names.Plural,
}
if len(crd.Spec.Versions) > 0 {
versions := []string{}
for _, v := range crd.Spec.Versions {
versions = append(versions, v.Name)
}
version := versions[0]
if len(versions) > 1 {
version = selectCRDVersionByPriority(versions)
}
gvr.Version = version
}
isNamespacedResource := crd.Spec.Scope == apiextensionsv1beta1.NamespaceScoped
// Fetch all resources of given type
+14
View File
@@ -0,0 +1,14 @@
package collect
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_SelectCRDVersionByPriority(t *testing.T) {
assert.Equal(t, "v1alpha3", selectCRDVersionByPriority([]string{"v1alpha2", "v1alpha3"}))
assert.Equal(t, "v1alpha3", selectCRDVersionByPriority([]string{"v1alpha3", "v1alpha2"}))
assert.Equal(t, "v1", selectCRDVersionByPriority([]string{"v1alpha2", "v1alpha3", "v1"}))
assert.Equal(t, "v1", selectCRDVersionByPriority([]string{"v1", "v1alpha2", "v1alpha3"}))
}
+1 -1
View File
@@ -293,7 +293,7 @@ func (c *Collector) RunCollectorSync(clientConfig *rest.Config, client kubernete
}
if c.Redact {
err = redactResult(c.BundlePath, result, globalRedactors)
err = RedactResult(c.BundlePath, result, globalRedactors)
err = errors.Wrap(err, "failed to redact")
}
+7 -2
View File
@@ -137,6 +137,11 @@ func copyFromHostCreateDaemonSet(ctx context.Context, client kubernetes.Interfac
Operator: "Exists",
Effect: "NoSchedule",
},
{
Key: "node-role.kubernetes.io/control-plane",
Operator: "Exists",
Effect: "NoSchedule",
},
},
Volumes: []corev1.Volume{
{
@@ -169,7 +174,7 @@ func copyFromHostCreateDaemonSet(ctx context.Context, client kubernetes.Interfac
ds.Spec.Template.Spec.ImagePullSecrets = append(ds.Spec.Template.Spec.ImagePullSecrets, corev1.LocalObjectReference{Name: secretName})
cleanupFuncs = append(cleanupFuncs, func() {
err := client.CoreV1().Secrets(namespace).Delete(ctx, collector.ImagePullSecret.Name, metav1.DeleteOptions{})
err := client.CoreV1().Secrets(namespace).Delete(context.Background(), collector.ImagePullSecret.Name, metav1.DeleteOptions{})
if err != nil && !kuberneteserrors.IsNotFound(err) {
logger.Printf("Failed to delete secret %s: %v", collector.ImagePullSecret.Name, err)
}
@@ -181,7 +186,7 @@ func copyFromHostCreateDaemonSet(ctx context.Context, client kubernetes.Interfac
return "", cleanup, errors.Wrap(err, "create daemonset")
}
cleanupFuncs = append(cleanupFuncs, func() {
if err := client.AppsV1().DaemonSets(namespace).Delete(ctx, createdDS.Name, metav1.DeleteOptions{}); err != nil {
if err := client.AppsV1().DaemonSets(namespace).Delete(context.Background(), createdDS.Name, metav1.DeleteOptions{}); err != nil {
logger.Printf("Failed to delete daemonset %s: %v", createdDS.Name, err)
}
})
+2
View File
@@ -51,6 +51,8 @@ func GetHostCollector(collector *troubleshootv1beta2.HostCollect, bundlePath str
return &CollectHostServices{collector.HostServices, bundlePath}, true
case collector.HostOS != nil:
return &CollectHostOS{collector.HostOS, bundlePath}, true
case collector.HostRun != nil:
return &CollectHostRun{collector.HostRun, bundlePath}, true
default:
return nil, false
}
+79
View File
@@ -0,0 +1,79 @@
package collect
import (
"bytes"
"encoding/json"
"os/exec"
"path/filepath"
"strings"
"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
)
type HostRunInfo struct {
Command string `json:"command"`
ExitCode string `json:"exitCode"`
Error string `json:"error"`
}
type CollectHostRun struct {
hostCollector *troubleshootv1beta2.HostRun
BundlePath string
}
func (c *CollectHostRun) Title() string {
return hostCollectorTitleOrDefault(c.hostCollector.HostCollectorMeta, "Run Host")
}
func (c *CollectHostRun) IsExcluded() (bool, error) {
return isExcluded(c.hostCollector.Exclude)
}
func (c *CollectHostRun) Collect(progressChan chan<- interface{}) (map[string][]byte, error) {
runHostCollector := c.hostCollector
cmd := exec.Command(runHostCollector.Command, runHostCollector.Args...)
var stdout, stderr bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = &stderr
runInfo := HostRunInfo{
Command: cmd.String(),
ExitCode: "0",
}
err := cmd.Run()
if err != nil {
if werr, ok := err.(*exec.ExitError); ok {
runInfo.ExitCode = strings.TrimPrefix(werr.Error(), "exit status ")
runInfo.Error = stderr.String()
} else {
return nil, errors.Wrap(err, "failed to run")
}
}
collectorName := c.hostCollector.CollectorName
if collectorName == "" {
collectorName = "run-host"
}
resultInfo := filepath.Join("host-collectors/run-host", collectorName+"-info.json")
result := filepath.Join("host-collectors/run-host", collectorName+".txt")
b, err := json.Marshal(runInfo)
if err != nil {
return nil, errors.Wrap(err, "failed to marshal run host result")
}
output := NewResult()
output.SaveResult(c.BundlePath, resultInfo, bytes.NewBuffer(b))
output.SaveResult(c.BundlePath, result, bytes.NewBuffer(stdout.Bytes()))
runHostOutput := map[string][]byte{
resultInfo: b,
result: stdout.Bytes(),
}
return runHostOutput, nil
}
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"periph.io/x/periph/host/distro"
"periph.io/x/host/v3/distro"
)
type SystemPackagesInfo struct {
+33
View File
@@ -0,0 +1,33 @@
package collect
import (
"github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
corev1 "k8s.io/api/core/v1"
)
type ImageRunner interface {
GetImage() string
SetImage(string)
GetImagePullSecret() *v1beta2.ImagePullSecrets
SetImagePullSecret(*v1beta2.ImagePullSecrets)
GetNamespace() string
}
var _ ImageRunner = &v1beta2.Run{}
var _ ImageRunner = &v1beta2.CopyFromHost{}
var _ ImageRunner = &v1beta2.Sysctl{}
var _ ImageRunner = &v1beta2.Collectd{}
type PodSpecRunner interface {
GetPodSpec() corev1.PodSpec
SetPodSpec(corev1.PodSpec)
GetImagePullSecret() *v1beta2.ImagePullSecrets
SetImagePullSecret(*v1beta2.ImagePullSecrets)
GetNamespace() string
}
var _ PodSpecRunner = &v1beta2.RunPod{}
+57
View File
@@ -0,0 +1,57 @@
package collect
import (
"testing"
"github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/stretchr/testify/require"
)
func Test_interfaces(t *testing.T) {
runCollector := &v1beta2.Run{}
clusterInfoCollector := &v1beta2.ClusterInfo{}
tests := []struct {
name string
collect *v1beta2.Collect
want interface{}
wantRunner bool
}{
{
name: "image runner collector",
collect: &v1beta2.Collect{
Run: runCollector,
},
want: runCollector,
wantRunner: true,
},
{
name: "not image runner collector",
collect: &v1beta2.Collect{
ClusterInfo: clusterInfoCollector,
},
want: clusterInfoCollector,
wantRunner: false,
},
{
name: "no collector",
collect: &v1beta2.Collect{},
want: nil,
wantRunner: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
req := require.New(t)
got := v1beta2.GetCollector(tt.collect)
req.EqualValues(tt.want, got)
runner, ok := got.(ImageRunner)
req.EqualValues(tt.wantRunner, ok)
if tt.wantRunner {
req.EqualValues(tt.want, runner)
}
})
}
}
+2 -2
View File
@@ -15,7 +15,7 @@ import (
"github.com/replicatedhq/troubleshoot/pkg/redact"
)
func redactResult(bundlePath string, input CollectorResult, additionalRedactors []*troubleshootv1beta2.Redact) error {
func RedactResult(bundlePath string, input CollectorResult, additionalRedactors []*troubleshootv1beta2.Redact) error {
for k, v := range input {
var reader io.Reader
if v == nil {
@@ -46,7 +46,7 @@ func redactResult(bundlePath string, input CollectorResult, additionalRedactors
if err != nil {
return errors.Wrap(err, "failed to decompress file")
}
err = redactResult(tmpDir, subResult, additionalRedactors)
err = RedactResult(tmpDir, subResult, additionalRedactors)
if err != nil {
return errors.Wrap(err, "failed to redact file")
}
+1 -1
View File
@@ -107,7 +107,7 @@ func (c *RemoteCollector) RunCollectorSync(globalRedactors []*troubleshootv1beta
return result, nil
}
if err = redactResult("", result, globalRedactors); err != nil {
if err = RedactResult("", result, globalRedactors); err != nil {
// Returning result on error to be consistent with local collector.
return result, errors.Wrap(err, "failed to redact")
}
+3 -3
View File
@@ -69,16 +69,16 @@ func RunPod(c *Collector, runPodCollector *troubleshootv1beta2.RunPod) (Collecto
if err != nil {
return nil, errors.Wrap(err, "failed to run pod")
}
defer func() {
if err := client.CoreV1().Pods(pod.Namespace).Delete(ctx, pod.Name, metav1.DeleteOptions{}); err != nil {
if err := client.CoreV1().Pods(pod.Namespace).Delete(context.Background(), pod.Name, metav1.DeleteOptions{}); err != nil {
logger.Printf("Failed to delete pod %s: %v", pod.Name, err)
}
}()
if runPodCollector.ImagePullSecret != nil && runPodCollector.ImagePullSecret.Data != nil {
defer func() {
for _, k := range pod.Spec.ImagePullSecrets {
if err := client.CoreV1().Secrets(pod.Namespace).Delete(ctx, k.Name, metav1.DeleteOptions{}); err != nil {
if err := client.CoreV1().Secrets(pod.Namespace).Delete(context.Background(), k.Name, metav1.DeleteOptions{}); err != nil {
logger.Printf("Failed to delete secret %s: %v", k.Name, err)
}
}
+11 -9
View File
@@ -69,6 +69,11 @@ func RunPodsReadyNodes(ctx context.Context, client v1.CoreV1Interface, opts RunP
Operator: "Exists",
Effect: "NoSchedule",
},
{
Key: "node-role.kubernetes.io/control-plane",
Operator: "Exists",
Effect: "NoSchedule",
},
},
},
}
@@ -93,20 +98,17 @@ func RunPodsReadyNodes(ctx context.Context, client v1.CoreV1Interface, opts RunP
}
// RunPodLogs runs a pod to completion on a node and returns its logs
func RunPodLogs(ctx context.Context, client v1.CoreV1Interface, pod *corev1.Pod) ([]byte, error) {
func RunPodLogs(ctx context.Context, client v1.CoreV1Interface, podSpec *corev1.Pod) ([]byte, error) {
// 1. Create
pod, err := client.Pods(pod.Namespace).Create(ctx, pod, metav1.CreateOptions{})
pod, err := client.Pods(podSpec.Namespace).Create(ctx, podSpec, metav1.CreateOptions{})
if err != nil {
return nil, errors.Wrap(err, "failed to create pod")
}
defer func() {
go func() {
// use context.background for the after-completion cleanup, as the parent context might already be over
err := client.Pods(pod.Namespace).Delete(context.Background(), pod.Name, metav1.DeleteOptions{})
if err != nil && !kuberneteserrors.IsNotFound(err) {
logger.Printf("Failed to delete pod %s: %v\n", pod.Name, err)
}
}()
err := client.Pods(pod.Namespace).Delete(context.Background(), pod.Name, metav1.DeleteOptions{})
if err != nil && !kuberneteserrors.IsNotFound(err) {
logger.Printf("Failed to delete pod %s: %v\n", pod.Name, err)
}
}()
// 2. Wait
+1 -1
View File
@@ -51,7 +51,7 @@ find /proc/sys/net/bridge -type f | while read f; do v=$(cat $f 2>/dev/null); ec
return nil, errors.Wrap(err, "create image pull secret")
}
defer func() {
err := client.CoreV1().Secrets(collector.Namespace).Delete(ctx, collector.ImagePullSecret.Name, metav1.DeleteOptions{})
err := client.CoreV1().Secrets(collector.Namespace).Delete(context.Background(), collector.ImagePullSecret.Name, metav1.DeleteOptions{})
if err != nil && !kuberneteserrors.IsNotFound(err) {
logger.Printf("Failed to delete secret %s: %v", collector.ImagePullSecret.Name, err)
}
+28 -13
View File
@@ -25,20 +25,35 @@ func Bool(text string, data interface{}) (bool, error) {
}
func Execute(text string, data interface{}) (string, error) {
tmpl, err := template.New(text).
Delims("{{repl", "}}").
Funcs(funcMap).
Parse(text)
if err != nil {
return "", err
delims := []struct {
ldelim string
rdelim string
}{
{"{{repl", "}}"},
{"repl{{", "}}"},
}
var buf bytes.Buffer
err = func() (err error) {
defer errRecover(&err)
err = tmpl.Execute(&buf, data)
return
}()
return buf.String(), err
curText := text
for _, d := range delims {
tmpl, err := template.New(curText).
Delims(d.ldelim, d.rdelim).
Funcs(funcMap).
Parse(curText)
if err != nil {
return "", err
}
var buf bytes.Buffer
err = func() (err error) {
defer errRecover(&err)
err = tmpl.Execute(&buf, data)
return
}()
if err != nil {
return "", err
}
curText = buf.String()
}
return curText, nil
}
func RegisterFunc(key string, fn interface{}) {
+45
View File
@@ -0,0 +1,45 @@
package convert
import "testing"
func TestExecute(t *testing.T) {
type args struct {
text string
data interface{}
}
tests := []struct {
name string
args args
want string
wantErr bool
}{
{
name: "{{repl",
args: args{
text: "{{repl printf \"%s\" \"hello\"}}",
data: nil,
},
want: "hello",
},
{
name: "repl{{",
args: args{
text: "repl{{ printf \"%s\" \"hello\"}}",
data: nil,
},
want: "hello",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := Execute(tt.args.text, tt.args.data)
if (err != nil) != tt.wantErr {
t.Errorf("Execute() error = %v, wantErr %v", err, tt.wantErr)
return
}
if got != tt.want {
t.Errorf("Execute() = %v, want %v", got, tt.want)
}
})
}
}
+54
View File
@@ -0,0 +1,54 @@
package interfaceutils
import (
"fmt"
"strconv"
"strings"
"github.com/pkg/errors"
)
func GetAtPath(input interface{}, path string) (interface{}, error) {
parts := strings.SplitN(path, ".", 2)
key := parts[0]
if isArrayIndex(key) {
i, err := getArrayIndexValue(key)
if err != nil {
return nil, errors.Wrapf(err, "failed to get index value of %s", key)
}
obj, ok := input.([]interface{})
if !ok {
return nil, errors.New(fmt.Sprintf("input is not an array: %+v", input))
}
input = obj[i]
} else {
switch t := input.(type) {
case map[interface{}]interface{}:
input = input.(map[interface{}]interface{})[key]
case map[string]interface{}:
input = input.(map[string]interface{})[key]
default:
return nil, errors.New(fmt.Sprintf("input is not a map, but rather a %v: %+v", t, input))
}
}
if len(parts) > 1 {
return GetAtPath(input, parts[1])
}
return input, nil
}
func isArrayIndex(key string) bool {
return strings.HasPrefix(key, "[") && strings.HasSuffix(key, "]")
}
func getArrayIndexValue(key string) (int, error) {
key = strings.TrimPrefix(key, "[")
key = strings.TrimSuffix(key, "]")
i, err := strconv.Atoi(key)
if err != nil {
return -1, errors.Wrapf(err, "failed to parse index %s", key)
}
return i, nil
}
+5
View File
@@ -0,0 +1,5 @@
package oci
func tryFindCreds(host string) (string, string, error) {
return "", "", nil
}
+122
View File
@@ -0,0 +1,122 @@
package oci
import (
"context"
"fmt"
"net/http"
"path/filepath"
"strings"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"github.com/replicatedhq/troubleshoot/cmd/util"
"github.com/replicatedhq/troubleshoot/pkg/version"
"oras.land/oras-go/pkg/auth"
dockerauth "oras.land/oras-go/pkg/auth/docker"
"oras.land/oras-go/pkg/content"
"oras.land/oras-go/pkg/oras"
"oras.land/oras-go/pkg/registry"
)
const (
HelmCredentialsFileBasename = ".config/helm/registry/config.json"
)
var (
ErrNoRelease = errors.New("no release found")
)
func PullPreflightFromOCI(uri string) ([]byte, error) {
return pullFromOCI(uri, "replicated.preflight.spec", "replicated-preflight")
}
func PullSupportBundleFromOCI(uri string) ([]byte, error) {
return pullFromOCI(uri, "replicated.supportbundle.spec", "replicated-supportbundle")
}
func pullFromOCI(uri string, mediaType string, imageName string) ([]byte, error) {
// helm credentials
helmCredentialsFile := filepath.Join(util.HomeDir(), HelmCredentialsFileBasename)
dockerauthClient, err := dockerauth.NewClientWithDockerFallback(helmCredentialsFile)
if err != nil {
return nil, errors.Wrap(err, "failed to create auth client")
}
authClient := dockerauthClient
headers := http.Header{}
headers.Set("User-Agent", version.GetUserAgent())
opts := []auth.ResolverOption{auth.WithResolverHeaders(headers)}
resolver, err := authClient.ResolverWithOpts(opts...)
if err != nil {
return nil, errors.Wrap(err, "failed to create resolver")
}
memoryStore := content.NewMemory()
allowedMediaTypes := []string{
mediaType,
}
var descriptors, layers []ocispec.Descriptor
registryStore := content.Registry{Resolver: resolver}
// remove the oci://
uri = strings.TrimPrefix(uri, "oci://")
uriParts := strings.Split(uri, ":")
uri = fmt.Sprintf("%s/%s", uriParts[0], imageName)
if len(uriParts) > 1 {
uri = fmt.Sprintf("%s:%s", uri, uriParts[1])
} else {
uri = fmt.Sprintf("%s:latest", uri)
}
parsedRef, err := registry.ParseReference(uri)
if err != nil {
return nil, errors.Wrap(err, "failed to parse reference")
}
manifest, err := oras.Copy(context.TODO(), registryStore, parsedRef.String(), memoryStore, "",
oras.WithPullEmptyNameAllowed(),
oras.WithAllowedMediaTypes(allowedMediaTypes),
oras.WithLayerDescriptors(func(l []ocispec.Descriptor) {
layers = l
}))
if err != nil {
if strings.Contains(err.Error(), "not found") {
return nil, ErrNoRelease
}
return nil, errors.Wrap(err, "failed to copy")
}
descriptors = append(descriptors, manifest)
descriptors = append(descriptors, layers...)
// expect 1 descriptor
if len(descriptors) != 2 {
return nil, fmt.Errorf("expected 2 descriptor, got %d", len(descriptors))
}
var matchingDescriptor *ocispec.Descriptor
for _, descriptor := range descriptors {
d := descriptor
switch d.MediaType {
case mediaType:
matchingDescriptor = &d
}
}
if matchingDescriptor == nil {
return nil, fmt.Errorf("no descriptor found with media type: %s", mediaType)
}
_, matchingSpec, ok := memoryStore.Get(*matchingDescriptor)
if !ok {
return nil, fmt.Errorf("failed to get matching descriptor")
}
return matchingSpec, nil
}
+2 -2
View File
@@ -16,12 +16,12 @@ func (c ClusterCollectResult) Analyze() []*analyze.AnalyzeResult {
return doAnalyze(c.AllCollectedData, c.Spec.Spec.Analyzers, nil, "")
}
// Analyze runs the analysze phase of host preflight checks
// Analyze runs the analyze phase of host preflight checks
func (c HostCollectResult) Analyze() []*analyze.AnalyzeResult {
return doAnalyze(c.AllCollectedData, nil, c.Spec.Spec.Analyzers, "")
}
// Analyze runs the analysze phase of host preflight checks.
// Analyze runs the analyze phase of host preflight checks.
//
// Runs the analysis for each node and aggregates the results.
func (c RemoteCollectResult) Analyze() []*analyze.AnalyzeResult {
+3
View File
@@ -64,6 +64,9 @@ func hasStrictAnalyzer(analyzerMap map[string]interface{}) (bool, error) {
if err != nil {
return false, errors.Wrap(err, "error while un-marshalling marshalledAnalyzers")
}
if analyzeMeta.Exclude.BoolOrDefaultFalse() {
continue
}
if analyzeMeta.Strict.BoolOrDefaultFalse() {
return true, nil
}

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