Compare commits

...
75 Commits
Author SHA1 Message Date
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
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
Ethan Mosbaugh c31b803092 Merge pull request #578 from replicatedhq/emosbaugh/sc-48809/analyze-api-fromanalyzerresult-invalid-memory
filter nil analyzer results to prevent panic
2022-05-23 14:35:39 -07:00
Ethan Mosbaugh 84b40804b5 filter nil analyzer results to prevent panic 2022-05-23 19:43:43 +00: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
Ethan Mosbaugh 249e52d3da Merge pull request #576 from replicatedhq/emosbaugh/fix-run-collector-text-analyze
Fix run collector text analyze file path mismatch
2022-05-17 12:09:36 -07:00
Ethan Mosbaugh 6b5b9297ba Use k3s rather than kind for tests 2022-05-17 18:03:04 +00:00
Ethan Mosbaugh 8c15bb1fae build-test-deploy concurrency 1 2022-05-17 17:20:45 +00:00
Ethan Mosbaugh d2d19a2490 Change build step name to test 2022-05-17 17:20:45 +00:00
Ethan Mosbaugh 5c269e2aaf E2E preflight tests 2022-05-17 17:20:45 +00:00
Ethan Mosbaugh 30fb4e2108 Fix run collector text analyze file path mismatch 2022-05-16 23:33:23 +00:00
Diamon Wiggins 24096b0272 Merge pull request #575 from replicatedhq/diamonwiggins/sc-40946/ceph-analyzer-health-status
Ceph health status messages in Analzyer result
2022-05-13 20:05:23 -04:00
diamonwiggins cccc9f23a1 adding new test case for ceph analyzers 2022-05-13 23:39:03 +00:00
diamonwiggins ff4353817f adding ceph health status messages to analyzer result 2022-05-13 22:27:19 +00:00
Diamon Wiggins c2136fcea0 Merge pull request #574 from replicatedhq/diamonwiggins/sc-46879/hostcollectors-supportbundles
Host Collectors in Support Bundles
2022-05-13 11:46:55 -04:00
Diamon Wiggins 9898d3fbb2 Merge branch 'main' into diamonwiggins/sc-46879/hostcollectors-supportbundles 2022-05-13 10:11:56 -04:00
diamonwiggins 5ec3524bde fixing host filesystem perf function for windows and darwin 2022-05-12 20:09:03 +00:00
diamonwiggins a471ad5e74 fixing filepath for kernel modules test 2022-05-12 19:49:04 +00:00
diamonwiggins 7b30e283ea fixing filepath for kernel modules test 2022-05-12 19:43:45 +00:00
diamonwiggins 8c62aadcfc using subdirectory for all host collectors in support bundle 2022-05-12 16:46:24 +00:00
diamonwiggins e7f2685ed8 fix output file for diskUsage collector 2022-05-12 04:20:24 +00:00
diamonwiggins 3b1ba08a6b hardcoding system hostcollector filenames 2022-05-12 03:39:19 +00:00
diamonwiggins 17fe3db79f adding host collectors to support bundles 2022-05-11 22:50:03 +00:00
Pavan Sokke Nagaraj 9ec9806b62 add cve scan github cron action (#572) 2022-05-10 13:52:30 -04:00
Pavan Sokke Nagaraj 061ce1d2eb Merge pull request #569 from replicatedhq/pa1/cves
fix go binaries cve
2022-05-10 12:14:55 -04:00
Pavan Sokke Nagaraj 0f56baf4dc fix cve and update uuid mod 2022-05-10 09:52:42 -04:00
Diamon Wiggins d6a17951d3 Merge pull request #564 from replicatedhq/diamonwiggins/sc-44286/run-pod-spec
RunPod Collector
2022-05-06 11:27:21 -04:00
Diamon Wiggins 9f527ee6a5 Merge branch 'main' into diamonwiggins/sc-44286/run-pod-spec 2022-05-06 11:08:15 -04:00
Ethan Mosbaugh 2c9a37a4f1 BoolOrString pollutes marshalling, does not respect omitempty (#566)
* BoolOrString pollutes marshalling, does not respect omitempty

* fix panic
2022-05-05 16:10:05 -07:00
Ethan Mosbaugh e6e9df1773 Merge pull request #565 from replicatedhq/mysql-collector-example
Mysql collector example
2022-05-04 11:14:25 -07:00
Ethan Mosbaugh 755220cd4c Mysql collector example 2022-05-04 17:45:10 +00:00
Edgar OchoaandEthan Mosbaugh 7289134757 Add Mysql variables to collector (#562)
* Add Mysql variables to collector

* Cleanup row scanning and a few updates based on feedback

* Close db connection

* Move defer db.close

* Updates based on feedback

* Use vars in loop instead of struct

* Only pull parameters specified in collector config

Co-authored-by: Ethan Mosbaugh <ethan@replicated.com>
2022-05-04 10:42:37 -07:00
Jalaja Ganapathy 63362d32ee Include osd disk usage (#563)
* Include osd disk usage

* add timeouts to ceph commands

* removed df, collect from host
2022-05-02 09:51:49 -07:00
diamonwiggins 6cdcb36127 change naming for runPod collector object 2022-05-02 03:12:07 +00:00
diamonwiggins dfe5538132 remove podLabels from run function 2022-05-02 02:53:29 +00:00
diamonwiggins 42902405cd adding new runpod collector and refactoring old run collector to use new code 2022-05-02 02:44:02 +00:00
diamonwiggins 2516924a92 moving imagepullsecret creation into non pod spec declaration 2022-04-19 20:41:28 +00:00
diamonwiggins ce4165f69e fixing typo 2022-04-19 20:29:28 +00:00
diamonwiggins 648f9b8d35 allow entire podspec to be passed in run collector 2022-04-19 16:25:59 +00:00
Ethan Mosbaugh aeb89e57a7 Merge pull request #556 from replicatedhq/emosbaugh/sc-45934/longhorn-logs-collector-all-files-are-empty
Fix missing longhorn logs
2022-04-01 15:21:56 -07:00
Ethan Mosbaugh 8d1a0f6d24 return ReadCloser 2022-04-01 14:22:44 -07:00
Ethan Mosbaugh 0cfd431274 Fix missing longhorn logs 2022-04-01 14:13:32 -07:00
Andrew Lavery fe5dd3ee8f Merge pull request #554 from replicatedhq/laverya/pods-with-notready-containers-are-unhealthy
pods with containers that are not 'ready' are unhealthy
2022-03-25 22:31:25 -04:00
Andrew Lavery 7eb1d5a5fb better parse namespaces, and parse legacy list-of-pods storage format 2022-03-25 22:13:52 -04:00
Andrew Lavery 40cdc6805e pods with containers that are not 'ready' are unhealthy 2022-03-25 21:36:22 -04:00
145 changed files with 2325 additions and 5851 deletions
+61 -17
View File
@@ -7,9 +7,13 @@ on:
- "main"
tags:
- "v*.*.*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
test:
runs-on: ubuntu-18.04
steps:
- uses: actions/setup-go@v1
@@ -24,11 +28,10 @@ jobs:
- uses: actions/checkout@v2
- run: make
- run: make test
compile-preflight:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/setup-go@v1
with:
@@ -39,22 +42,25 @@ jobs:
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- uses: actions/checkout@master
- run: make preflight
- run: make generate preflight
- uses: actions/upload-artifact@v1
with:
name: preflight
path: bin/preflight
validate-preflight:
runs-on: ubuntu-latest
needs: compile-preflight
steps:
- uses: replicatedhq/action-k3s@main
id: k3s
with:
version: v1.23.6-k3s1
- name: Download preflight binary
uses: actions/download-artifact@v1
with:
name: preflight
path: bin/
- uses: engineerd/setup-kind@v0.5.0
- run: chmod +x bin/preflight
- run: |
./bin/preflight --interactive=false --format=json https://preflight.replicated.com > result.json
@@ -83,9 +89,25 @@ jobs:
exit $EXIT_STATUS
validate-preflight-e2e:
runs-on: ubuntu-latest
needs: compile-preflight
steps:
- uses: actions/checkout@master
- uses: replicatedhq/action-k3s@main
id: k3s
with:
version: v1.23.6-k3s1
- name: Download preflight binary
uses: actions/download-artifact@v1
with:
name: preflight
path: bin/
- run: chmod +x bin/preflight
- run: make e2e-test
compile-supportbundle:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/setup-go@v1
with:
@@ -96,7 +118,7 @@ jobs:
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- uses: actions/checkout@master
- run: make support-bundle
- run: make generate support-bundle
- uses: actions/upload-artifact@v1
with:
name: support-bundle
@@ -107,27 +129,48 @@ jobs:
needs: compile-supportbundle
steps:
- uses: actions/checkout@v1
- uses: replicatedhq/action-k3s@main
id: k3s
with:
version: v1.23.6-k3s1
- name: Download support-bundle binary
uses: actions/download-artifact@v1
with:
name: support-bundle
path: bin/
- uses: engineerd/setup-kind@v0.5.0
- run: chmod +x bin/support-bundle
- run: ./bin/support-bundle ./examples/support-bundle/sample-collectors.yaml
- run: ./bin/support-bundle ./examples/support-bundle/sample-supportbundle.yaml
- run: ./bin/support-bundle https://kots.io
compile-collect:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.17'
- name: setup env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- uses: actions/checkout@master
- run: make generate collect
- uses: actions/upload-artifact@v1
with:
name: collect
path: bin/collect
goreleaser-test:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') != true
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- uses: actions/setup-go@v1
with:
go-version: "1.17"
@@ -142,12 +185,13 @@ jobs:
runs-on: ubuntu-latest
needs:
- validate-preflight
- validate-preflight-e2e
- validate-supportbundle
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: azure/docker-login@v1
with:
username: repldeploy2
@@ -155,7 +199,7 @@ jobs:
- name: Unshallow
run: git fetch --prune --unshallow
- uses: actions/setup-go@v1
with:
go-version: "1.17"
@@ -169,14 +213,14 @@ jobs:
echo $COSIGN_KEY | base64 -d > ./cosign.key
env:
COSIGN_KEY: ${{secrets.COSIGN_KEY}}
- name: Generate SBOM
run: |
make sbom
env:
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
COSIGN_KEY: ${{ secrets.COSIGN_KEY }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
+27
View File
@@ -0,0 +1,27 @@
name: Scan vulnerabilities
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
scan_troubleshoot_files_systems:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'HIGH,CRITICAL'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: 'trivy-results.sarif'
+39 -2
View File
@@ -6,6 +6,43 @@ 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. Kubernetes (we recommend https://k3d.io/. 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
### 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 topic branch from where you want to base your work (branched from main).
- 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.
+20 -6
View File
@@ -35,30 +35,34 @@ endef
BUILDFLAGS = -tags "netgo containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp" -installsuffix netgo
all: test
all: test support-bundle preflight collect
.PHONY: ffi
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: generate fmt vet
support-bundle:
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/support-bundle github.com/replicatedhq/troubleshoot/cmd/troubleshoot
.PHONY: preflight
preflight: generate fmt vet
preflight:
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/preflight github.com/replicatedhq/troubleshoot/cmd/preflight
.PHONY: analyze
analyze: generate fmt vet
analyze:
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/analyze github.com/replicatedhq/troubleshoot/cmd/analyze
.PHONY: collect
collect: generate fmt vet
collect:
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/collect github.com/replicatedhq/troubleshoot/cmd/collect
.PHONY: fmt
@@ -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 \
@@ -169,3 +174,12 @@ longhorn:
find pkg/longhorn -type f | xargs sed -i "s/github.com\/longhorn\/longhorn-manager\/types/github.com\/replicatedhq\/troubleshoot\/pkg\/longhorn\/types/g"
find pkg/longhorn -type f | xargs sed -i "s/github.com\/longhorn\/longhorn-manager\/util/github.com\/replicatedhq\/troubleshoot\/pkg\/longhorn\/util/g"
rm -rf longhorn-manager
.PHONY: scan
scan:
trivy fs \
--security-checks vuln \
--exit-code=1 \
--severity="HIGH,CRITICAL" \
--ignore-unfixed \
./
+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")
+98
View File
@@ -0,0 +1,98 @@
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: example
spec:
collectors:
- data:
name: config/replicas.txt
data: "5"
- run:
collectorName: "static-hi"
image: 'alpine:3.5'
command: ["echo", "hi static!"]
analyzers:
- clusterVersion:
outcomes:
- fail:
when: "< 1.13.0"
message: This application requires at least Kubernetes 1.13.0 or later, and recommends 1.15.0.
uri: https://www.kubernetes.io
- warn:
when: "< 1.15.0"
message: Your cluster meets the minimum version of Kubernetes, but we recommend you update to 1.15.0 or later.
uri: https://kubernetes.io
- pass:
when: ">= 1.15.0"
message: Your cluster meets the recommended and required versions of Kubernetes.
- distribution:
outcomes:
- pass:
when: "== k3s"
message: K3S is a supported distribution
- warn:
message: Unable to determine the distribution of Kubernetes
- textAnalyze:
checkName: Replica Count
fileName: config/replicas.txt
regexGroups: '(?P<Replicas>\d+)'
outcomes:
- fail:
when: "Replicas < 5"
message: That's not enough replicas!
- pass:
message: You have at least 5 replicas
- textAnalyze:
checkName: Said hi!
fileName: /static-hi.log
regex: 'hi static'
outcomes:
- fail:
message: Didn't say hi.
- pass:
message: Said hi!
- nodeResources:
checkName: Must be exactly 1 node in the cluster
outcomes:
- pass:
when: "= 1"
message: This cluster has exactly 1 node
- fail:
message: This application requires exactly 1 node
- nodeResources:
checkName: Must have 1 node with at least 2 cores
filters:
cpuCapacity: "2"
outcomes:
- pass:
when: "= 1"
message: This cluster has exactly 1 node with at least 2 cores
- fail:
message: This application requires exactly 1 node with at least 2 cores
- nodeResources:
checkName: Must have 1 node with 2Gi (available) memory and at least 2 cores (on a single node)
filters:
allocatableMemory: 2Gi
cpuCapacity: "2"
outcomes:
- pass:
when: "= 1"
message: This cluster has exactly 1 node with at least 2Gi available memory and 2 cores
- fail:
message: This application requires exactly 1 node with at least 2Gi available memory and 2 cores
- nodeResources:
checkName: There must be exactly 1 node in the cluster
outcomes:
- pass:
when: "count() = 1"
message: This has exactly 1 node in the cluster
- fail:
message: This application requires exactly 1 node in the cluster
- nodeResources:
checkName: There must be a total of at least 2Gi of memory on all nodes
outcomes:
- fail:
when: "sum(memoryCapacity) < 2Gi"
message: This application requires that 2Gi or more memory be available to the cluster
- pass:
message: This cluster has sufficient memory
@@ -0,0 +1,17 @@
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: mysql
spec:
collectors:
- mysql:
collectorName: mysql
uri: 'root:my-secret-pw@tcp(localhost:3306)/mysql'
parameters:
- character_set_server
- collation_server
- init_connect
- innodb_file_format
- innodb_large_prefix
- innodb_strict_mode
- log_bin_trust_function_creators
@@ -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
}
+71 -57
View File
@@ -5,14 +5,15 @@ go 1.17
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.17.0
github.com/docker/distribution v2.7.1+incompatible
github.com/containers/image/v5 v5.19.3
github.com/docker/distribution v2.8.1+incompatible
github.com/fatih/color v1.13.0
github.com/go-redis/redis/v7 v7.4.1
github.com/go-sql-driver/mysql v1.6.0
github.com/gobwas/glob v0.2.3
github.com/godbus/dbus v4.1.0+incompatible
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-multierror v1.1.1
@@ -23,62 +24,66 @@ require (
github.com/mholt/archiver v3.1.1+incompatible
github.com/pkg/errors v0.9.1
github.com/replicatedhq/termui/v3 v3.1.1-0.20200811145416-f40076d26851
github.com/satori/go.uuid v1.2.0
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.2.1
github.com/spf13/cobra v1.4.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.9.0
github.com/stretchr/testify v1.7.0
github.com/spf13/viper v1.10.0
github.com/stretchr/testify v1.7.1
github.com/tj/go-spin v1.1.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
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
k8s.io/api v0.24.0
k8s.io/apiextensions-apiserver v0.24.0
k8s.io/apimachinery v0.24.0
k8s.io/apiserver v0.24.0
k8s.io/cli-runtime v0.24.0
k8s.io/client-go v0.24.0
periph.io/x/periph v3.6.8+incompatible
sigs.k8s.io/controller-runtime v0.11.0
)
require (
cloud.google.com/go v0.93.3 // indirect
cloud.google.com/go v0.99.0 // indirect
cloud.google.com/go/storage v1.10.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.20 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.15 // 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 v0.4.1 // indirect
github.com/Microsoft/go-winio v0.5.0 // indirect
github.com/Microsoft/hcsshim v0.8.22 // indirect
github.com/BurntSushi/toml v1.0.0 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/Microsoft/hcsshim v0.9.2 // 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/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.1 // 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.7 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.9.0 // indirect
github.com/containerd/cgroups v1.0.3 // indirect
github.com/containerd/containerd v1.6.3 // 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.2 // indirect
github.com/containers/storage v1.37.0 // 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.11+incompatible // indirect
github.com/docker/cli v20.10.11+incompatible // indirect
github.com/docker/docker v20.10.14+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/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
@@ -86,25 +91,26 @@ require (
github.com/fsnotify/fsnotify v1.5.1 // 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-logr/logr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.0.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/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/go-intervals v0.0.2 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gax-go/v2 v2.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.1.1 // indirect
github.com/googleapis/gnostic v0.5.5 // 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
@@ -114,46 +120,51 @@ require (
github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.13.6 // 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/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mattn/go-shellwords v1.0.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // indirect
github.com/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.2 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/sys/mountinfo v0.4.1 // 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.2-0.20210819154149-5ad6f50d6283 // indirect
github.com/opencontainers/runc v1.0.2 // indirect
github.com/opencontainers/image-spec v1.0.3-0.20211202193544-a5463b7f9c84 // indirect
github.com/opencontainers/runc v1.1.1 // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
github.com/opencontainers/selinux v1.9.1 // indirect
github.com/opencontainers/selinux v1.10.0 // indirect
github.com/ostreedev/ostree-go v0.0.0-20190702140239-759a8c1ac913 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // 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/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.2.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
github.com/tklauser/go-sysconf v0.3.9 // indirect
@@ -165,28 +176,31 @@ 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-20210817164053-32db794688a5 // indirect
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8 // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // 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
google.golang.org/api v0.56.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/api v0.62.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e // indirect
google.golang.org/grpc v1.41.0 // indirect
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
google.golang.org/grpc v1.43.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.63.2 // 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
helm.sh/helm/v3 v3.9.0 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
oras.land/oras-go v1.1.1 // indirect
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
)
+379 -56
View File
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -28,7 +28,11 @@ type AnalyzeResult struct {
type getCollectedFileContents func(string) ([]byte, error)
type getChildCollectedFileContents func(string) (map[string][]byte, error)
func isExcluded(excludeVal multitype.BoolOrString) (bool, error) {
func isExcluded(excludeVal *multitype.BoolOrString) (bool, error) {
if excludeVal == nil {
return false, nil
}
if excludeVal.Type == multitype.Bool {
return excludeVal.BoolVal, nil
}
+33 -7
View File
@@ -74,7 +74,17 @@ type CephStatus struct {
}
type HealthStatus struct {
Status string `json:"status"`
Status string `json:"status"`
Checks map[string]CheckMessage `json:"checks"`
}
type CheckMessage struct {
Severity string `json:"severity"`
Summary Summary `json:"summary"`
}
type Summary struct {
Message string `json:"message"`
}
type OsdMap struct {
@@ -121,6 +131,7 @@ func cephStatus(analyzer *troubleshootv1beta2.CephStatusAnalyze, getCollectedFil
if outcome.Fail.When == "" {
outcome.Fail.When = string(CephHealthErr)
}
match, err := compareCephStatus(status.Health.Status, outcome.Fail.When)
if err != nil {
return nil, errors.Wrap(err, "failed to compare ceph status")
@@ -134,6 +145,7 @@ func cephStatus(analyzer *troubleshootv1beta2.CephStatusAnalyze, getCollectedFil
if outcome.Warn.When == "" {
outcome.Warn.When = string(CephHealthWarn)
}
match, err := compareCephStatus(status.Health.Status, outcome.Warn.When)
if err != nil {
return nil, errors.Wrap(err, "failed to compare ceph status")
@@ -147,6 +159,7 @@ func cephStatus(analyzer *troubleshootv1beta2.CephStatusAnalyze, getCollectedFil
if outcome.Pass.When == "" {
outcome.Pass.When = string(CephHealthOK)
}
match, err := compareCephStatus(status.Health.Status, outcome.Pass.When)
if err != nil {
return nil, errors.Wrap(err, "failed to compare ceph status")
@@ -154,6 +167,7 @@ func cephStatus(analyzer *troubleshootv1beta2.CephStatusAnalyze, getCollectedFil
analyzeResult.IsPass = true
analyzeResult.Message = outcome.Pass.Message
analyzeResult.URI = outcome.Pass.URI
return analyzeResult, nil
}
}
@@ -195,21 +209,33 @@ func compareCephStatus(actual, when string) (bool, error) {
}
}
func detailedCephMessage(msg string, status CephStatus) string {
func detailedCephMessage(outcomeMessage string, status CephStatus) string {
var msg = []string{}
if outcomeMessage != "" {
msg = append(msg, outcomeMessage)
}
if status.OsdMap.OsdMap.NumOsd > 0 {
msg = fmt.Sprintf("%s. %v/%v OSDs up", msg, status.OsdMap.OsdMap.NumUpOsd, status.OsdMap.OsdMap.NumOsd)
msg = append(msg, fmt.Sprintf("%v/%v OSDs up", status.OsdMap.OsdMap.NumUpOsd, status.OsdMap.OsdMap.NumOsd))
}
if status.OsdMap.OsdMap.Full {
msg = fmt.Sprintf("%s. OSD disk is full", msg)
msg = append(msg, fmt.Sprintf("OSD disk is full"))
} else if status.OsdMap.OsdMap.NearFull {
msg = fmt.Sprintf("%s. OSD disk is nearly full", msg)
msg = append(msg, fmt.Sprintf("OSD disk is nearly full"))
}
if status.PgMap.TotalBytes > 0 {
pgUsage := 100 * float64(status.PgMap.UsedBytes) / float64(status.PgMap.TotalBytes)
msg = fmt.Sprintf("%s. PG storage usage is %.1f%%.", msg, pgUsage)
msg = append(msg, fmt.Sprintf("PG storage usage is %.1f%%", pgUsage))
}
return msg
if status.Health.Checks != nil {
for k, v := range status.Health.Checks {
msg = append(msg, fmt.Sprintf("%s: %s", k, v.Summary.Message))
}
}
return strings.Join(msg, "\n")
}
+40 -3
View File
@@ -56,7 +56,7 @@ func Test_cephStatus(t *testing.T) {
IsWarn: true,
IsFail: false,
Title: "Ceph Status",
Message: "Ceph status is HEALTH_WARN. 5/5 OSDs up. OSD disk is nearly full. PG storage usage is 85.0%.",
Message: "Ceph status is HEALTH_WARN\n5/5 OSDs up\nOSD disk is nearly full\nPG storage usage is 85.0%",
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",
@@ -89,7 +89,7 @@ func Test_cephStatus(t *testing.T) {
IsWarn: false,
IsFail: true,
Title: "Ceph Status",
Message: "Ceph status is HEALTH_ERR. 4/5 OSDs up. OSD disk is full. PG storage usage is 95.0%.",
Message: "Ceph status is HEALTH_ERR\n4/5 OSDs up\nOSD disk is full\nPG storage usage is 95.0%",
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",
@@ -172,7 +172,7 @@ func Test_cephStatus(t *testing.T) {
IsWarn: false,
IsFail: true,
Title: "Ceph Status",
Message: "custom message WARN. 5/5 OSDs up. OSD disk is nearly full. PG storage usage is 85.0%.",
Message: "custom message WARN\n5/5 OSDs up\nOSD disk is nearly full\nPG storage usage is 85.0%",
URI: "custom uri WARN",
IconKey: "rook",
IconURI: "https://troubleshoot.sh/images/analyzer-icons/rook.svg?w=11&h=16",
@@ -218,6 +218,43 @@ func Test_cephStatus(t *testing.T) {
}
}`,
},
{
name: "warn case with multiple health status messages",
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",
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",
},
filePath: "ceph/status.json",
file: `{
"fsid": "96a8178c-6aa2-4adf-a309-9e8869a79611",
"health": {
"status": "HEALTH_WARN",
"checks": {
"POOL_NO_REDUNDANCY": {
"severity": "HEALTH_WARN",
"summary": {
"message": "11 pool(s) have no replicas configured",
"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"
}
}
}
}
}`,
},
}
for _, test := range tests {
+8 -3
View File
@@ -22,7 +22,7 @@ func clusterPodStatuses(analyzer *troubleshootv1beta2.ClusterPodStatuses, getChi
var pods []corev1.Pod
for fileName, fileContent := range collected {
podsNs := strings.TrimSuffix(fileName, ".json")
podsNs := strings.TrimSuffix(filepath.Base(fileName), ".json")
include := len(analyzer.Namespaces) == 0
for _, ns := range analyzer.Namespaces {
if ns == podsNs {
@@ -33,9 +33,14 @@ func clusterPodStatuses(analyzer *troubleshootv1beta2.ClusterPodStatuses, getChi
if include {
var nsPods corev1.PodList
if err := json.Unmarshal(fileContent, &nsPods); err != nil {
return nil, errors.Wrapf(err, "failed to unmarshal pods list for namespace %s", podsNs)
var nsPodsArr []corev1.Pod
if err := json.Unmarshal(fileContent, &nsPodsArr); err != nil {
return nil, errors.Wrapf(err, "failed to unmarshal pods list for namespace %s", podsNs)
}
pods = append(pods, nsPodsArr...)
} else {
pods = append(pods, nsPods.Items...)
}
pods = append(pods, nsPods.Items...)
}
}
+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"
+5 -2
View File
@@ -38,8 +38,11 @@ func AnalyzeLocal(localBundlePath string, analyzers []*troubleshootv1beta2.Analy
continue
}
if analyzeResult != nil {
analyzeResults = append(analyzeResults, analyzeResult...)
// Filter nil results to prevent panic
for _, r := range analyzeResult {
if r != nil {
analyzeResults = append(analyzeResults, r)
}
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ func (a *AnalyzeHostBlockDevices) IsExcluded() (bool, error) {
func (a *AnalyzeHostBlockDevices) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error) {
hostAnalyzer := a.hostAnalyzer
contents, err := getCollectedFileContents("system/block_devices.json")
contents, err := getCollectedFileContents(collect.HostBlockDevicesPath)
if err != nil {
return nil, errors.Wrap(err, "failed to get collected file")
}
+1 -1
View File
@@ -26,7 +26,7 @@ func (a *AnalyzeHostCertificate) Analyze(getCollectedFileContents func(string) (
if collectorName == "" {
collectorName = "certificate"
}
name := filepath.Join("certificate", collectorName+".json")
name := filepath.Join("host-collectors/certificate", collectorName+".json")
contents, err := getCollectedFileContents(name)
if err != nil {
return nil, errors.Wrap(err, "failed to get collected file")
+1 -1
View File
@@ -25,7 +25,7 @@ func (a *AnalyzeHostCPU) IsExcluded() (bool, error) {
func (a *AnalyzeHostCPU) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error) {
hostAnalyzer := a.hostAnalyzer
contents, err := getCollectedFileContents("system/cpu.json")
contents, err := getCollectedFileContents(collect.HostCPUPath)
if err != nil {
return nil, errors.Wrap(err, "failed to get collected file")
}
+8 -4
View File
@@ -3,6 +3,7 @@ package analyzer
import (
"encoding/json"
"fmt"
"path/filepath"
"strconv"
"strings"
@@ -27,15 +28,18 @@ func (a *AnalyzeHostDiskUsage) IsExcluded() (bool, error) {
func (a *AnalyzeHostDiskUsage) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error) {
hostAnalyzer := a.hostAnalyzer
key := collect.HostDiskUsageKey(hostAnalyzer.CollectorName)
contents, err := getCollectedFileContents(key)
name := filepath.Join("host-collectors/diskUsage", "diskUsage.json")
if hostAnalyzer.CollectorName != "" {
name = filepath.Join("host-collectors/diskUsage", hostAnalyzer.CollectorName+".json")
}
contents, err := getCollectedFileContents(name)
if err != nil {
return nil, errors.Wrapf(err, "failed to get collected file %s", key)
return nil, errors.Wrapf(err, "failed to get collected file %s", name)
}
diskUsageInfo := collect.DiskUsageInfo{}
if err := json.Unmarshal(contents, &diskUsageInfo); err != nil {
return nil, errors.Wrapf(err, "failed to unmarshal disk usage info from %s", key)
return nil, errors.Wrapf(err, "failed to unmarshal disk usage info from %s", name)
}
result := AnalyzeResult{
+1 -1
View File
@@ -34,7 +34,7 @@ func (a *AnalyzeHostFilesystemPerformance) Analyze(getCollectedFileContents func
if collectorName == "" {
collectorName = "filesystemPerformance"
}
name := filepath.Join("filesystemPerformance", collectorName+".json")
name := filepath.Join("host-collectors/filesystemPerformance", collectorName+".json")
contents, err := getCollectedFileContents(name)
if err != nil {
return nil, errors.Wrapf(err, "failed to get collected file %s", name)
+2 -2
View File
@@ -32,9 +32,9 @@ func (a *AnalyzeHostHTTP) IsExcluded() (bool, error) {
func (a *AnalyzeHostHTTP) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error) {
hostAnalyzer := a.hostAnalyzer
name := filepath.Join("http", "result.json")
name := filepath.Join("host-collectors/http", "result.json")
if hostAnalyzer.CollectorName != "" {
name = filepath.Join("http", hostAnalyzer.CollectorName+".json")
name = filepath.Join("host-collectors/http", hostAnalyzer.CollectorName+".json")
}
contents, err := getCollectedFileContents(name)
if err != nil {
+1 -1
View File
@@ -29,7 +29,7 @@ func (a *AnalyzeHostHTTPLoadBalancer) Analyze(getCollectedFileContents func(stri
if collectorName == "" {
collectorName = "httpLoadBalancer"
}
fullPath := path.Join("httpLoadBalancer", fmt.Sprintf("%s.json", collectorName))
fullPath := path.Join("host-collectors/httpLoadBalancer", fmt.Sprintf("%s.json", collectorName))
collected, err := getCollectedFileContents(fullPath)
if err != nil {
+2 -1
View File
@@ -9,6 +9,7 @@ import (
"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/replicatedhq/troubleshoot/pkg/collect"
)
type AnalyzeHostIPV4Interfaces struct {
@@ -26,7 +27,7 @@ func (a *AnalyzeHostIPV4Interfaces) IsExcluded() (bool, error) {
func (a *AnalyzeHostIPV4Interfaces) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error) {
hostAnalyzer := a.hostAnalyzer
contents, err := getCollectedFileContents("system/ipv4Interfaces.json")
contents, err := getCollectedFileContents(collect.HostIPV4InterfacesPath)
if err != nil {
return nil, errors.Wrap(err, "failed to get collected file")
}
+1 -1
View File
@@ -43,7 +43,7 @@ func (a *AnalyzeHostKernelModules) IsExcluded() (bool, error) {
//
func (a *AnalyzeHostKernelModules) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error) {
hostAnalyzer := a.hostAnalyzer
contents, err := getCollectedFileContents("system/kernel_modules.json")
contents, err := getCollectedFileContents(collect.HostKernelModulesPath)
if err != nil {
return nil, errors.Wrap(err, "failed to get collected file")
}
+1 -1
View File
@@ -26,7 +26,7 @@ func (a *AnalyzeHostMemory) IsExcluded() (bool, error) {
func (a *AnalyzeHostMemory) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error) {
hostAnalyzer := a.hostAnalyzer
contents, err := getCollectedFileContents("system/memory.json")
contents, err := getCollectedFileContents(collect.HostMemoryPath)
if err != nil {
return nil, errors.Wrap(err, "failed to get collected file")
}
+1 -1
View File
@@ -29,7 +29,7 @@ func (a *AnalyzeHostOS) Analyze(getCollectedFileContents func(string) ([]byte, e
result := AnalyzeResult{}
result.Title = a.Title()
contents, err := getCollectedFileContents("system/hostos_info.json")
contents, err := getCollectedFileContents(collect.HostOSInfoPath)
if err != nil {
return []*AnalyzeResult{&result}, errors.Wrap(err, "failed to get collected file")
}
+2 -2
View File
@@ -31,9 +31,9 @@ func (a *AnalyzeHostSystemPackages) IsExcluded() (bool, error) {
func (a *AnalyzeHostSystemPackages) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error) {
hostAnalyzer := a.hostAnalyzer
packagesFileName := "system/packages.json"
packagesFileName := "host-collectors/system/packages.json"
if a.hostAnalyzer.CollectorName != "" {
packagesFileName = fmt.Sprintf("system/%s-packages.json", a.hostAnalyzer.CollectorName)
packagesFileName = fmt.Sprintf("host-collectors/system/%s-packages.json", a.hostAnalyzer.CollectorName)
}
contents, err := getCollectedFileContents(packagesFileName)
+6 -3
View File
@@ -2,8 +2,7 @@ package analyzer
import (
"encoding/json"
"fmt"
"path"
"path/filepath"
"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
@@ -25,7 +24,11 @@ func (a *AnalyzeHostTCPConnect) IsExcluded() (bool, error) {
func (a *AnalyzeHostTCPConnect) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error) {
hostAnalyzer := a.hostAnalyzer
fullPath := path.Join("connect", fmt.Sprintf("%s.json", hostAnalyzer.CollectorName))
collectorName := hostAnalyzer.CollectorName
if collectorName == "" {
collectorName = "connect"
}
fullPath := filepath.Join("host-collectors/connect", collectorName+".json")
collected, err := getCollectedFileContents(fullPath)
if err != nil {
+1 -1
View File
@@ -30,7 +30,7 @@ func (a *AnalyzeHostTCPLoadBalancer) Analyze(getCollectedFileContents func(strin
collectorName = "tcpLoadBalancer"
}
fullPath := path.Join("tcpLoadBalancer", fmt.Sprintf("%s.json", collectorName))
fullPath := path.Join("host-collectors/tcpLoadBalancer", fmt.Sprintf("%s.json", collectorName))
collected, err := getCollectedFileContents(fullPath)
if err != nil {
+2 -2
View File
@@ -27,9 +27,9 @@ func (a *AnalyzeHostTCPPortStatus) IsExcluded() (bool, error) {
func (a *AnalyzeHostTCPPortStatus) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error) {
hostAnalyzer := a.hostAnalyzer
fullPath := path.Join("tcpPortStatus", "tcpPortStatus.json")
fullPath := path.Join("host-collectors/tcpPortStatus", "tcpPortStatus.json")
if hostAnalyzer.CollectorName != "" {
fullPath = path.Join("tcpPortStatus", fmt.Sprintf("%s.json", hostAnalyzer.CollectorName))
fullPath = path.Join("host-collectors/tcpPortStatus", fmt.Sprintf("%s.json", hostAnalyzer.CollectorName))
}
collected, err := getCollectedFileContents(fullPath)
+1 -1
View File
@@ -32,7 +32,7 @@ func (a *AnalyzeHostTime) IsExcluded() (bool, error) {
func (a *AnalyzeHostTime) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error) {
hostAnalyzer := a.hostAnalyzer
contents, err := getCollectedFileContents("system/time.json")
contents, err := getCollectedFileContents(collect.HostTimePath)
if err != nil {
return nil, errors.Wrap(err, "failed to get collected file")
}
+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 {
@@ -116,8 +116,8 @@ type DatabaseAnalyze struct {
}
type AnalyzeMeta struct {
CheckName string `json:"checkName,omitempty" yaml:"checkName,omitempty"`
Exclude multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
CheckName string `json:"checkName,omitempty" yaml:"checkName,omitempty"`
Exclude *multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
}
type Analyze struct {
@@ -11,7 +11,7 @@ import (
type CollectorMeta struct {
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
// +optional
Exclude multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
Exclude *multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
}
type ClusterInfo struct {
@@ -22,6 +22,7 @@ limitations under the License.
package v1beta1
import (
"github.com/replicatedhq/troubleshoot/pkg/multitype"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@@ -143,7 +144,11 @@ func (in *Analyze) DeepCopy() *Analyze {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AnalyzeMeta) DeepCopyInto(out *AnalyzeMeta) {
*out = *in
out.Exclude = in.Exclude
if in.Exclude != nil {
in, out := &in.Exclude, &out.Exclude
*out = new(multitype.BoolOrString)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalyzeMeta.
@@ -159,7 +164,7 @@ func (in *AnalyzeMeta) DeepCopy() *AnalyzeMeta {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AnalyzeSecret) DeepCopyInto(out *AnalyzeSecret) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -286,7 +291,7 @@ func (in *AnalyzerStatus) DeepCopy() *AnalyzerStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterInfo) DeepCopyInto(out *ClusterInfo) {
*out = *in
out.CollectorMeta = in.CollectorMeta
in.CollectorMeta.DeepCopyInto(&out.CollectorMeta)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterInfo.
@@ -302,7 +307,7 @@ func (in *ClusterInfo) DeepCopy() *ClusterInfo {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterResources) DeepCopyInto(out *ClusterResources) {
*out = *in
out.CollectorMeta = in.CollectorMeta
in.CollectorMeta.DeepCopyInto(&out.CollectorMeta)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResources.
@@ -318,7 +323,7 @@ func (in *ClusterResources) DeepCopy() *ClusterResources {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterVersion) DeepCopyInto(out *ClusterVersion) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -348,17 +353,17 @@ func (in *Collect) DeepCopyInto(out *Collect) {
if in.ClusterInfo != nil {
in, out := &in.ClusterInfo, &out.ClusterInfo
*out = new(ClusterInfo)
**out = **in
(*in).DeepCopyInto(*out)
}
if in.ClusterResources != nil {
in, out := &in.ClusterResources, &out.ClusterResources
*out = new(ClusterResources)
**out = **in
(*in).DeepCopyInto(*out)
}
if in.Secret != nil {
in, out := &in.Secret, &out.Secret
*out = new(Secret)
**out = **in
(*in).DeepCopyInto(*out)
}
if in.Logs != nil {
in, out := &in.Logs, &out.Logs
@@ -378,7 +383,7 @@ func (in *Collect) DeepCopyInto(out *Collect) {
if in.Data != nil {
in, out := &in.Data, &out.Data
*out = new(Data)
**out = **in
(*in).DeepCopyInto(*out)
}
if in.Copy != nil {
in, out := &in.Copy, &out.Copy
@@ -393,17 +398,17 @@ func (in *Collect) DeepCopyInto(out *Collect) {
if in.Postgres != nil {
in, out := &in.Postgres, &out.Postgres
*out = new(Database)
**out = **in
(*in).DeepCopyInto(*out)
}
if in.Mysql != nil {
in, out := &in.Mysql, &out.Mysql
*out = new(Database)
**out = **in
(*in).DeepCopyInto(*out)
}
if in.Redis != nil {
in, out := &in.Redis, &out.Redis
*out = new(Database)
**out = **in
(*in).DeepCopyInto(*out)
}
}
@@ -479,7 +484,11 @@ func (in *CollectorList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CollectorMeta) DeepCopyInto(out *CollectorMeta) {
*out = *in
out.Exclude = in.Exclude
if in.Exclude != nil {
in, out := &in.Exclude, &out.Exclude
*out = new(multitype.BoolOrString)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectorMeta.
@@ -547,7 +556,7 @@ func (in *CollectorStatus) DeepCopy() *CollectorStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerRuntime) DeepCopyInto(out *ContainerRuntime) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -574,7 +583,7 @@ func (in *ContainerRuntime) DeepCopy() *ContainerRuntime {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Copy) DeepCopyInto(out *Copy) {
*out = *in
out.CollectorMeta = in.CollectorMeta
in.CollectorMeta.DeepCopyInto(&out.CollectorMeta)
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = make([]string, len(*in))
@@ -595,7 +604,7 @@ func (in *Copy) DeepCopy() *Copy {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CustomResourceDefinition) DeepCopyInto(out *CustomResourceDefinition) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -622,7 +631,7 @@ func (in *CustomResourceDefinition) DeepCopy() *CustomResourceDefinition {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Data) DeepCopyInto(out *Data) {
*out = *in
out.CollectorMeta = in.CollectorMeta
in.CollectorMeta.DeepCopyInto(&out.CollectorMeta)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Data.
@@ -638,7 +647,7 @@ func (in *Data) DeepCopy() *Data {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Database) DeepCopyInto(out *Database) {
*out = *in
out.CollectorMeta = in.CollectorMeta
in.CollectorMeta.DeepCopyInto(&out.CollectorMeta)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Database.
@@ -654,7 +663,7 @@ func (in *Database) DeepCopy() *Database {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DatabaseAnalyze) DeepCopyInto(out *DatabaseAnalyze) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -681,7 +690,7 @@ func (in *DatabaseAnalyze) DeepCopy() *DatabaseAnalyze {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeploymentStatus) DeepCopyInto(out *DeploymentStatus) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -708,7 +717,7 @@ func (in *DeploymentStatus) DeepCopy() *DeploymentStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Distribution) DeepCopyInto(out *Distribution) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -735,7 +744,7 @@ func (in *Distribution) DeepCopy() *Distribution {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Exec) DeepCopyInto(out *Exec) {
*out = *in
out.CollectorMeta = in.CollectorMeta
in.CollectorMeta.DeepCopyInto(&out.CollectorMeta)
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = make([]string, len(*in))
@@ -808,7 +817,7 @@ func (in *Get) DeepCopy() *Get {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HTTP) DeepCopyInto(out *HTTP) {
*out = *in
out.CollectorMeta = in.CollectorMeta
in.CollectorMeta.DeepCopyInto(&out.CollectorMeta)
if in.Get != nil {
in, out := &in.Get, &out.Get
*out = new(Get)
@@ -839,7 +848,7 @@ func (in *HTTP) DeepCopy() *HTTP {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImagePullSecret) DeepCopyInto(out *ImagePullSecret) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -888,7 +897,7 @@ func (in *ImagePullSecrets) DeepCopy() *ImagePullSecrets {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Ingress) DeepCopyInto(out *Ingress) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -930,7 +939,7 @@ func (in *LogLimits) DeepCopy() *LogLimits {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Logs) DeepCopyInto(out *Logs) {
*out = *in
out.CollectorMeta = in.CollectorMeta
in.CollectorMeta.DeepCopyInto(&out.CollectorMeta)
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = make([]string, len(*in))
@@ -1003,7 +1012,7 @@ func (in *NodeResourceSelectors) DeepCopy() *NodeResourceSelectors {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeResources) DeepCopyInto(out *NodeResources) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -1397,7 +1406,7 @@ func (in *ResultRequest) DeepCopy() *ResultRequest {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Run) DeepCopyInto(out *Run) {
*out = *in
out.CollectorMeta = in.CollectorMeta
in.CollectorMeta.DeepCopyInto(&out.CollectorMeta)
if in.Command != nil {
in, out := &in.Command, &out.Command
*out = make([]string, len(*in))
@@ -1428,7 +1437,7 @@ func (in *Run) DeepCopy() *Run {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Secret) DeepCopyInto(out *Secret) {
*out = *in
out.CollectorMeta = in.CollectorMeta
in.CollectorMeta.DeepCopyInto(&out.CollectorMeta)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Secret.
@@ -1459,7 +1468,7 @@ func (in *SingleOutcome) DeepCopy() *SingleOutcome {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *StatefulsetStatus) DeepCopyInto(out *StatefulsetStatus) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -1486,7 +1495,7 @@ func (in *StatefulsetStatus) DeepCopy() *StatefulsetStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *StorageClass) DeepCopyInto(out *StorageClass) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -1666,7 +1675,7 @@ func (in *SupportBundleVersionSpec) DeepCopy() *SupportBundleVersionSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TextAnalyze) DeepCopyInto(out *TextAnalyze) {
*out = *in
out.AnalyzeMeta = in.AnalyzeMeta
in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta)
if in.Outcomes != nil {
in, out := &in.Outcomes, &out.Outcomes
*out = make([]*Outcome, len(*in))
@@ -175,9 +175,9 @@ 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"`
}
type Analyze struct {
@@ -6,13 +6,14 @@ import (
"github.com/replicatedhq/troubleshoot/pkg/multitype"
authorizationv1 "k8s.io/api/authorization/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type CollectorMeta struct {
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
// +optional
Exclude multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
Exclude *multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
}
type ClusterInfo struct {
@@ -77,6 +78,15 @@ type Run struct {
ServiceAccountName string `json:"serviceAccountName,omitempty" yaml:"serviceAccountName,omitempty"`
}
type RunPod struct {
CollectorMeta `json:",inline" yaml:",inline"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Namespace string `json:"namespace" yaml:"namespace"`
Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
ImagePullSecret *ImagePullSecrets `json:"imagePullSecret,omitempty" yaml:"imagePullSecret,omitempty"`
PodSpec corev1.PodSpec `json:"podSpec,omitempty" yaml:"podSpec,omitempty"`
}
type ImagePullSecrets struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Data map[string]string `json:"data,omitempty" yaml:"data,omitempty"`
@@ -156,7 +166,8 @@ type Put struct {
type Database struct {
CollectorMeta `json:",inline" yaml:",inline"`
URI string `json:"uri" yaml:"uri"`
URI string `json:"uri" yaml:"uri"`
Parameters []string `json:"parameters,omitempty"`
}
type Collectd struct {
@@ -195,6 +206,7 @@ type Collect struct {
ConfigMap *ConfigMap `json:"configMap,omitempty" yaml:"configMap,omitempty"`
Logs *Logs `json:"logs,omitempty" yaml:"logs,omitempty"`
Run *Run `json:"run,omitempty" yaml:"run,omitempty"`
RunPod *RunPod `json:"runPod,omitempty" yaml:"runPod,omitempty"`
Exec *Exec `json:"exec,omitempty" yaml:"exec,omitempty"`
Data *Data `json:"data,omitempty" yaml:"data,omitempty"`
Copy *Copy `json:"copy,omitempty" yaml:"copy,omitempty"`
@@ -328,6 +340,19 @@ func (c *Collect) AccessReviewSpecs(overrideNS string) []authorizationv1.SelfSub
},
NonResourceAttributes: nil,
})
} else if c.RunPod != nil {
result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{
ResourceAttributes: &authorizationv1.ResourceAttributes{
Namespace: pickNamespaceOrDefault(c.RunPod.Namespace, overrideNS),
Verb: "create",
Group: "",
Version: "",
Resource: "pods",
Subresource: "",
Name: "",
},
NonResourceAttributes: nil,
})
} else if c.Exec != nil {
result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{
ResourceAttributes: &authorizationv1.ResourceAttributes{
@@ -433,6 +458,10 @@ func (c *Collect) GetName() string {
collector = "run"
name = c.Run.CollectorName
}
if c.RunPod != nil {
collector = "run-pod"
name = c.RunPod.CollectorName
}
if c.Exec != nil {
collector = "exec"
name = c.Exec.CollectorName
@@ -1,13 +1,15 @@
package v1beta2
type CPUAnalyze struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
AnalyzeMeta `json:",inline" yaml:",inline"`
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
}
type MemoryAnalyze struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
AnalyzeMeta `json:",inline" yaml:",inline"`
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
}
type TCPLoadBalancerAnalyze struct {
@@ -41,12 +43,14 @@ type HTTPAnalyze struct {
}
type TimeAnalyze struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
AnalyzeMeta `json:",inline" yaml:",inline"`
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
}
type BlockDevicesAnalyze struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
MinimumAcceptableSize uint64 `json:"minimumAcceptableSize" yaml:"minimumAcceptableSize"`
IncludeUnmountedPartitions bool `json:"includeUnmountedPartitions" yaml:"includeUnmountedPartitions"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
@@ -59,8 +63,9 @@ type SystemPackagesAnalyze struct {
}
type KernelModulesAnalyze struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
AnalyzeMeta `json:",inline" yaml:",inline"`
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
}
type TCPConnectAnalyze struct {
@@ -70,8 +75,9 @@ type TCPConnectAnalyze struct {
}
type IPV4InterfacesAnalyze struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
AnalyzeMeta `json:",inline" yaml:",inline"`
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
}
type FilesystemPerformanceAnalyze struct {
@@ -87,12 +93,15 @@ type CertificateAnalyze struct {
}
type HostServicesAnalyze struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
AnalyzeMeta `json:",inline" yaml:",inline"`
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
}
type HostOSAnalyze struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
AnalyzeMeta `json:",inline" yaml:",inline"`
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
}
type HostAnalyze struct {
CPU *CPUAnalyze `json:"cpu,omitempty" yaml:"cpu,omitempty"`
@@ -7,7 +7,7 @@ import (
type HostCollectorMeta struct {
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
// +optional
Exclude multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
Exclude *multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
}
type CPU struct {
@@ -10,7 +10,7 @@ import (
type RemoteCollectorMeta struct {
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
// +optional
Exclude multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
Exclude *multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
}
type RemoteCPU struct {
@@ -24,6 +24,7 @@ import (
type SupportBundleSpec struct {
AfterCollection []*AfterCollection `json:"afterCollection,omitempty" yaml:"afterCollection,omitempty"`
Collectors []*Collect `json:"collectors,omitempty" yaml:"collectors,omitempty"`
HostCollectors []*HostCollect `json:"hostCollectors,omitempty" yaml:"hostCollectors,omitempty"`
Analyzers []*Analyze `json:"analyzers,omitempty" yaml:"analyzers,omitempty"`
}
File diff suppressed because it is too large Load Diff
@@ -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 {
+54 -42
View File
@@ -3,7 +3,6 @@ package collect
import (
"context"
"fmt"
"io"
"os"
"path"
"strings"
@@ -28,52 +27,60 @@ type CephCommand struct {
var CephCommands = []CephCommand{
{
ID: "status",
Command: []string{"ceph", "status"},
Args: []string{"-f", "json-pretty"},
Format: "json",
ID: "status",
Command: []string{"ceph", "status"},
Args: []string{"-f", "json-pretty"},
Format: "json",
DefaultTimeout: "30s",
},
{
ID: "fs",
Command: []string{"ceph", "fs", "status"},
Args: []string{"-f", "json-pretty"},
Format: "json",
ID: "fs",
Command: []string{"ceph", "fs", "status"},
Args: []string{"-f", "json-pretty"},
Format: "json",
DefaultTimeout: "30s",
},
{
ID: "fs-ls",
Command: []string{"ceph", "fs", "ls"},
Args: []string{"-f", "json-pretty"},
Format: "json",
ID: "fs-ls",
Command: []string{"ceph", "fs", "ls"},
Args: []string{"-f", "json-pretty"},
Format: "json",
DefaultTimeout: "30s",
},
{
ID: "osd-status",
Command: []string{"ceph", "osd", "status"},
Args: []string{"-f", "json-pretty"},
Format: "txt",
ID: "osd-status",
Command: []string{"ceph", "osd", "status"},
Args: []string{"-f", "json-pretty"},
Format: "txt",
DefaultTimeout: "30s",
},
{
ID: "osd-tree",
Command: []string{"ceph", "osd", "tree"},
Args: []string{"-f", "json-pretty"},
Format: "json",
ID: "osd-tree",
Command: []string{"ceph", "osd", "tree"},
Args: []string{"-f", "json-pretty"},
Format: "json",
DefaultTimeout: "30s",
},
{
ID: "osd-pool",
Command: []string{"ceph", "osd", "pool", "ls", "detail"},
Args: []string{"-f", "json-pretty"},
Format: "json",
ID: "osd-pool",
Command: []string{"ceph", "osd", "pool", "ls", "detail"},
Args: []string{"-f", "json-pretty"},
Format: "json",
DefaultTimeout: "30s",
},
{
ID: "health",
Command: []string{"ceph", "health", "detail"},
Args: []string{"-f", "json-pretty"},
Format: "json",
ID: "health",
Command: []string{"ceph", "health", "detail"},
Args: []string{"-f", "json-pretty"},
Format: "json",
DefaultTimeout: "30s",
},
{
ID: "auth",
Command: []string{"ceph", "auth", "ls"},
Args: []string{"-f", "json-pretty"},
Format: "json",
ID: "auth",
Command: []string{"ceph", "auth", "ls"},
Args: []string{"-f", "json-pretty"},
Format: "json",
DefaultTimeout: "30s",
},
{
ID: "rgw-stats", // the disk usage (and other stats) of each object store bucket
@@ -83,10 +90,18 @@ var CephCommands = []CephCommand{
DefaultTimeout: "30s", // include a default timeout because this command will hang if the RGW daemon isn't running/is unhealthy
},
{
ID: "rbd-du", // the disk usage of each PVC
Command: []string{"rbd", "du"},
Args: []string{"--pool=replicapool"},
Format: "txt",
ID: "rbd-du", // the disk usage of each PVC
Command: []string{"rbd", "du"},
Args: []string{"--pool=replicapool"},
Format: "txt",
DefaultTimeout: "30s",
},
{
ID: "osd-df",
Command: []string{"ceph", "osd", "df"},
Args: []string{"-f", "json-pretty"},
Format: "json",
DefaultTimeout: "30s",
},
}
@@ -133,8 +148,8 @@ func cephCommandExec(ctx context.Context, c *Collector, cephCollector *troublesh
return errors.Wrap(err, "failed to exec command")
}
pathPrefix := GetCephCollectorFilepath(cephCollector.CollectorName, cephCollector.Namespace)
for srcFilename, _ := range results {
pathPrefix := GetCephCollectorFilepath(cephCollector.CollectorName, cephCollector.Namespace)
var dstFileName string
switch {
case strings.HasSuffix(srcFilename, "-stdout.txt"):
@@ -203,10 +218,7 @@ func copyResult(srcResult CollectorResult, dstResult CollectorResult, bundlePath
}
return errors.Wrap(err, "failed to get reader")
}
if reader, ok := reader.(io.ReadCloser); ok {
defer reader.Close()
}
defer reader.Close()
err = dstResult.SaveResult(bundlePath, dstKey, reader)
if err != nil {
+1 -1
View File
@@ -56,7 +56,7 @@ func CollectHost(c *troubleshootv1beta2.HostCollector, additionalRedactors *trou
var collectors []HostCollector
for _, desiredCollector := range c.Spec.Collectors {
collector, ok := GetHostCollector(desiredCollector)
collector, ok := GetHostCollector(desiredCollector, "")
if !ok {
return nil, ErrHostCollectorNotFound
}
+15 -1
View File
@@ -26,7 +26,11 @@ type Collector struct {
type Collectors []*Collector
func isExcluded(excludeVal multitype.BoolOrString) (bool, error) {
func isExcluded(excludeVal *multitype.BoolOrString) (bool, error) {
if excludeVal == nil {
return false, nil
}
if excludeVal.Type == multitype.Bool {
return excludeVal.BoolVal, nil
}
@@ -93,6 +97,14 @@ func (c *Collector) IsExcluded() bool {
if isExcludedResult {
return true
}
} else if c.Collect.RunPod != nil {
isExcludedResult, err := isExcluded(c.Collect.RunPod.Exclude)
if err != nil {
return true
}
if isExcludedResult {
return true
}
} else if c.Collect.Exec != nil {
isExcludedResult, err := isExcluded(c.Collect.Exec.Exclude)
if err != nil {
@@ -221,6 +233,8 @@ func (c *Collector) RunCollectorSync(clientConfig *rest.Config, client kubernete
result, err = Logs(c, c.Collect.Logs)
} else if c.Collect.Run != nil {
result, err = Run(c, c.Collect.Run)
} else if c.Collect.RunPod != nil {
result, err = RunPod(c, c.Collect.RunPod)
} else if c.Collect.Exec != nil {
result, err = Exec(c, c.Collect.Exec)
} else if c.Collect.Data != nil {
+1 -9
View File
@@ -21,7 +21,6 @@ func TestCollector_RunCollectorSyncNoRedact(t *testing.T) {
Data: &troubleshootv1beta2.Data{
CollectorMeta: troubleshootv1beta2.CollectorMeta{
CollectorName: "datacollectorname",
Exclude: multitype.BoolOrString{},
},
Name: "data",
Data: `abc 123
@@ -54,7 +53,6 @@ pwd=***HIDDEN***;
Data: &troubleshootv1beta2.Data{
CollectorMeta: troubleshootv1beta2.CollectorMeta{
CollectorName: "datacollectorname",
Exclude: multitype.BoolOrString{},
},
Name: "data",
Data: `abc 123
@@ -89,7 +87,6 @@ pwd=***HIDDEN***;
Data: &troubleshootv1beta2.Data{
CollectorMeta: troubleshootv1beta2.CollectorMeta{
CollectorName: "datacollectorname",
Exclude: multitype.BoolOrString{},
},
Name: "data",
Data: `abc 123
@@ -124,7 +121,6 @@ pwd=***HIDDEN***;
Data: &troubleshootv1beta2.Data{
CollectorMeta: troubleshootv1beta2.CollectorMeta{
CollectorName: "datacollectorname",
Exclude: multitype.BoolOrString{},
},
Name: "data",
Data: `abc 123
@@ -162,7 +158,6 @@ pwd=***HIDDEN***;
Data: &troubleshootv1beta2.Data{
CollectorMeta: troubleshootv1beta2.CollectorMeta{
CollectorName: "data/collectorname",
Exclude: multitype.BoolOrString{},
},
Name: "data",
Data: `abc 123
@@ -200,7 +195,6 @@ pwd=***HIDDEN***;
Data: &troubleshootv1beta2.Data{
CollectorMeta: troubleshootv1beta2.CollectorMeta{
CollectorName: "datacollectorname",
Exclude: multitype.BoolOrString{},
},
Name: "data",
Data: `abc 123
@@ -228,7 +222,6 @@ another line here
Data: &troubleshootv1beta2.Data{
CollectorMeta: troubleshootv1beta2.CollectorMeta{
CollectorName: "datacollectorname",
Exclude: multitype.BoolOrString{},
},
Name: "data",
Data: `xyz123
@@ -265,7 +258,7 @@ abc
Data: &troubleshootv1beta2.Data{
CollectorMeta: troubleshootv1beta2.CollectorMeta{
CollectorName: "datacollectorname",
Exclude: multitype.BoolOrString{Type: multitype.String, StrVal: "true"},
Exclude: multitype.FromString("true"),
},
Name: "data",
Data: `abc 123
@@ -310,7 +303,6 @@ func TestCollector_RunCollectorSync(t *testing.T) {
Data: &troubleshootv1beta2.Data{
CollectorMeta: troubleshootv1beta2.CollectorMeta{
CollectorName: "datacollectorname",
Exclude: multitype.BoolOrString{},
},
Name: "data",
Data: `abc 123
+5
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{
{
+4 -3
View File
@@ -1,7 +1,8 @@
package collect
type DatabaseConnection struct {
IsConnected bool `json:"isConnected"`
Error string `json:"error,omitempty"`
Version string `json:"version,omitempty"`
IsConnected bool `json:"isConnected"`
Error string `json:"error,omitempty"`
Version string `json:"version,omitempty"`
Variables map[string]string `json:"variables,omitempty"`
}
+6 -1
View File
@@ -28,9 +28,11 @@ type BlockDeviceInfo struct {
const lsblkColumns = "NAME,KNAME,PKNAME,TYPE,MAJ:MIN,SIZE,FSTYPE,MOUNTPOINT,SERIAL,RO,RM"
const lsblkFormat = `NAME=%q KNAME=%q PKNAME=%q TYPE=%q MAJ:MIN="%d:%d" SIZE="%d" FSTYPE=%q MOUNTPOINT=%q SERIAL=%q RO="%d" RM="%d0"`
const HostBlockDevicesPath = `host-collectors/system/block_devices.json`
type CollectHostBlockDevices struct {
hostCollector *troubleshootv1beta2.HostBlockDevices
BundlePath string
}
func (c *CollectHostBlockDevices) Title() string {
@@ -83,7 +85,10 @@ func (c *CollectHostBlockDevices) Collect(progressChan chan<- interface{}) (map[
return nil, errors.Wrap(err, "failed to marshal block device info")
}
output := NewResult()
output.SaveResult(c.BundlePath, HostBlockDevicesPath, bytes.NewBuffer(b))
return map[string][]byte{
"system/block_devices.json": b,
HostBlockDevicesPath: b,
}, nil
}

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