diff --git a/.github/workflows/build-test-deploy.yaml b/.github/workflows/build-test-deploy.yaml index 549bc4af..5527798b 100644 --- a/.github/workflows/build-test-deploy.yaml +++ b/.github/workflows/build-test-deploy.yaml @@ -56,7 +56,42 @@ jobs: path: bin/ - uses: engineerd/setup-kind@v0.2.0 - run: chmod +x bin/preflight - - run: bin/preflight --interactive=false --format=json https://preflight.replicated.com + - run: ./bin/preflight --interactive=false --format=json https://preflight.replicated.com + + compile-supportbundle: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/setup-go@v1 + with: + go-version: '1.14' + - name: setup env + run: | + echo "::set-env name=GOPATH::$(go env GOPATH)" + echo "::add-path::$(go env GOPATH)/bin" + shell: bash + - uses: actions/checkout@master + - run: make support-bundle + - uses: actions/upload-artifact@v1 + with: + name: support-bundle + path: bin/support-bundle + + validate-supportbundle: + runs-on: ubuntu-latest + needs: compile-supportbundle + steps: + - uses: actions/checkout@v1 + - name: Download support-bundle binary + uses: actions/download-artifact@v1 + with: + name: support-bundle + path: bin/ + - uses: engineerd/setup-kind@v0.2.0 + - run: chmod +x bin/support-bundle + - run: ./bin/support-bundle ./examples/troubleshoot/sample-collectors.yaml + - run: ./bin/support-bundle ./examples/troubleshoot/sample-supportbundle.yaml + - run: ./bin/support-bundle https://kots.io goreleaser: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index f5073461..a3afeaa3 100644 --- a/Makefile +++ b/Makefile @@ -67,8 +67,9 @@ vet: .PHONY: generate generate: controller-gen client-gen - $(shell go env GOPATH)/bin/controller-gen object:headerFile=./hack/boilerplate.go.txt paths=./pkg/apis/... - $(shell go env GOPATH)/bin/client-gen \ + $(CONTROLLER_GEN) \ + object:headerFile=./hack/boilerplate.go.txt paths=./pkg/apis/... + $(CLIENT_GEN) \ --output-package=github.com/replicatedhq/troubleshoot/pkg/client \ --clientset-name troubleshootclientset \ --input-base github.com/replicatedhq/troubleshoot/pkg/apis \ @@ -84,8 +85,7 @@ schemas: fmt vet openapischema go build ${LDFLAGS} -o bin/schemagen github.com/replicatedhq/troubleshoot/cmd/schemagen ./bin/schemagen --output-dir ./schemas -# find or download controller-gen -# download controller-gen if necessary +.PHONY: contoller-gen controller-gen: ifeq (, $(shell which controller-gen)) go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.8 @@ -94,10 +94,10 @@ else CONTROLLER_GEN=$(shell which controller-gen) endif -# find or download client-gen +.PHONY: client-gen client-gen: ifeq (, $(shell which client-gen)) - go get k8s.io/code-generator/cmd/client-gen@kubernetes-1.16.4 + go get k8s.io/code-generator/cmd/client-gen@kubernetes-1.18.0 CLIENT_GEN=$(shell go env GOPATH)/bin/client-gen else CLIENT_GEN=$(shell which client-gen) @@ -128,7 +128,7 @@ run-preflight: preflight .PHONY: run-troubleshoot run-troubleshoot: support-bundle - ./bin/support-bundle ./examples/troubleshoot/sample-troubleshoot.yaml + ./bin/support-bundle ./examples/troubleshoot/sample-supportbundle.yaml .PHONY: run-analyze run-analyze: analyze diff --git a/cmd/preflight/cli/root.go b/cmd/preflight/cli/root.go index 5d2004d8..e4df7624 100644 --- a/cmd/preflight/cli/root.go +++ b/cmd/preflight/cli/root.go @@ -36,15 +36,10 @@ that a cluster meets the requirements to run an application.`, cmd.Flags().Bool("interactive", true, "interactive preflights") cmd.Flags().String("format", "human", "output format, one of human, json, yaml. only used when interactive is set to false") - cmd.Flags().String("preflight", "", "name of the preflight to use") - cmd.Flags().String("image", "", "the full name of the preflight image to use") - cmd.Flags().String("pullpolicy", "", "the pull policy of the preflight image") cmd.Flags().String("collector-image", "", "the full name of the collector image to use") cmd.Flags().String("collector-pullpolicy", "", "the pull policy of the collector image") cmd.Flags().Bool("collect-without-permissions", false, "always run preflight checks even if some require permissions that preflight does not have") - cmd.Flags().String("serviceaccount", "", "name of the service account to use. if not provided, one will be created") - viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_")) KubernetesConfigFlags = genericclioptions.NewConfigFlags(false) diff --git a/cmd/preflight/cli/serviceaccount.go b/cmd/preflight/cli/serviceaccount.go deleted file mode 100644 index ff7c3d65..00000000 --- a/cmd/preflight/cli/serviceaccount.go +++ /dev/null @@ -1,151 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" - corev1 "k8s.io/api/core/v1" - rbacv1 "k8s.io/api/rbac/v1" - kuberneteserrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" -) - -func createServiceAccount(preflight troubleshootv1beta1.Preflight, namespace string, clientset *kubernetes.Clientset) (string, error) { - name := fmt.Sprintf("preflight-%s", preflight.Name) - - serviceAccount := corev1.ServiceAccount{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "v1", - Kind: "ServiceAccount", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - }, - Secrets: []corev1.ObjectReference{ - { - APIVersion: "v1", - Kind: "Secret", - Name: name, - Namespace: namespace, - }, - }, - } - - _, err := clientset.CoreV1().ServiceAccounts(namespace).Get(serviceAccount.Name, metav1.GetOptions{}) - if err != nil && !kuberneteserrors.IsNotFound(err) { - return "", errors.Wrap(err, "failed to get existing service account") - } - if kuberneteserrors.IsNotFound(err) { - _, err := clientset.CoreV1().ServiceAccounts(namespace).Create(&serviceAccount) - if err != nil { - return "", errors.Wrap(err, "failed to create service account") - } - } - - role := rbacv1.ClusterRole{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "v1", - Kind: "ClusterRole", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - }, - Rules: []rbacv1.PolicyRule{ - { - APIGroups: []string{""}, - Resources: []string{ - "namespaces", - "pods", - "services", - "secrets", - }, - Verbs: metav1.Verbs{"list"}, - }, - { - APIGroups: []string{"apps"}, - Resources: []string{"deployments"}, - Verbs: metav1.Verbs{"list"}, - }, - { - APIGroups: []string{"extensions"}, - Resources: []string{"ingresses"}, - Verbs: metav1.Verbs{"list"}, - }, - { - APIGroups: []string{"storage.k8s.io"}, - Resources: []string{"storageclasses"}, - Verbs: metav1.Verbs{"list"}, - }, - { - APIGroups: []string{"apiextensions.k8s.io"}, - Resources: []string{"customresourcedefinitions"}, - Verbs: metav1.Verbs{"list"}, - }, - }, - } - _, err = clientset.RbacV1().ClusterRoles().Get(role.Name, metav1.GetOptions{}) - if err != nil && !kuberneteserrors.IsNotFound(err) { - return "", errors.Wrap(err, "failed to get eisting cluster role") - } - if kuberneteserrors.IsNotFound(err) { - _, err = clientset.RbacV1().ClusterRoles().Create(&role) - if err != nil { - return "", errors.Wrap(err, "failed to create cluster role") - } - } - - roleBinding := rbacv1.ClusterRoleBinding{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "v1", - Kind: "ClusterRoleBinding", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - }, - Subjects: []rbacv1.Subject{ - { - Kind: "ServiceAccount", - Name: name, - Namespace: namespace, - }, - }, - RoleRef: rbacv1.RoleRef{ - APIGroup: "rbac.authorization.k8s.io", - Kind: "ClusterRole", - Name: name, - }, - } - _, err = clientset.RbacV1().ClusterRoleBindings().Get(roleBinding.Name, metav1.GetOptions{}) - if err != nil && !kuberneteserrors.IsNotFound(err) { - return "", errors.Wrap(err, "failed to get existing cluster role binding") - } - if kuberneteserrors.IsNotFound(err) { - _, err = clientset.RbacV1().ClusterRoleBindings().Create(&roleBinding) - if err != nil { - return "", errors.Wrap(err, "failed to create cluster role binding") - } - } - - return name, nil -} - -func removeServiceAccount(name string, namespace string, clientset *kubernetes.Clientset) error { - if err := clientset.RbacV1().ClusterRoleBindings().Delete(name, &metav1.DeleteOptions{}); err != nil { - return errors.Wrap(err, "failed to delete cluster role binding") - } - - if err := clientset.RbacV1().ClusterRoles().Delete(name, &metav1.DeleteOptions{}); err != nil { - return errors.Wrap(err, "failed to delete cluster role") - } - - if err := clientset.CoreV1().ServiceAccounts(namespace).Delete(name, &metav1.DeleteOptions{}); err != nil { - return errors.Wrap(err, "failed to delete service account") - } - - return nil -} diff --git a/cmd/troubleshoot/cli/root.go b/cmd/troubleshoot/cli/root.go index a5a09ed9..6abb6a8e 100644 --- a/cmd/troubleshoot/cli/root.go +++ b/cmd/troubleshoot/cli/root.go @@ -40,9 +40,6 @@ from a server that can be used to assist when troubleshooting a server.`, cmd.AddCommand(Analyze()) cmd.AddCommand(VersionCmd()) - cmd.Flags().String("collectors", "", "name of the collectors to use") - cmd.Flags().String("image", "", "the full name of the collector image to use") - cmd.Flags().String("pullpolicy", "", "the pull policy of the collector image") cmd.Flags().StringSlice("redactors", []string{}, "names of the additional redactors to use") cmd.Flags().Bool("redact", true, "enable/disable default redactions") cmd.Flags().Bool("collect-without-permissions", false, "always run troubleshoot collectors even if some require permissions that troubleshoot does not have") @@ -51,7 +48,6 @@ from a server that can be used to assist when troubleshooting a server.`, cmd.Flags().Bool("allow-insecure-connections", false, "don't verify TLS certs when retrieving spec and reporting results") cmd.Flags().MarkHidden("allow-insecure-connections") - cmd.Flags().String("serviceaccount", "", "name of the service account to use. if not provided, one will be created") viper.BindPFlags(cmd.Flags()) viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_")) diff --git a/cmd/troubleshoot/cli/run.go b/cmd/troubleshoot/cli/run.go index 48518955..7d3f5996 100644 --- a/cmd/troubleshoot/cli/run.go +++ b/cmd/troubleshoot/cli/run.go @@ -2,6 +2,7 @@ package cli import ( "bytes" + "context" "crypto/tls" "encoding/json" "fmt" @@ -20,13 +21,16 @@ import ( "github.com/mholt/archiver" "github.com/pkg/errors" "github.com/replicatedhq/troubleshoot/cmd/util" + analyzer "github.com/replicatedhq/troubleshoot/pkg/analyze" troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" troubleshootclientsetscheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" "github.com/replicatedhq/troubleshoot/pkg/collect" + "github.com/replicatedhq/troubleshoot/pkg/convert" "github.com/replicatedhq/troubleshoot/pkg/redact" "github.com/spf13/viper" spin "github.com/tj/go-spin" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) var ( @@ -52,14 +56,14 @@ func runTroubleshoot(v *viper.Viper, arg string) error { multidocs := strings.Split(string(collectorContent), "---") - troubleshootclientsetscheme.AddToScheme(scheme.Scheme) - decode := scheme.Codecs.UniversalDeserializer().Decode - obj, _, err := decode([]byte(multidocs[0]), nil, nil) + // we suppory both raw collector kinds and supportbundle kinds here + supportBundleSpec, err := parseSupportBundleFromDoc([]byte(multidocs[0])) if err != nil { - return errors.Wrapf(err, "failed to parse %s", arg) + return errors.Wrap(err, "failed to parse collector") } - collector := obj.(*troubleshootv1beta1.Collector) + troubleshootclientsetscheme.AddToScheme(scheme.Scheme) + decode := scheme.Codecs.UniversalDeserializer().Decode additionalRedactors := &troubleshootv1beta1.Redactor{} for idx, redactor := range v.GetStringSlice("redactors") { @@ -123,16 +127,72 @@ func runTroubleshoot(v *viper.Viper, arg string) error { close(finishedCh) }() - archivePath, err := runCollectors(v, *collector, additionalRedactors, progressChan) + archivePath, err := runCollectors(v, supportBundleSpec.Spec.Collectors, additionalRedactors, progressChan) if err != nil { return errors.Wrap(err, "run collectors") } fmt.Printf("\r%s\r", cursor.ClearEntireLine()) - if len(collector.Spec.AfterCollection) == 0 { + // upload if needed + fileUploaded := false + if len(supportBundleSpec.Spec.AfterCollection) > 0 { + for _, ac := range supportBundleSpec.Spec.AfterCollection { + if ac.UploadResultsTo != nil { + if err := uploadSupportBundle(ac.UploadResultsTo, archivePath); err != nil { + c := color.New(color.FgHiRed) + c.Printf("%s\r * Failed to upload support bundle: %v\n", cursor.ClearEntireLine(), err) + } else { + fileUploaded = true + } + } else if ac.Callback != nil { + if err := callbackSupportBundleAPI(ac.Callback, archivePath); err != nil { + c := color.New(color.FgHiRed) + c.Printf("%s\r * Failed to notify API that support bundle has been uploaded: %v\n", cursor.ClearEntireLine(), err) + } + } + } + + } + + // perform analysis, if possible + if len(supportBundleSpec.Spec.Analyzers) > 0 { + tmpDir, err := ioutil.TempDir("", "troubleshoot") + if err != nil { + c := color.New(color.FgHiRed) + c.Printf("%s\r * Failed to make directory for analysis: %v\n", cursor.ClearEntireLine(), err) + } + + f, err := os.Open(archivePath) + if err != nil { + c := color.New(color.FgHiRed) + c.Printf("%s\r * Failed to open support bundle for analysis: %v\n", cursor.ClearEntireLine(), err) + + } + if err := analyzer.ExtractTroubleshootBundle(f, tmpDir); err != nil { + c := color.New(color.FgHiRed) + c.Printf("%s\r * Failed to extract support bundle for analysis: %v\n", cursor.ClearEntireLine(), err) + } + + analyzeResults, err := analyzer.AnalyzeLocal(tmpDir, supportBundleSpec.Spec.Analyzers) + if err != nil { + c := color.New(color.FgHiRed) + c.Printf("%s\r * Failed to analyze support bundle: %v\n", cursor.ClearEntireLine(), err) + } + + data := convert.FromAnalyzerResult(analyzeResults) + formatted, err := json.MarshalIndent(data, "", " ") + if err != nil { + c := color.New(color.FgHiRed) + c.Printf("%s\r * Failed to format analysis: %v\n", cursor.ClearEntireLine(), err) + } + + fmt.Printf("%s", formatted) + } + + if !fileUploaded { msg := archivePath - if appName := collector.Labels["applicationName"]; appName != "" { + if appName := supportBundleSpec.Labels["applicationName"]; appName != "" { f := `A support bundle for %s has been created in this directory named %s. Please upload it on the Troubleshoot page of the %s Admin Console to begin analysis.` @@ -144,23 +204,6 @@ the %s Admin Console to begin analysis.` return nil } - fileUploaded := false - for _, ac := range collector.Spec.AfterCollection { - if ac.UploadResultsTo != nil { - if err := uploadSupportBundle(ac.UploadResultsTo, archivePath); err != nil { - c := color.New(color.FgHiRed) - c.Printf("%s\r * Failed to upload support bundle: %v\n", cursor.ClearEntireLine(), err) - } else { - fileUploaded = true - } - } else if ac.Callback != nil { - if err := callbackSupportBundleAPI(ac.Callback, archivePath); err != nil { - c := color.New(color.FgHiRed) - c.Printf("%s\r * Failed to notify API that support bundle has been uploaded: %v\n", cursor.ClearEntireLine(), err) - } - } - } - fmt.Printf("\r%s\r", cursor.ClearEntireLine()) if fileUploaded { fmt.Printf("A support bundle has been created and uploaded to your cluster for analysis. Please visit the Troubleshoot page to continue.\n") @@ -212,6 +255,41 @@ func loadSpec(v *viper.Viper, arg string) ([]byte, error) { } } +func parseSupportBundleFromDoc(doc []byte) (*troubleshootv1beta1.SupportBundle, error) { + troubleshootclientsetscheme.AddToScheme(scheme.Scheme) + decode := scheme.Codecs.UniversalDeserializer().Decode + + obj, _, err := decode(doc, nil, nil) + if err != nil { + return nil, errors.Wrap(err, "failed to parse document") + } + + collector, ok := obj.(*troubleshootv1beta1.Collector) + if ok { + supportBundle := troubleshootv1beta1.SupportBundle{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "troubleshoot.replicated.com/v1beta1", + Kind: "SupportBundle", + }, + ObjectMeta: collector.ObjectMeta, + Spec: troubleshootv1beta1.SupportBundleSpec{ + Collectors: collector.Spec.Collectors, + Analyzers: []*troubleshootv1beta1.Analyze{}, + AfterCollection: collector.Spec.AfterCollection, + }, + } + + return &supportBundle, nil + } + + supportBundle, ok := obj.(*troubleshootv1beta1.SupportBundle) + if ok { + return supportBundle, nil + } + + return nil, errors.New("spec was not parseable as a troubleshoot kind") +} + func canTryInsecure(v *viper.Viper) bool { if !isatty.IsTerminal(os.Stdout.Fd()) { return false @@ -229,7 +307,7 @@ func canTryInsecure(v *viper.Viper) bool { return true } -func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector, additionalRedactors *troubleshootv1beta1.Redactor, progressChan chan interface{}) (string, error) { +func runCollectors(v *viper.Viper, collectors []*troubleshootv1beta1.Collect, additionalRedactors *troubleshootv1beta1.Redactor, progressChan chan interface{}) (string, error) { bundlePath, err := ioutil.TempDir("", "troubleshoot") if err != nil { return "", errors.Wrap(err, "create temp dir") @@ -241,7 +319,7 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector, addi } collectSpecs := make([]*troubleshootv1beta1.Collect, 0, 0) - collectSpecs = append(collectSpecs, collector.Spec.Collectors...) + collectSpecs = append(collectSpecs, collectors...) collectSpecs = ensureCollectorInList(collectSpecs, troubleshootv1beta1.Collect{ClusterInfo: &troubleshootv1beta1.ClusterInfo{}}) collectSpecs = ensureCollectorInList(collectSpecs, troubleshootv1beta1.Collect{ClusterResources: &troubleshootv1beta1.ClusterResources{}}) @@ -250,7 +328,7 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector, addi return "", errors.Wrap(err, "failed to convert kube flags to rest config") } - var collectors collect.Collectors + var cleanedCollectors collect.Collectors for _, desiredCollector := range collectSpecs { collector := collect.Collector{ Redact: true, @@ -258,15 +336,15 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector, addi ClientConfig: config, Namespace: v.GetString("namespace"), } - collectors = append(collectors, &collector) + cleanedCollectors = append(cleanedCollectors, &collector) } - if err := collectors.CheckRBAC(); err != nil { + if err := cleanedCollectors.CheckRBAC(context.Background()); err != nil { return "", errors.Wrap(err, "failed to check RBAC for collectors") } foundForbidden := false - for _, c := range collectors { + for _, c := range cleanedCollectors { for _, e := range c.RBACErrors { foundForbidden = true progressChan <- e @@ -283,7 +361,7 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector, addi } // Run preflights collectors synchronously - for _, collector := range collectors { + for _, collector := range cleanedCollectors { if len(collector.RBACErrors) > 0 { // don't skip clusterResources collector due to RBAC issues if collector.Collect.ClusterResources == nil { diff --git a/cmd/troubleshoot/cli/serviceaccount.go b/cmd/troubleshoot/cli/serviceaccount.go deleted file mode 100644 index 5dfcd879..00000000 --- a/cmd/troubleshoot/cli/serviceaccount.go +++ /dev/null @@ -1,122 +0,0 @@ -package cli - -import ( - "fmt" - - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" - corev1 "k8s.io/api/core/v1" - rbacv1 "k8s.io/api/rbac/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" -) - -func createServiceAccount(collector troubleshootv1beta1.Collector, namespace string, clientset *kubernetes.Clientset) (string, error) { - name := fmt.Sprintf("troubleshoot-%s", collector.Name) - - serviceAccount := corev1.ServiceAccount{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "v1", - Kind: "ServiceAccount", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - }, - } - _, err := clientset.CoreV1().ServiceAccounts(namespace).Create(&serviceAccount) - if err != nil { - return "", err - } - - role := rbacv1.ClusterRole{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "v1", - Kind: "ClusterRole", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - }, - Rules: []rbacv1.PolicyRule{ - { - APIGroups: []string{""}, - Resources: []string{ - "namespaces", - "pods", - "services", - "secrets", - }, - Verbs: metav1.Verbs{"list"}, - }, - { - APIGroups: []string{"apps"}, - Resources: []string{"deployments"}, - Verbs: metav1.Verbs{"list"}, - }, - { - APIGroups: []string{"extensions"}, - Resources: []string{"ingresses"}, - Verbs: metav1.Verbs{"list"}, - }, - { - APIGroups: []string{"storage.k8s.io"}, - Resources: []string{"storageclasses"}, - Verbs: metav1.Verbs{"list"}, - }, - { - APIGroups: []string{"apiextensions.k8s.io"}, - Resources: []string{"customresourcedefinitions"}, - Verbs: metav1.Verbs{"list"}, - }, - }, - } - _, err = clientset.RbacV1().ClusterRoles().Create(&role) - if err != nil { - return "", err - } - - roleBinding := rbacv1.ClusterRoleBinding{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "v1", - Kind: "ClusterRoleBinding", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - }, - Subjects: []rbacv1.Subject{ - { - Kind: "ServiceAccount", - Name: name, - Namespace: namespace, - }, - }, - RoleRef: rbacv1.RoleRef{ - APIGroup: "rbac.authorization.k8s.io", - Kind: "ClusterRole", - Name: name, - }, - } - _, err = clientset.RbacV1().ClusterRoleBindings().Create(&roleBinding) - if err != nil { - return "", err - } - - return name, nil -} - -func removeServiceAccount(name string, namespace string, clientset *kubernetes.Clientset) error { - if err := clientset.RbacV1().ClusterRoleBindings().Delete(name, &metav1.DeleteOptions{}); err != nil { - return err - } - - if err := clientset.RbacV1().ClusterRoles().Delete(name, &metav1.DeleteOptions{}); err != nil { - return err - } - - if err := clientset.CoreV1().ServiceAccounts(namespace).Delete(name, &metav1.DeleteOptions{}); err != nil { - return err - } - - return nil -} diff --git a/examples/troubleshoot/sample-troubleshoot.yaml b/examples/troubleshoot/sample-collectors.yaml similarity index 100% rename from examples/troubleshoot/sample-troubleshoot.yaml rename to examples/troubleshoot/sample-collectors.yaml diff --git a/examples/troubleshoot/sample-supportbundle.yaml b/examples/troubleshoot/sample-supportbundle.yaml new file mode 100644 index 00000000..c85a3c45 --- /dev/null +++ b/examples/troubleshoot/sample-supportbundle.yaml @@ -0,0 +1,20 @@ +apiVersion: troubleshoot.replicated.com/v1beta1 +kind: SupportBundle +metadata: + name: supportbundle-sample +spec: + collectors: [] + analyzers: + - clusterVersion: + outcomes: + - fail: + when: "< 1.13.0" + message: The application requires at 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. diff --git a/go.mod b/go.mod index 99bbfb0e..5f0d32de 100644 --- a/go.mod +++ b/go.mod @@ -32,12 +32,9 @@ require ( github.com/mitchellh/go-wordwrap v1.0.0 // indirect github.com/nicksnyder/go-i18n v1.10.1 // indirect github.com/nwaples/rardecode v1.0.0 // indirect - github.com/onsi/ginkgo v1.11.0 // indirect github.com/onsi/gomega v1.9.0 // indirect github.com/pierrec/lz4 v2.2.6+incompatible // indirect github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.0.0 // indirect - github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/procfs v0.0.5 // indirect github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.4.0 @@ -51,13 +48,12 @@ require ( golang.org/x/tools v0.0.0-20191010075000-0337d82405ff // indirect gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780 // indirect gopkg.in/yaml.v2 v2.2.8 - k8s.io/api v0.17.4 - k8s.io/apiextensions-apiserver v0.15.13-beta.0 - k8s.io/apimachinery v0.17.4 - k8s.io/cli-runtime v0.17.4 - k8s.io/client-go v0.17.4 - k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c // indirect - k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 // indirect - sigs.k8s.io/controller-runtime v0.4.0 - sigs.k8s.io/yaml v1.2.0 // indirect + k8s.io/api v0.18.3 + k8s.io/apiextensions-apiserver v0.18.0 + k8s.io/apimachinery v0.18.3 + k8s.io/cli-runtime v0.18.0 + k8s.io/client-go v0.18.0 + k8s.io/code-generator v0.18.3-beta.0 // indirect + sigs.k8s.io/controller-runtime v0.5.1-0.20200402191424-df180accb901 + sigs.k8s.io/controller-tools v0.2.8 // indirect ) diff --git a/go.sum b/go.sum index b8fd21c0..6a6a1b56 100644 --- a/go.sum +++ b/go.sum @@ -10,7 +10,6 @@ dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1 dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v11.1.2+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= @@ -18,7 +17,6 @@ github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxB github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= -github.com/BurntSushi/toml v0.3.0/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -31,6 +29,7 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/ahmetalpbalkan/go-cursor v0.0.0-20131010032410-8136607ea412 h1:vOVO0ypMfTt6tZacyI0kp+iCZb1XSNiYDqnzBWYgfe4= github.com/ahmetalpbalkan/go-cursor v0.0.0-20131010032410-8136607ea412/go.mod h1:AI9hp1tkp10pAlK5TCwL+7yWbRgtDm9jhToq6qij2xs= github.com/alecthomas/gometalinter v2.0.11+incompatible h1:ENdXMllZNSVDTJUUVIzBW9CSEpntTrQa76iRsEFLX/M= @@ -38,6 +37,7 @@ github.com/alecthomas/gometalinter v2.0.11+incompatible/go.mod h1:qfIpQGGz3d+Nmg github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= @@ -52,6 +52,7 @@ github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= @@ -68,32 +69,30 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWs github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.1-coreos.6/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.15+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-oidc v0.0.0-20180117170138-065b426bd416/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= -github.com/coreos/go-semver v0.0.0-20180108230905-e214231b295a/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v0.0.0-20160705203006-01aeca54ebda/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c h1:ZfSZ3P3BedhKGUhzj7BQlPSU4OvT6tfOKe3DVHzOA7s= github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= @@ -101,8 +100,10 @@ github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3 github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q= github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo= github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484 h1:pEtiCjIXx3RvGjlUJuCNxNOw0MNblyR9Wi+vJGBFh+8= github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM= @@ -113,7 +114,6 @@ github.com/emicklei/go-restful v2.9.6+incompatible h1:tfrHha8zJ01ywiOEC1miGY8st1 github.com/emicklei/go-restful v2.9.6+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v0.0.0-20190203023257-5858425f7550/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= @@ -125,7 +125,6 @@ github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03D github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/ghodss/yaml v0.0.0-20180820084758-c7ce16629ff4/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc= @@ -144,38 +143,34 @@ github.com/go-logr/zapr v0.1.0 h1:h+WVe9j6HAA01niTJPA/kKH0i7e0rLZBCwauQFcRE54= github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= -github.com/go-openapi/analysis v0.17.2/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= +github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/errors v0.17.2/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= -github.com/go-openapi/jsonpointer v0.19.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= -github.com/go-openapi/loads v0.17.2/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= +github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk= github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= -github.com/go-openapi/runtime v0.17.2/go.mod h1:QO936ZXeisByFmZEO1IS1Dqhtf4QV1sYYFtIq6Ld86Q= github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= +github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= -github.com/go-openapi/spec v0.17.2/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= github.com/go-openapi/spec v0.19.3 h1:0XRyw8kguri6Yw4SxhsQA/atC88yqrk0+G4YhI2wabc= @@ -185,24 +180,25 @@ github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8 github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= +github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= -github.com/go-openapi/swag v0.17.2/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/validate v0.17.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= +github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= github.com/go-redis/redis/v7 v7.2.0 h1:CrCexy/jYWZjW0AyVoHlcJUeZN19VWlbepTh1Vq6dJs= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/flect v0.2.0 h1:EWCvMGGxOjsgwlWaP+f4+Hh6yrrte7JeFL2S6b+0hdM= +github.com/gobuffalo/flect v0.2.0/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I= @@ -212,7 +208,6 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= @@ -221,14 +216,12 @@ github.com/golang/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:tluoj9z5200j github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20160524151835-7d79101e329e/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -239,7 +232,6 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= @@ -259,25 +251,23 @@ github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE0 github.com/googleapis/gax-go/v2 v2.0.4 h1:hU4mGcQI4DaAYW+IbTun+2qEZVFxK0ySjQLTbS0VQKc= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/googleapis/gnostic v0.1.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.3.1 h1:WeAefnSUHlBb0iJKwxFDZdbfGwkd7xRNuV+IpXMJhYk= github.com/googleapis/gnostic v0.3.1/go.mod h1:on+2t9HRStVgn95RSsFWFz+6Q0Snyqv1awfrALZdbtU= -github.com/gophercloud/gophercloud v0.0.0-20190126172459-c818fa66e4c8/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc h1:cJlkeAx1QYgO5N80aF5xRGstVsRQwgLR7uA2FnP1ZjY= github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/go-grpc-middleware v0.0.0-20190222133341-cfaf5686ec79/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v0.0.0-20170330212424-2500245aa611/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.3.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6KdvN3Gig= @@ -307,10 +297,8 @@ github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0 github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jonboulle/clockwork v0.0.0-20141017032234-72f9bd7c4e0c/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok= @@ -351,6 +339,7 @@ github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7 github.com/manifoldco/promptui v0.3.2 h1:rir7oByTERac6jhpHUPErHuopoRDvO3jxS+FdadEns8= github.com/manifoldco/promptui v0.3.2/go.mod h1:8JU+igZ+eeiiRku4T5BjtKh2ms8sziGpSYl1gN8Bazw= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -384,9 +373,9 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nicksnyder/go-i18n v1.10.1 h1:isfg77E/aCD7+0lD/D00ebR2MV5vgeQ276WYyDaCRQc= @@ -396,20 +385,17 @@ github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE github.com/nwaples/rardecode v1.0.0 h1:r7vGuS5akxOnR4JQSkko62RJ1ReCMXxQRPtxsiFMBOs= github.com/nwaples/rardecode v1.0.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.4.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw= github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.3.0/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/opentracing/basictracer-go v1.0.0 h1:YyUAhaEfjoWXclZVJ9sGoNct7j4TVk7lZWlQw5UXuoo= @@ -435,7 +421,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM= @@ -449,14 +434,12 @@ github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2 github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -492,7 +475,6 @@ github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYED github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/soheilhy/cmux v0.1.3/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= @@ -502,7 +484,7 @@ github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.0-20180319062004-c439c4fa0937/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= @@ -526,6 +508,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tj/go-spin v1.1.0 h1:lhdWZsvImxvZ3q1C5OIB7d72DuOwP4O2NdBg9PyzNds= github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -539,28 +522,30 @@ github.com/ulikunitz/xz v0.5.6 h1:jGHAfXawEGZQ3blwU5wnWKQJvAraT7Ftq9EXjnXYgt8= github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/undefinedlabs/go-mpatch v0.0.0-20200122175732-0044123dbb98 h1:Z/megzdoMbuZ0H/oLmfTw92PAEfyTi1DkvAr8AUzFgw= github.com/undefinedlabs/go-mpatch v0.0.0-20200122175732-0044123dbb98/go.mod h1:TyJZDQ/5AgyN7FSLiBJ8RO9u2c6wbtRvK827b6AVqY4= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= -github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.uber.org/atomic v0.0.0-20181018215023-8dc6146f7569/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v0.0.0-20180122172545-ddea229ff1df/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v0.0.0-20180814183419-67bc79d13d15/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.undefinedlabs.com/scopeagent v0.1.7 h1:TPALQQNkPah8NgVjPKKhaBNZL2hg+hY2GRPfRMSt48c= @@ -568,13 +553,14 @@ go.undefinedlabs.com/scopeagent v0.1.7/go.mod h1:XCD8wnuBZ+eskhynYNP+uvBiFan9cFr go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181025213731-e84da0312774/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -589,7 +575,6 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISg golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180112015858-5ccada7d0a7b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -597,7 +582,6 @@ golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -609,7 +593,7 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI= @@ -622,7 +606,6 @@ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAG golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= @@ -633,7 +616,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180117170059-2c42eef0765b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -656,18 +638,16 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20171227012246-e19ae1496984/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20161028155119-f51c12702a4d/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= @@ -680,16 +660,16 @@ golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181122213734-04b5d21e00f1/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac h1:MQEvx39qSf8vyrx3XRaOe+j1UDIzKwkYOVObRgGPVqI= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191010075000-0337d82405ff h1:XdBG6es/oFDr1HwaxkxgVve7NB281QhxgK/i4voubFs= golang.org/x/tools v0.0.0-20191010075000-0337d82405ff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc= @@ -712,7 +692,6 @@ google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4 google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20170731182057-09f6ed296fc6/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -721,11 +700,9 @@ google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922/go.mod h1:L3J43x8/ google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873 h1:nfPFGzJkUDX6uBmpN/pSw7MbOAWegH5QDQuoXFHedLg= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -734,6 +711,7 @@ google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiq google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -743,78 +721,81 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/natefinch/lumberjack.v2 v2.0.0-20150622162204-20b71e5b60d7/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/square/go-jose.v2 v2.0.0-20180411045311-89060dee6a84/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 h1:yiW+nvdHb9LVqSHQBXfZCieqV4fzYhNBql77zY0ykqs= gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk= -gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.0.0/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20190905181640-827449938966 h1:B0J02caTR6tpSJozBJyiAzT6CtBzjclw4pgm9gg8Ys0= +gopkg.in/yaml.v3 v3.0.0-20190905181640-827449938966/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.0.0-20190918155943-95b840bb6a1f/go.mod h1:uWuOHnjmNrtQomJrvEBg0c0HRNyQ+8KTEERVsK0PW48= -k8s.io/api v0.15.13-beta.0/go.mod h1:+1kF7Ndo0iNY7nYyy00GQfUzc0GD47sOCCHfc+VrG+A= +k8s.io/api v0.17.0/go.mod h1:npsyOePkeP0CPwyGfXDHxvypiYMJxBWAMpQxCaJ4ZxI= k8s.io/api v0.17.4 h1:HbwOhDapkguO8lTAE8OX3hdF2qp8GtpC9CW/MQATXXo= k8s.io/api v0.17.4/go.mod h1:5qxx6vjmwUVG2nHQTKGlLts8Tbok8PzHl4vHtVFuZCA= -k8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783 h1:V6ndwCPoao1yZ52agqOKaUAl7DYWVGiXjV7ePA2i610= -k8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783/go.mod h1:xvae1SZB3E17UpV59AWc271W/Ph25N+bjPyR63X6tPY= -k8s.io/apiextensions-apiserver v0.15.13-beta.0 h1:93aYQv+jULkI8nADhO6U/E7hx5/y8H2+z0+QP9z21e0= -k8s.io/apiextensions-apiserver v0.15.13-beta.0/go.mod h1:KkBcmXslKHxQEbZq2InnXuoIzEXcHQNnhc5ODknYNpQ= -k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655/go.mod h1:nL6pwRT8NgfF8TT68DBI8uEePRt89cSvoXUVqbkWHq4= -k8s.io/apimachinery v0.15.13-beta.0/go.mod h1:ZRw+v83FjgEqlzqaBkxL3XB21MSLYdzjsY9Bgxclhdw= +k8s.io/api v0.18.0/go.mod h1:q2HRQkfDzHMBZL9l/y9rH63PkQl4vae0xRT+8prbrK8= +k8s.io/api v0.18.3 h1:2AJaUQdgUZLoDZHrun21PW2Nx9+ll6cUzvn3IKhSIn0= +k8s.io/api v0.18.3/go.mod h1:UOaMwERbqJMfeeeHc8XJKawj4P9TgDRnViIqqBeH2QA= +k8s.io/apiextensions-apiserver v0.17.0/go.mod h1:XiIFUakZywkUl54fVXa7QTEHcqQz9HG55nHd1DCoHj8= +k8s.io/apiextensions-apiserver v0.18.0 h1:HN4/P8vpGZFvB5SOMuPPH2Wt9Y/ryX+KRvIyAkchu1Q= +k8s.io/apiextensions-apiserver v0.18.0/go.mod h1:18Cwn1Xws4xnWQNC00FLq1E350b9lUF+aOdIWDOZxgo= +k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= k8s.io/apimachinery v0.17.4 h1:UzM+38cPUJnzqSQ+E1PY4YxMHIzQyCg29LOoGfo79Zw= k8s.io/apimachinery v0.17.4/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g= -k8s.io/apiserver v0.0.0-20190918160949-bfa5e2e684ad/go.mod h1:XPCXEwhjaFN29a8NldXA901ElnKeKLrLtREO9ZhFyhg= -k8s.io/apiserver v0.15.13-beta.0/go.mod h1:vg2xmRT7N2Vc5raRkoocisRrZ6YxbOFH9V5vikvpSIs= +k8s.io/apimachinery v0.18.0/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= +k8s.io/apimachinery v0.18.3 h1:pOGcbVAhxADgUYnjS08EFXs9QMl8qaH5U4fr5LGUrSk= +k8s.io/apimachinery v0.18.3/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko= +k8s.io/apiserver v0.17.0/go.mod h1:ABM+9x/prjINN6iiffRVNCBR2Wk7uY4z+EtEGZD48cg= +k8s.io/apiserver v0.18.0/go.mod h1:3S2O6FeBBd6XTo0njUrLxiqk8GNy6wWOftjhJcXYnjw= k8s.io/cli-runtime v0.17.4 h1:ZIJdxpBEszZqUhydrCoiI5rLXS2J/1AF5xFok2QJ9bc= k8s.io/cli-runtime v0.17.4/go.mod h1:IVW4zrKKx/8gBgNNkhiUIc7nZbVVNhc1+HcQh+PiNHc= -k8s.io/client-go v0.0.0-20190918160344-1fbdaa4c8d90/go.mod h1:J69/JveO6XESwVgG53q3Uz5OSfgsv4uxpScmmyYOOlk= -k8s.io/client-go v0.15.13-beta.0/go.mod h1:9XtkiHBbhymSjORqMaTYBK5RZHB/GIVGJyvHwa0j0dc= +k8s.io/cli-runtime v0.18.0 h1:jG8XpSqQ5TrV0N+EZ3PFz6+gqlCk71dkggWCCq9Mq34= +k8s.io/cli-runtime v0.18.0/go.mod h1:1eXfmBsIJosjn9LjEBUd2WVPoPAY9XGTqTFcPMIBsUQ= +k8s.io/client-go v0.17.0/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k= k8s.io/client-go v0.17.4 h1:VVdVbpTY70jiNHS1eiFkUt7ZIJX3txd29nDxxXH4en8= k8s.io/client-go v0.17.4/go.mod h1:ouF6o5pz3is8qU0/qYL2RnoxOPqgfuidYLowytyLJmc= -k8s.io/code-generator v0.0.0-20190912054826-cd179ad6a269/go.mod h1:V5BD6M4CyaN5m+VthcclXWsVcT1Hu+glwa1bi3MIsyE= -k8s.io/code-generator v0.15.13-beta.0/go.mod h1:G8bQwmHm2eafm5bgtX67XDZQ8CWKSGu9DekI+yN4Y5I= -k8s.io/component-base v0.0.0-20190918160511-547f6c5d7090/go.mod h1:933PBGtQFJky3TEwYx4aEPZ4IxqhWh3R6DCmzqIn1hA= -k8s.io/component-base v0.15.13-beta.0/go.mod h1:WcXA0ZW/d3OKjhx6zM6SsCPEbxP1FnBKa7SviwJrLGY= -k8s.io/gengo v0.0.0-20190116091435-f8a0810f38af/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/client-go v0.18.0 h1:yqKw4cTUQraZK3fcVCMeSa+lqKwcjZ5wtcOIPnxQno4= +k8s.io/client-go v0.18.0/go.mod h1:uQSYDYs4WhVZ9i6AIoEZuwUggLVEF64HOD37boKAtF8= +k8s.io/code-generator v0.17.0/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s= +k8s.io/code-generator v0.18.0 h1:0xIRWzym+qMgVpGmLESDeMfz/orwgxwxFFAo1xfGNtQ= +k8s.io/code-generator v0.18.0/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= +k8s.io/code-generator v0.18.3-beta.0 h1:OIi8tEf8j3ppkJP8pyV9whXqnmdon4okY9GjQnbU0dc= +k8s.io/code-generator v0.18.3-beta.0/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= +k8s.io/component-base v0.17.0/go.mod h1:rKuRAokNMY2nn2A6LP/MiwpoaMRHpfRnrPaUJJj1Yoc= +k8s.io/component-base v0.18.0/go.mod h1:u3BCg0z1uskkzrnAKFzulmYaEpZF7XC9Pf/uFyb1v2c= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/gengo v0.0.0-20190822140433-26a664648505 h1:ZY6yclUKVbZ+SdWnkfY+Je5vrMpKOxmGeKRbsXVmqYM= k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 h1:RPscN6KhmG54S33L+lr3GS+oD1jmchIU0ll519K6FA4= +k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v0.3.1/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v0.4.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= -k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc= -k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a h1:UcxjrRMyNx/i/y8G7kPvLyy7rfbeuf1PYyBf973pgyU= k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= -k8s.io/utils v0.0.0-20190221042446-c2654d5206da/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0= -k8s.io/utils v0.0.0-20190801114015-581e00157fb1/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= +k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 h1:Oh3Mzx5pJ+yIumsAD0MOECPVeXsVot0UkiaCGVyfGQY= +k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/utils v0.0.0-20191114184206-e782cd3c129f h1:GiPwtSzdP43eI1hpPCbROQCCIgCuiMMNF8YUVLF3vJo= k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU= @@ -824,17 +805,19 @@ modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= -sigs.k8s.io/controller-runtime v0.4.0 h1:wATM6/m+3w8lj8FXNaO6Fs/rq/vqoOjO1Q116Z9NPsg= -sigs.k8s.io/controller-runtime v0.4.0/go.mod h1:ApC79lpY3PHW9xj/w9pj+lYkLgwAAUZwfXkME1Lajns= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.7/go.mod h1:PHgbrJT7lCHcxMU+mDHEm+nx46H4zuuHZkDP6icnhu0= +sigs.k8s.io/controller-runtime v0.5.1-0.20200402191424-df180accb901 h1:qwHvTyQQBjATQeKPdJ0TwcXdtScjyI6GuiAQ5CSqEvM= +sigs.k8s.io/controller-runtime v0.5.1-0.20200402191424-df180accb901/go.mod h1:j4echH3Y/UPHRpXS65rxGXujda8iWOheMQvDh1uNgaY= +sigs.k8s.io/controller-tools v0.2.8 h1:UmYsnu89dn8/wBhjKL3lkGyaDGRnPDYUx2+iwXRnylA= +sigs.k8s.io/controller-tools v0.2.8/go.mod h1:9VKHPszmf2DHz/QmHkcfZoewO6BL7pPs9uAiBVsaJSE= sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0= sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= -sigs.k8s.io/structured-merge-diff v0.0.0-20190302045857-e85c7b244fd2/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= -sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca h1:6dsH6AYQWbyZmtttJNe8Gq1cXOeS1BdV3eW37zHilAQ= -sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca/go.mod h1:IIgPezJWb76P0hotTxzDbWsMYB8APh18qZnxkomBpxA= +sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06 h1:zD2IemQ4LmOcAumeiyDWXKUI2SO0NYDe3H6QGvPOVgU= +sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06/go.mod h1:/ULNhyfzRopfcjskuui0cTITekDduZ7ycKN3oUT9R18= sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= -sigs.k8s.io/testing_frameworks v0.1.2 h1:vK0+tvjF0BZ/RYFeZ1E6BYBwHJJXhjuZ3TdsEKH+UQM= -sigs.k8s.io/testing_frameworks v0.1.2/go.mod h1:ToQrwSC3s8Xf/lADdZp3Mktcql9CG0UAmdJG9th5i0w= +sigs.k8s.io/structured-merge-diff/v3 v3.0.0 h1:dOmIZBMfhcHS09XZkMyUgkq5trg3/jRyJYFZUiaOp8E= +sigs.k8s.io/structured-merge-diff/v3 v3.0.0/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= diff --git a/pkg/analyze/download.go b/pkg/analyze/download.go index 2c40617e..c24602e0 100644 --- a/pkg/analyze/download.go +++ b/pkg/analyze/download.go @@ -20,6 +20,26 @@ type fileContentProvider struct { rootDir string } +// Analyze local will analyze a locally available (already downloaded) bundle +func AnalyzeLocal(localBundlePath string, analyzers []*troubleshootv1beta1.Analyze) ([]*AnalyzeResult, error) { + fcp := fileContentProvider{rootDir: localBundlePath} + + analyzeResults := []*AnalyzeResult{} + for _, analyzer := range analyzers { + analyzeResult, err := Analyze(analyzer, fcp.getFileContents, fcp.getChildFileContents) + if err != nil { + logger.Printf("an analyzer failed to run: %v\n", err) + continue + } + + if analyzeResult != nil { + analyzeResults = append(analyzeResults, analyzeResult) + } + } + + return analyzeResults, nil +} + func DownloadAndAnalyze(bundleURL string, analyzersSpec string) ([]*AnalyzeResult, error) { tmpDir, err := ioutil.TempDir("", "troubleshoot-k8s") if err != nil { @@ -52,22 +72,7 @@ func DownloadAndAnalyze(bundleURL string, analyzersSpec string) ([]*AnalyzeResul analyzers = parsedAnalyzers } - fcp := fileContentProvider{rootDir: tmpDir} - - analyzeResults := []*AnalyzeResult{} - for _, analyzer := range analyzers { - analyzeResult, err := Analyze(analyzer, fcp.getFileContents, fcp.getChildFileContents) - if err != nil { - logger.Printf("an analyzer failed to run: %v\n", err) - continue - } - - if analyzeResult != nil { - analyzeResults = append(analyzeResults, analyzeResult) - } - } - - return analyzeResults, nil + return AnalyzeLocal(tmpDir, analyzers) } func downloadTroubleshootBundle(bundleURL string, destDir string) error { @@ -77,7 +82,7 @@ func downloadTroubleshootBundle(bundleURL string, destDir string) error { return errors.Wrap(err, "failed to open support bundle") } defer f.Close() - return extractTroubleshootBundle(f, destDir) + return ExtractTroubleshootBundle(f, destDir) } pwd, err := os.Getwd() @@ -85,7 +90,7 @@ func downloadTroubleshootBundle(bundleURL string, destDir string) error { return errors.Wrap(err, "failed to get workdir") } - tmpDir, err := ioutil.TempDir("", "getter") + tmpDir, err := ioutil.TempDir("", "troubleshoot") if err != nil { return errors.Wrap(err, "failed to create tmp dir") } @@ -107,10 +112,10 @@ func downloadTroubleshootBundle(bundleURL string, destDir string) error { } defer f.Close() - return extractTroubleshootBundle(f, destDir) + return ExtractTroubleshootBundle(f, destDir) } -func extractTroubleshootBundle(reader io.Reader, destDir string) error { +func ExtractTroubleshootBundle(reader io.Reader, destDir string) error { gzReader, err := gzip.NewReader(reader) if err != nil { return errors.Wrap(err, "failed to create gzip reader") diff --git a/pkg/apis/troubleshoot/v1beta1/supportbundle_types.go b/pkg/apis/troubleshoot/v1beta1/supportbundle_types.go new file mode 100644 index 00000000..fce1d7e1 --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta1/supportbundle_types.go @@ -0,0 +1,60 @@ +/* +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. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// SupportBundleSpec defines the desired state of SupportBundle +type SupportBundleSpec struct { + AfterCollection []*AfterCollection `json:"afterCollection,omitempty" yaml:"afterCollection,omitempty"` + Collectors []*Collect `json:"collectors,omitempty" yaml:"collectors,omitempty"` + Analyzers []*Analyze `json:"analyzers,omitempty" yaml:"analyzers,omitempty"` +} + +// SupportBundleStatus defines the observed state of SupportBundle +type SupportBundleStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// SupportBundle is the Schema for the SupportBundles API +// +k8s:openapi-gen=true +type SupportBundle struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Spec SupportBundleSpec `json:"spec,omitempty" yaml:"spec,omitempty"` + Status SupportBundleStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// SupportBundleList contains a list of SupportBundle +type SupportBundleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []SupportBundle `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SupportBundle{}, &SupportBundleList{}) +} diff --git a/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go b/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go index 6b41a37e..da9a6c0b 100644 --- a/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go @@ -1428,6 +1428,128 @@ func (in *StorageClass) DeepCopy() *StorageClass { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportBundle) DeepCopyInto(out *SupportBundle) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundle. +func (in *SupportBundle) DeepCopy() *SupportBundle { + if in == nil { + return nil + } + out := new(SupportBundle) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SupportBundle) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportBundleList) DeepCopyInto(out *SupportBundleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SupportBundle, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundleList. +func (in *SupportBundleList) DeepCopy() *SupportBundleList { + if in == nil { + return nil + } + out := new(SupportBundleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SupportBundleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportBundleSpec) DeepCopyInto(out *SupportBundleSpec) { + *out = *in + if in.AfterCollection != nil { + in, out := &in.AfterCollection, &out.AfterCollection + *out = make([]*AfterCollection, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(AfterCollection) + (*in).DeepCopyInto(*out) + } + } + } + if in.Collectors != nil { + in, out := &in.Collectors, &out.Collectors + *out = make([]*Collect, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Collect) + (*in).DeepCopyInto(*out) + } + } + } + if in.Analyzers != nil { + in, out := &in.Analyzers, &out.Analyzers + *out = make([]*Analyze, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Analyze) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundleSpec. +func (in *SupportBundleSpec) DeepCopy() *SupportBundleSpec { + if in == nil { + return nil + } + out := new(SupportBundleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportBundleStatus) DeepCopyInto(out *SupportBundleStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundleStatus. +func (in *SupportBundleStatus) DeepCopy() *SupportBundleStatus { + if in == nil { + return nil + } + out := new(SupportBundleStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SupportBundleVersion) DeepCopyInto(out *SupportBundleVersion) { *out = *in diff --git a/pkg/client/troubleshootclientset/clientset.go b/pkg/client/troubleshootclientset/clientset.go index dd1b3e4e..d841b606 100644 --- a/pkg/client/troubleshootclientset/clientset.go +++ b/pkg/client/troubleshootclientset/clientset.go @@ -58,7 +58,7 @@ 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") + 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) } diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzer.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzer.go index 2950c600..01541219 100644 --- a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzer.go +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzer.go @@ -18,6 +18,7 @@ limitations under the License. package v1beta1 import ( + "context" "time" v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" @@ -36,15 +37,15 @@ type AnalyzersGetter interface { // AnalyzerInterface has methods to work with Analyzer resources. type AnalyzerInterface interface { - Create(*v1beta1.Analyzer) (*v1beta1.Analyzer, error) - Update(*v1beta1.Analyzer) (*v1beta1.Analyzer, error) - UpdateStatus(*v1beta1.Analyzer) (*v1beta1.Analyzer, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1beta1.Analyzer, error) - List(opts v1.ListOptions) (*v1beta1.AnalyzerList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Analyzer, err error) + 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 } @@ -63,20 +64,20 @@ func newAnalyzers(c *TroubleshootV1beta1Client, namespace string) *analyzers { } // Get takes name of the analyzer, and returns the corresponding analyzer object, and an error if there is any. -func (c *analyzers) Get(name string, options v1.GetOptions) (result *v1beta1.Analyzer, err error) { +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(). + 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(opts v1.ListOptions) (result *v1beta1.AnalyzerList, err error) { +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 @@ -87,13 +88,13 @@ func (c *analyzers) List(opts v1.ListOptions) (result *v1beta1.AnalyzerList, err Resource("analyzers"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Do(). + Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested analyzers. -func (c *analyzers) Watch(opts v1.ListOptions) (watch.Interface, error) { +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 @@ -104,87 +105,90 @@ func (c *analyzers) Watch(opts v1.ListOptions) (watch.Interface, error) { Resource("analyzers"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Watch() + 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(analyzer *v1beta1.Analyzer) (result *v1beta1.Analyzer, err error) { +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(). + 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(analyzer *v1beta1.Analyzer) (result *v1beta1.Analyzer, err error) { +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(). + 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(analyzer *v1beta1.Analyzer) (result *v1beta1.Analyzer, err error) { +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(). + Do(ctx). Into(result) return } // Delete takes name of the analyzer and deletes it. Returns an error if one occurs. -func (c *analyzers) Delete(name string, options *v1.DeleteOptions) error { +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(options). - Do(). + Body(&opts). + Do(ctx). Error() } // DeleteCollection deletes a collection of objects. -func (c *analyzers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { +func (c *analyzers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). Resource("analyzers"). - VersionedParams(&listOptions, scheme.ParameterCodec). + VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). - Body(options). - Do(). + Body(&opts). + Do(ctx). Error() } // Patch applies the patch and returns the patched analyzer. -func (c *analyzers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Analyzer, err error) { +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"). - SubResource(subresources...). Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). Body(data). - Do(). + Do(ctx). Into(result) return } diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collector.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collector.go index a36ed680..cb814c4d 100644 --- a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collector.go +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collector.go @@ -18,6 +18,7 @@ limitations under the License. package v1beta1 import ( + "context" "time" v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" @@ -36,15 +37,15 @@ type CollectorsGetter interface { // CollectorInterface has methods to work with Collector resources. type CollectorInterface interface { - Create(*v1beta1.Collector) (*v1beta1.Collector, error) - Update(*v1beta1.Collector) (*v1beta1.Collector, error) - UpdateStatus(*v1beta1.Collector) (*v1beta1.Collector, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1beta1.Collector, error) - List(opts v1.ListOptions) (*v1beta1.CollectorList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Collector, err error) + 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 } @@ -63,20 +64,20 @@ func newCollectors(c *TroubleshootV1beta1Client, namespace string) *collectors { } // Get takes name of the collector, and returns the corresponding collector object, and an error if there is any. -func (c *collectors) Get(name string, options v1.GetOptions) (result *v1beta1.Collector, err error) { +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(). + 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(opts v1.ListOptions) (result *v1beta1.CollectorList, err error) { +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 @@ -87,13 +88,13 @@ func (c *collectors) List(opts v1.ListOptions) (result *v1beta1.CollectorList, e Resource("collectors"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Do(). + Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested collectors. -func (c *collectors) Watch(opts v1.ListOptions) (watch.Interface, error) { +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 @@ -104,87 +105,90 @@ func (c *collectors) Watch(opts v1.ListOptions) (watch.Interface, error) { Resource("collectors"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Watch() + 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(collector *v1beta1.Collector) (result *v1beta1.Collector, err error) { +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(). + 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(collector *v1beta1.Collector) (result *v1beta1.Collector, err error) { +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(). + 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(collector *v1beta1.Collector) (result *v1beta1.Collector, err error) { +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(). + Do(ctx). Into(result) return } // Delete takes name of the collector and deletes it. Returns an error if one occurs. -func (c *collectors) Delete(name string, options *v1.DeleteOptions) error { +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(options). - Do(). + Body(&opts). + Do(ctx). Error() } // DeleteCollection deletes a collection of objects. -func (c *collectors) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { +func (c *collectors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). Resource("collectors"). - VersionedParams(&listOptions, scheme.ParameterCodec). + VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). - Body(options). - Do(). + Body(&opts). + Do(ctx). Error() } // Patch applies the patch and returns the patched collector. -func (c *collectors) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Collector, err error) { +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"). - SubResource(subresources...). Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). Body(data). - Do(). + Do(ctx). Into(result) return } diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzer.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzer.go index 9d640515..ec566758 100644 --- a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzer.go +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzer.go @@ -18,6 +18,8 @@ limitations under the License. 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" @@ -38,7 +40,7 @@ var analyzersResource = schema.GroupVersionResource{Group: "troubleshoot.replica 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(name string, options v1.GetOptions) (result *v1beta1.Analyzer, err error) { +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{}) @@ -49,7 +51,7 @@ func (c *FakeAnalyzers) Get(name string, options v1.GetOptions) (result *v1beta1 } // List takes label and field selectors, and returns the list of Analyzers that match those selectors. -func (c *FakeAnalyzers) List(opts v1.ListOptions) (result *v1beta1.AnalyzerList, err error) { +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{}) @@ -71,14 +73,14 @@ func (c *FakeAnalyzers) List(opts v1.ListOptions) (result *v1beta1.AnalyzerList, } // Watch returns a watch.Interface that watches the requested analyzers. -func (c *FakeAnalyzers) Watch(opts v1.ListOptions) (watch.Interface, error) { +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(analyzer *v1beta1.Analyzer) (result *v1beta1.Analyzer, err error) { +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{}) @@ -89,7 +91,7 @@ func (c *FakeAnalyzers) Create(analyzer *v1beta1.Analyzer) (result *v1beta1.Anal } // 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(analyzer *v1beta1.Analyzer) (result *v1beta1.Analyzer, err error) { +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{}) @@ -101,7 +103,7 @@ func (c *FakeAnalyzers) Update(analyzer *v1beta1.Analyzer) (result *v1beta1.Anal // 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(analyzer *v1beta1.Analyzer) (*v1beta1.Analyzer, error) { +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{}) @@ -112,7 +114,7 @@ func (c *FakeAnalyzers) UpdateStatus(analyzer *v1beta1.Analyzer) (*v1beta1.Analy } // Delete takes name of the analyzer and deletes it. Returns an error if one occurs. -func (c *FakeAnalyzers) Delete(name string, options *v1.DeleteOptions) error { +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{}) @@ -120,15 +122,15 @@ func (c *FakeAnalyzers) Delete(name string, options *v1.DeleteOptions) error { } // DeleteCollection deletes a collection of objects. -func (c *FakeAnalyzers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(analyzersResource, c.ns, listOptions) +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(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Analyzer, err error) { +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{}) diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collector.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collector.go index adabd949..8ea3d5ec 100644 --- a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collector.go +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collector.go @@ -18,6 +18,8 @@ limitations under the License. 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" @@ -38,7 +40,7 @@ var collectorsResource = schema.GroupVersionResource{Group: "troubleshoot.replic 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(name string, options v1.GetOptions) (result *v1beta1.Collector, err error) { +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{}) @@ -49,7 +51,7 @@ func (c *FakeCollectors) Get(name string, options v1.GetOptions) (result *v1beta } // List takes label and field selectors, and returns the list of Collectors that match those selectors. -func (c *FakeCollectors) List(opts v1.ListOptions) (result *v1beta1.CollectorList, err error) { +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{}) @@ -71,14 +73,14 @@ func (c *FakeCollectors) List(opts v1.ListOptions) (result *v1beta1.CollectorLis } // Watch returns a watch.Interface that watches the requested collectors. -func (c *FakeCollectors) Watch(opts v1.ListOptions) (watch.Interface, error) { +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(collector *v1beta1.Collector) (result *v1beta1.Collector, err error) { +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{}) @@ -89,7 +91,7 @@ func (c *FakeCollectors) Create(collector *v1beta1.Collector) (result *v1beta1.C } // 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(collector *v1beta1.Collector) (result *v1beta1.Collector, err error) { +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{}) @@ -101,7 +103,7 @@ func (c *FakeCollectors) Update(collector *v1beta1.Collector) (result *v1beta1.C // 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(collector *v1beta1.Collector) (*v1beta1.Collector, error) { +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{}) @@ -112,7 +114,7 @@ func (c *FakeCollectors) UpdateStatus(collector *v1beta1.Collector) (*v1beta1.Co } // Delete takes name of the collector and deletes it. Returns an error if one occurs. -func (c *FakeCollectors) Delete(name string, options *v1.DeleteOptions) error { +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{}) @@ -120,15 +122,15 @@ func (c *FakeCollectors) Delete(name string, options *v1.DeleteOptions) error { } // DeleteCollection deletes a collection of objects. -func (c *FakeCollectors) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(collectorsResource, c.ns, listOptions) +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(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Collector, err error) { +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{}) diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflight.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflight.go index 8f7147c2..9e272470 100644 --- a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflight.go +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflight.go @@ -18,6 +18,8 @@ limitations under the License. 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" @@ -38,7 +40,7 @@ var preflightsResource = schema.GroupVersionResource{Group: "troubleshoot.replic 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(name string, options v1.GetOptions) (result *v1beta1.Preflight, err error) { +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{}) @@ -49,7 +51,7 @@ func (c *FakePreflights) Get(name string, options v1.GetOptions) (result *v1beta } // List takes label and field selectors, and returns the list of Preflights that match those selectors. -func (c *FakePreflights) List(opts v1.ListOptions) (result *v1beta1.PreflightList, err error) { +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{}) @@ -71,14 +73,14 @@ func (c *FakePreflights) List(opts v1.ListOptions) (result *v1beta1.PreflightLis } // Watch returns a watch.Interface that watches the requested preflights. -func (c *FakePreflights) Watch(opts v1.ListOptions) (watch.Interface, error) { +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(preflight *v1beta1.Preflight) (result *v1beta1.Preflight, err error) { +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{}) @@ -89,7 +91,7 @@ func (c *FakePreflights) Create(preflight *v1beta1.Preflight) (result *v1beta1.P } // 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(preflight *v1beta1.Preflight) (result *v1beta1.Preflight, err error) { +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{}) @@ -101,7 +103,7 @@ func (c *FakePreflights) Update(preflight *v1beta1.Preflight) (result *v1beta1.P // 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(preflight *v1beta1.Preflight) (*v1beta1.Preflight, error) { +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{}) @@ -112,7 +114,7 @@ func (c *FakePreflights) UpdateStatus(preflight *v1beta1.Preflight) (*v1beta1.Pr } // Delete takes name of the preflight and deletes it. Returns an error if one occurs. -func (c *FakePreflights) Delete(name string, options *v1.DeleteOptions) error { +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{}) @@ -120,15 +122,15 @@ func (c *FakePreflights) Delete(name string, options *v1.DeleteOptions) error { } // DeleteCollection deletes a collection of objects. -func (c *FakePreflights) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(preflightsResource, c.ns, listOptions) +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(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Preflight, err error) { +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{}) diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_redactor.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_redactor.go index e914082a..3109c798 100644 --- a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_redactor.go +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_redactor.go @@ -18,6 +18,8 @@ limitations under the License. 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" @@ -38,7 +40,7 @@ var redactorsResource = schema.GroupVersionResource{Group: "troubleshoot.replica 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(name string, options v1.GetOptions) (result *v1beta1.Redactor, err error) { +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{}) @@ -49,7 +51,7 @@ func (c *FakeRedactors) Get(name string, options v1.GetOptions) (result *v1beta1 } // List takes label and field selectors, and returns the list of Redactors that match those selectors. -func (c *FakeRedactors) List(opts v1.ListOptions) (result *v1beta1.RedactorList, err error) { +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{}) @@ -71,14 +73,14 @@ func (c *FakeRedactors) List(opts v1.ListOptions) (result *v1beta1.RedactorList, } // Watch returns a watch.Interface that watches the requested redactors. -func (c *FakeRedactors) Watch(opts v1.ListOptions) (watch.Interface, error) { +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(redactor *v1beta1.Redactor) (result *v1beta1.Redactor, err error) { +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{}) @@ -89,7 +91,7 @@ func (c *FakeRedactors) Create(redactor *v1beta1.Redactor) (result *v1beta1.Reda } // 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(redactor *v1beta1.Redactor) (result *v1beta1.Redactor, err error) { +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{}) @@ -101,7 +103,7 @@ func (c *FakeRedactors) Update(redactor *v1beta1.Redactor) (result *v1beta1.Reda // 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(redactor *v1beta1.Redactor) (*v1beta1.Redactor, error) { +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{}) @@ -112,7 +114,7 @@ func (c *FakeRedactors) UpdateStatus(redactor *v1beta1.Redactor) (*v1beta1.Redac } // Delete takes name of the redactor and deletes it. Returns an error if one occurs. -func (c *FakeRedactors) Delete(name string, options *v1.DeleteOptions) error { +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{}) @@ -120,15 +122,15 @@ func (c *FakeRedactors) Delete(name string, options *v1.DeleteOptions) error { } // DeleteCollection deletes a collection of objects. -func (c *FakeRedactors) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(redactorsResource, c.ns, listOptions) +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(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Redactor, err error) { +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{}) diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_supportbundle.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_supportbundle.go new file mode 100644 index 00000000..6b4b8e49 --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_supportbundle.go @@ -0,0 +1,141 @@ +/* +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 +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_troubleshoot_client.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_troubleshoot_client.go index bcea4dc7..5f76d3ee 100644 --- a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_troubleshoot_client.go +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_troubleshoot_client.go @@ -43,6 +43,10 @@ func (c *FakeTroubleshootV1beta1) Redactors(namespace string) v1beta1.RedactorIn 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 { diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/generated_expansion.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/generated_expansion.go index fa367f6e..a83babe3 100644 --- a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/generated_expansion.go +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/generated_expansion.go @@ -24,3 +24,5 @@ type CollectorExpansion interface{} type PreflightExpansion interface{} type RedactorExpansion interface{} + +type SupportBundleExpansion interface{} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflight.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflight.go index 6bc85f13..774c77fc 100644 --- a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflight.go +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflight.go @@ -18,6 +18,7 @@ limitations under the License. package v1beta1 import ( + "context" "time" v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" @@ -36,15 +37,15 @@ type PreflightsGetter interface { // PreflightInterface has methods to work with Preflight resources. type PreflightInterface interface { - Create(*v1beta1.Preflight) (*v1beta1.Preflight, error) - Update(*v1beta1.Preflight) (*v1beta1.Preflight, error) - UpdateStatus(*v1beta1.Preflight) (*v1beta1.Preflight, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1beta1.Preflight, error) - List(opts v1.ListOptions) (*v1beta1.PreflightList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Preflight, err error) + 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 } @@ -63,20 +64,20 @@ func newPreflights(c *TroubleshootV1beta1Client, namespace string) *preflights { } // Get takes name of the preflight, and returns the corresponding preflight object, and an error if there is any. -func (c *preflights) Get(name string, options v1.GetOptions) (result *v1beta1.Preflight, err error) { +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(). + 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(opts v1.ListOptions) (result *v1beta1.PreflightList, err error) { +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 @@ -87,13 +88,13 @@ func (c *preflights) List(opts v1.ListOptions) (result *v1beta1.PreflightList, e Resource("preflights"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Do(). + Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested preflights. -func (c *preflights) Watch(opts v1.ListOptions) (watch.Interface, error) { +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 @@ -104,87 +105,90 @@ func (c *preflights) Watch(opts v1.ListOptions) (watch.Interface, error) { Resource("preflights"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Watch() + 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(preflight *v1beta1.Preflight) (result *v1beta1.Preflight, err error) { +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(). + 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(preflight *v1beta1.Preflight) (result *v1beta1.Preflight, err error) { +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(). + 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(preflight *v1beta1.Preflight) (result *v1beta1.Preflight, err error) { +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(). + Do(ctx). Into(result) return } // Delete takes name of the preflight and deletes it. Returns an error if one occurs. -func (c *preflights) Delete(name string, options *v1.DeleteOptions) error { +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(options). - Do(). + Body(&opts). + Do(ctx). Error() } // DeleteCollection deletes a collection of objects. -func (c *preflights) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { +func (c *preflights) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). Resource("preflights"). - VersionedParams(&listOptions, scheme.ParameterCodec). + VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). - Body(options). - Do(). + Body(&opts). + Do(ctx). Error() } // Patch applies the patch and returns the patched preflight. -func (c *preflights) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Preflight, err error) { +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"). - SubResource(subresources...). Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). Body(data). - Do(). + Do(ctx). Into(result) return } diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/redactor.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/redactor.go index 5a244e4a..f8df5b26 100644 --- a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/redactor.go +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/redactor.go @@ -18,6 +18,7 @@ limitations under the License. package v1beta1 import ( + "context" "time" v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" @@ -36,15 +37,15 @@ type RedactorsGetter interface { // RedactorInterface has methods to work with Redactor resources. type RedactorInterface interface { - Create(*v1beta1.Redactor) (*v1beta1.Redactor, error) - Update(*v1beta1.Redactor) (*v1beta1.Redactor, error) - UpdateStatus(*v1beta1.Redactor) (*v1beta1.Redactor, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1beta1.Redactor, error) - List(opts v1.ListOptions) (*v1beta1.RedactorList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Redactor, err error) + 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 } @@ -63,20 +64,20 @@ func newRedactors(c *TroubleshootV1beta1Client, namespace string) *redactors { } // Get takes name of the redactor, and returns the corresponding redactor object, and an error if there is any. -func (c *redactors) Get(name string, options v1.GetOptions) (result *v1beta1.Redactor, err error) { +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(). + 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(opts v1.ListOptions) (result *v1beta1.RedactorList, err error) { +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 @@ -87,13 +88,13 @@ func (c *redactors) List(opts v1.ListOptions) (result *v1beta1.RedactorList, err Resource("redactors"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Do(). + Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested redactors. -func (c *redactors) Watch(opts v1.ListOptions) (watch.Interface, error) { +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 @@ -104,87 +105,90 @@ func (c *redactors) Watch(opts v1.ListOptions) (watch.Interface, error) { Resource("redactors"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Watch() + 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(redactor *v1beta1.Redactor) (result *v1beta1.Redactor, err error) { +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(). + 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(redactor *v1beta1.Redactor) (result *v1beta1.Redactor, err error) { +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(). + 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(redactor *v1beta1.Redactor) (result *v1beta1.Redactor, err error) { +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(). + Do(ctx). Into(result) return } // Delete takes name of the redactor and deletes it. Returns an error if one occurs. -func (c *redactors) Delete(name string, options *v1.DeleteOptions) error { +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(options). - Do(). + Body(&opts). + Do(ctx). Error() } // DeleteCollection deletes a collection of objects. -func (c *redactors) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { +func (c *redactors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). Resource("redactors"). - VersionedParams(&listOptions, scheme.ParameterCodec). + VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). - Body(options). - Do(). + Body(&opts). + Do(ctx). Error() } // Patch applies the patch and returns the patched redactor. -func (c *redactors) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Redactor, err error) { +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"). - SubResource(subresources...). Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). Body(data). - Do(). + Do(ctx). Into(result) return } diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/supportbundle.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/supportbundle.go new file mode 100644 index 00000000..133b4c3a --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/supportbundle.go @@ -0,0 +1,194 @@ +/* +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 +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/troubleshoot_client.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/troubleshoot_client.go index 1287254f..8b5b3299 100644 --- a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/troubleshoot_client.go +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/troubleshoot_client.go @@ -29,6 +29,7 @@ type TroubleshootV1beta1Interface interface { CollectorsGetter PreflightsGetter RedactorsGetter + SupportBundlesGetter } // TroubleshootV1beta1Client is used to interact with features provided by the troubleshoot.replicated.com group. @@ -52,6 +53,10 @@ func (c *TroubleshootV1beta1Client) Redactors(namespace string) RedactorInterfac 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 diff --git a/pkg/collect/cluster_info.go b/pkg/collect/cluster_info.go index 3cd61090..febf5bd1 100644 --- a/pkg/collect/cluster_info.go +++ b/pkg/collect/cluster_info.go @@ -13,8 +13,8 @@ type ClusterVersion struct { String string `json:"string"` } -func ClusterInfo(ctx *Context) (map[string][]byte, error) { - client, err := kubernetes.NewForConfig(ctx.ClientConfig) +func ClusterInfo(c *Collector) (map[string][]byte, error) { + client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, errors.Wrap(err, "Failed to create kubernetes clientset") } diff --git a/pkg/collect/cluster_resources.go b/pkg/collect/cluster_resources.go index 7b49f2db..ac47838f 100644 --- a/pkg/collect/cluster_resources.go +++ b/pkg/collect/cluster_resources.go @@ -1,6 +1,7 @@ package collect import ( + "context" "encoding/base64" "encoding/json" "fmt" @@ -15,17 +16,19 @@ import ( "k8s.io/client-go/kubernetes" ) -func ClusterResources(ctx *Context) (map[string][]byte, error) { - client, err := kubernetes.NewForConfig(ctx.ClientConfig) +func ClusterResources(c *Collector) (map[string][]byte, error) { + client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, err } + ctx := context.Background() + clusterResourcesOutput := map[string][]byte{} // namespaces var namespaceNames []string - if ctx.Namespace == "" { - namespaces, namespaceList, namespaceErrors := namespaces(client) + if c.Namespace == "" { + namespaces, namespaceList, namespaceErrors := namespaces(ctx, client) clusterResourcesOutput["cluster-resources/namespaces.json"] = namespaces clusterResourcesOutput["cluster-resources/namespaces-errors.json"], err = marshalNonNil(namespaceErrors) if err != nil { @@ -37,15 +40,15 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { } } } else { - namespaces, namespaceErrors := getNamespace(client, ctx.Namespace) + namespaces, namespaceErrors := getNamespace(ctx, client, c.Namespace) clusterResourcesOutput["cluster-resources/namespaces.json"] = namespaces clusterResourcesOutput["cluster-resources/namespaces-errors.json"], err = marshalNonNil(namespaceErrors) if err != nil { return nil, err } - namespaceNames = append(namespaceNames, ctx.Namespace) + namespaceNames = append(namespaceNames, c.Namespace) } - pods, podErrors := pods(client, namespaceNames) + pods, podErrors := pods(ctx, client, namespaceNames) for k, v := range pods { clusterResourcesOutput[path.Join("cluster-resources/pods", k)] = v } @@ -55,7 +58,7 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { } // services - services, servicesErrors := services(client, namespaceNames) + services, servicesErrors := services(ctx, client, namespaceNames) for k, v := range services { clusterResourcesOutput[path.Join("cluster-resources/services", k)] = v } @@ -65,7 +68,7 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { } // deployments - deployments, deploymentsErrors := deployments(client, namespaceNames) + deployments, deploymentsErrors := deployments(ctx, client, namespaceNames) for k, v := range deployments { clusterResourcesOutput[path.Join("cluster-resources/deployments", k)] = v } @@ -75,7 +78,7 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { } // statefulsets - statefulsets, statefulsetsErrors := statefulsets(client, namespaceNames) + statefulsets, statefulsetsErrors := statefulsets(ctx, client, namespaceNames) for k, v := range statefulsets { clusterResourcesOutput[path.Join("cluster-resources/statefulsets", k)] = v } @@ -85,7 +88,7 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { } // ingress - ingress, ingressErrors := ingress(client, namespaceNames) + ingress, ingressErrors := ingress(ctx, client, namespaceNames) for k, v := range ingress { clusterResourcesOutput[path.Join("cluster-resources/ingress", k)] = v } @@ -95,7 +98,7 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { } // storage classes - storageClasses, storageErrors := storageClasses(client) + storageClasses, storageErrors := storageClasses(ctx, client) clusterResourcesOutput["cluster-resources/storage-classes.json"] = storageClasses clusterResourcesOutput["cluster-resources/storage-errors.json"], err = marshalNonNil(storageErrors) if err != nil { @@ -103,11 +106,11 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { } // crds - crdClient, err := apiextensionsv1beta1clientset.NewForConfig(ctx.ClientConfig) + crdClient, err := apiextensionsv1beta1clientset.NewForConfig(c.ClientConfig) if err != nil { return nil, err } - customResourceDefinitions, crdErrors := crds(crdClient) + customResourceDefinitions, crdErrors := crds(ctx, crdClient) clusterResourcesOutput["cluster-resources/custom-resource-definitions.json"] = customResourceDefinitions clusterResourcesOutput["cluster-resources/custom-resource-definitions-errors.json"], err = marshalNonNil(crdErrors) if err != nil { @@ -115,7 +118,7 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { } // imagepullsecrets - imagePullSecrets, pullSecretsErrors := imagePullSecrets(client, namespaceNames) + imagePullSecrets, pullSecretsErrors := imagePullSecrets(ctx, client, namespaceNames) for k, v := range imagePullSecrets { clusterResourcesOutput[path.Join("cluster-resources/image-pull-secrets", k)] = v } @@ -125,14 +128,14 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { } // nodes - nodes, nodeErrors := nodes(client) + nodes, nodeErrors := nodes(ctx, client) clusterResourcesOutput["cluster-resources/nodes.json"] = nodes clusterResourcesOutput["cluster-resources/nodes-errors.json"], err = marshalNonNil(nodeErrors) if err != nil { return nil, err } - groups, resources, groupsResourcesErrors := apiResources(client) + groups, resources, groupsResourcesErrors := apiResources(ctx, client) clusterResourcesOutput["cluster-resources/groups.json"] = groups clusterResourcesOutput["cluster-resources/resources.json"] = resources clusterResourcesOutput["cluster-resources/groups-resources-errors.json"], err = marshalNonNil(groupsResourcesErrors) @@ -141,7 +144,7 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { } // limit ranges - limitRanges, limitRangesErrors := limitRanges(client, namespaceNames) + limitRanges, limitRangesErrors := limitRanges(ctx, client, namespaceNames) for k, v := range limitRanges { clusterResourcesOutput[path.Join("cluster-resources/limitranges", k)] = v } @@ -151,7 +154,7 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { } // auth cani - authCanI, authCanIErrors := authCanI(client, namespaceNames) + authCanI, authCanIErrors := authCanI(ctx, client, namespaceNames) for k, v := range authCanI { clusterResourcesOutput[path.Join("cluster-resources/auth-cani-list", k)] = v } @@ -163,8 +166,8 @@ func ClusterResources(ctx *Context) (map[string][]byte, error) { return clusterResourcesOutput, nil } -func namespaces(client *kubernetes.Clientset) ([]byte, *corev1.NamespaceList, []string) { - namespaces, err := client.CoreV1().Namespaces().List(metav1.ListOptions{}) +func namespaces(ctx context.Context, client *kubernetes.Clientset) ([]byte, *corev1.NamespaceList, []string) { + namespaces, err := client.CoreV1().Namespaces().List(ctx, metav1.ListOptions{}) if err != nil { return nil, nil, []string{err.Error()} } @@ -177,8 +180,8 @@ func namespaces(client *kubernetes.Clientset) ([]byte, *corev1.NamespaceList, [] return b, namespaces, nil } -func getNamespace(client *kubernetes.Clientset, namespace string) ([]byte, []string) { - namespaces, err := client.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{}) +func getNamespace(ctx context.Context, client *kubernetes.Clientset, namespace string) ([]byte, []string) { + namespaces, err := client.CoreV1().Namespaces().Get(ctx, namespace, metav1.GetOptions{}) if err != nil { return nil, []string{err.Error()} } @@ -191,12 +194,12 @@ func getNamespace(client *kubernetes.Clientset, namespace string) ([]byte, []str return b, nil } -func pods(client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { +func pods(ctx context.Context, client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { podsByNamespace := make(map[string][]byte) errorsByNamespace := make(map[string]string) for _, namespace := range namespaces { - pods, err := client.CoreV1().Pods(namespace).List(metav1.ListOptions{}) + pods, err := client.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{}) if err != nil { errorsByNamespace[namespace] = err.Error() continue @@ -214,12 +217,12 @@ func pods(client *kubernetes.Clientset, namespaces []string) (map[string][]byte, return podsByNamespace, errorsByNamespace } -func services(client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { +func services(ctx context.Context, client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { servicesByNamespace := make(map[string][]byte) errorsByNamespace := make(map[string]string) for _, namespace := range namespaces { - services, err := client.CoreV1().Services(namespace).List(metav1.ListOptions{}) + services, err := client.CoreV1().Services(namespace).List(ctx, metav1.ListOptions{}) if err != nil { errorsByNamespace[namespace] = err.Error() continue @@ -237,12 +240,12 @@ func services(client *kubernetes.Clientset, namespaces []string) (map[string][]b return servicesByNamespace, errorsByNamespace } -func deployments(client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { +func deployments(ctx context.Context, client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { deploymentsByNamespace := make(map[string][]byte) errorsByNamespace := make(map[string]string) for _, namespace := range namespaces { - deployments, err := client.AppsV1().Deployments(namespace).List(metav1.ListOptions{}) + deployments, err := client.AppsV1().Deployments(namespace).List(ctx, metav1.ListOptions{}) if err != nil { errorsByNamespace[namespace] = err.Error() continue @@ -260,12 +263,12 @@ func deployments(client *kubernetes.Clientset, namespaces []string) (map[string] return deploymentsByNamespace, errorsByNamespace } -func statefulsets(client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { +func statefulsets(ctx context.Context, client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { statefulsetsByNamespace := make(map[string][]byte) errorsByNamespace := make(map[string]string) for _, namespace := range namespaces { - statefulsets, err := client.AppsV1().StatefulSets(namespace).List(metav1.ListOptions{}) + statefulsets, err := client.AppsV1().StatefulSets(namespace).List(ctx, metav1.ListOptions{}) if err != nil { errorsByNamespace[namespace] = err.Error() continue @@ -283,12 +286,12 @@ func statefulsets(client *kubernetes.Clientset, namespaces []string) (map[string return statefulsetsByNamespace, errorsByNamespace } -func ingress(client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { +func ingress(ctx context.Context, client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { ingressByNamespace := make(map[string][]byte) errorsByNamespace := make(map[string]string) for _, namespace := range namespaces { - ingress, err := client.ExtensionsV1beta1().Ingresses(namespace).List(metav1.ListOptions{}) + ingress, err := client.ExtensionsV1beta1().Ingresses(namespace).List(ctx, metav1.ListOptions{}) if err != nil { errorsByNamespace[namespace] = err.Error() continue @@ -306,8 +309,8 @@ func ingress(client *kubernetes.Clientset, namespaces []string) (map[string][]by return ingressByNamespace, errorsByNamespace } -func storageClasses(client *kubernetes.Clientset) ([]byte, []string) { - storageClasses, err := client.StorageV1beta1().StorageClasses().List(metav1.ListOptions{}) +func storageClasses(ctx context.Context, client *kubernetes.Clientset) ([]byte, []string) { + storageClasses, err := client.StorageV1beta1().StorageClasses().List(ctx, metav1.ListOptions{}) if err != nil { return nil, []string{err.Error()} } @@ -320,8 +323,8 @@ func storageClasses(client *kubernetes.Clientset) ([]byte, []string) { return b, nil } -func crds(client *apiextensionsv1beta1clientset.ApiextensionsV1beta1Client) ([]byte, []string) { - crds, err := client.CustomResourceDefinitions().List(metav1.ListOptions{}) +func crds(ctx context.Context, client *apiextensionsv1beta1clientset.ApiextensionsV1beta1Client) ([]byte, []string) { + crds, err := client.CustomResourceDefinitions().List(ctx, metav1.ListOptions{}) if err != nil { return nil, []string{err.Error()} } @@ -334,7 +337,7 @@ func crds(client *apiextensionsv1beta1clientset.ApiextensionsV1beta1Client) ([]b return b, nil } -func imagePullSecrets(client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { +func imagePullSecrets(ctx context.Context, client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { imagePullSecrets := make(map[string][]byte) errors := make(map[string]string) @@ -347,7 +350,7 @@ func imagePullSecrets(client *kubernetes.Clientset, namespaces []string) (map[st } for _, namespace := range namespaces { - secrets, err := client.CoreV1().Secrets(namespace).List(metav1.ListOptions{}) + secrets, err := client.CoreV1().Secrets(namespace).List(ctx, metav1.ListOptions{}) if err != nil { errors[namespace] = err.Error() continue @@ -386,12 +389,12 @@ func imagePullSecrets(client *kubernetes.Clientset, namespaces []string) (map[st return imagePullSecrets, errors } -func limitRanges(client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { +func limitRanges(ctx context.Context, client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { limitRangesByNamespace := make(map[string][]byte) errorsByNamespace := make(map[string]string) for _, namespace := range namespaces { - limitRanges, err := client.CoreV1().LimitRanges(namespace).List(metav1.ListOptions{}) + limitRanges, err := client.CoreV1().LimitRanges(namespace).List(ctx, metav1.ListOptions{}) if err != nil { errorsByNamespace[namespace] = err.Error() continue @@ -409,8 +412,8 @@ func limitRanges(client *kubernetes.Clientset, namespaces []string) (map[string] return limitRangesByNamespace, errorsByNamespace } -func nodes(client *kubernetes.Clientset) ([]byte, []string) { - nodes, err := client.CoreV1().Nodes().List(metav1.ListOptions{}) +func nodes(ctx context.Context, client *kubernetes.Clientset) ([]byte, []string) { + nodes, err := client.CoreV1().Nodes().List(ctx, metav1.ListOptions{}) if err != nil { return nil, []string{err.Error()} } @@ -424,7 +427,7 @@ func nodes(client *kubernetes.Clientset) ([]byte, []string) { } // get the list of API resources, similar to 'kubectl api-resources' -func apiResources(client *kubernetes.Clientset) ([]byte, []byte, []string) { +func apiResources(ctx context.Context, client *kubernetes.Clientset) ([]byte, []byte, []string) { var errorArray []string groups, resources, err := client.Discovery().ServerGroupsAndResources() if err != nil { @@ -444,7 +447,7 @@ func apiResources(client *kubernetes.Clientset) ([]byte, []byte, []string) { return groupBytes, resourcesBytes, errorArray } -func authCanI(client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { +func authCanI(ctx context.Context, client *kubernetes.Clientset, namespaces []string) (map[string][]byte, map[string]string) { // https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/auth/cani.go authListByNamespace := make(map[string][]byte) @@ -456,7 +459,7 @@ func authCanI(client *kubernetes.Clientset, namespaces []string) (map[string][]b Namespace: namespace, }, } - response, err := client.AuthorizationV1().SelfSubjectRulesReviews().Create(sar) + response, err := client.AuthorizationV1().SelfSubjectRulesReviews().Create(ctx, sar, metav1.CreateOptions{}) if err != nil { errorsByNamespace[namespace] = err.Error() continue diff --git a/pkg/collect/collector.go b/pkg/collect/collector.go index a007a257..ce588aef 100644 --- a/pkg/collect/collector.go +++ b/pkg/collect/collector.go @@ -1,12 +1,14 @@ package collect import ( + "context" "strconv" "github.com/pkg/errors" troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" "github.com/replicatedhq/troubleshoot/pkg/multitype" authorizationv1 "k8s.io/api/authorization/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" ) @@ -21,12 +23,6 @@ type Collector struct { type Collectors []*Collector -type Context struct { - Redact bool - ClientConfig *rest.Config - Namespace string -} - func isExcluded(excludeVal multitype.BoolOrString) (bool, error) { if excludeVal.Type == multitype.Bool { return excludeVal.BoolVal, nil @@ -56,7 +52,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = ClusterInfo(c.GetContext()) + unRedacted, err = ClusterInfo(c) } else if c.Collect.ClusterResources != nil { isExcludedResult, err = isExcluded(c.Collect.ClusterResources.Exclude) if err != nil { @@ -65,7 +61,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = ClusterResources(c.GetContext()) + unRedacted, err = ClusterResources(c) } else if c.Collect.Secret != nil { isExcludedResult, err = isExcluded(c.Collect.Secret.Exclude) if err != nil { @@ -74,7 +70,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = Secret(c.GetContext(), c.Collect.Secret) + unRedacted, err = Secret(c, c.Collect.Secret) } else if c.Collect.Logs != nil { isExcludedResult, err = isExcluded(c.Collect.Logs.Exclude) if err != nil { @@ -83,7 +79,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = Logs(c.GetContext(), c.Collect.Logs) + unRedacted, err = Logs(c, c.Collect.Logs) } else if c.Collect.Run != nil { isExcludedResult, err = isExcluded(c.Collect.Run.Exclude) if err != nil { @@ -92,7 +88,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = Run(c.GetContext(), c.Collect.Run) + unRedacted, err = Run(c, c.Collect.Run) } else if c.Collect.Exec != nil { isExcludedResult, err = isExcluded(c.Collect.Exec.Exclude) if err != nil { @@ -101,7 +97,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = Exec(c.GetContext(), c.Collect.Exec) + unRedacted, err = Exec(c, c.Collect.Exec) } else if c.Collect.Data != nil { isExcludedResult, err = isExcluded(c.Collect.Data.Exclude) if err != nil { @@ -110,7 +106,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = Data(c.GetContext(), c.Collect.Data) + unRedacted, err = Data(c, c.Collect.Data) } else if c.Collect.Copy != nil { isExcludedResult, err = isExcluded(c.Collect.Copy.Exclude) if err != nil { @@ -119,7 +115,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = Copy(c.GetContext(), c.Collect.Copy) + unRedacted, err = Copy(c, c.Collect.Copy) } else if c.Collect.HTTP != nil { isExcludedResult, err = isExcluded(c.Collect.HTTP.Exclude) if err != nil { @@ -128,7 +124,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = HTTP(c.GetContext(), c.Collect.HTTP) + unRedacted, err = HTTP(c, c.Collect.HTTP) } else if c.Collect.Postgres != nil { isExcludedResult, err = isExcluded(c.Collect.Postgres.Exclude) if err != nil { @@ -137,7 +133,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = Postgres(c.GetContext(), c.Collect.Postgres) + unRedacted, err = Postgres(c, c.Collect.Postgres) } else if c.Collect.Mysql != nil { isExcludedResult, err = isExcluded(c.Collect.Mysql.Exclude) if err != nil { @@ -146,7 +142,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = Mysql(c.GetContext(), c.Collect.Mysql) + unRedacted, err = Mysql(c, c.Collect.Mysql) } else if c.Collect.Redis != nil { isExcludedResult, err = isExcluded(c.Collect.Redis.Exclude) if err != nil { @@ -155,7 +151,7 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Reda if isExcludedResult { return nil, nil } - unRedacted, err = Redis(c.GetContext(), c.Collect.Redis) + unRedacted, err = Redis(c, c.Collect.Redis) } else { return nil, errors.New("no spec found to run") } @@ -173,15 +169,7 @@ func (c *Collector) GetDisplayName() string { return c.Collect.GetName() } -func (c *Collector) GetContext() *Context { - return &Context{ - Redact: c.Redact, - ClientConfig: c.ClientConfig, - Namespace: c.Namespace, - } -} - -func (c *Collector) CheckRBAC() error { +func (c *Collector) CheckRBAC(ctx context.Context) error { client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return errors.Wrap(err, "failed to create client from config") @@ -196,7 +184,7 @@ func (c *Collector) CheckRBAC() error { Spec: spec, } - resp, err := client.AuthorizationV1().SelfSubjectAccessReviews().Create(sar) + resp, err := client.AuthorizationV1().SelfSubjectAccessReviews().Create(ctx, sar, metav1.CreateOptions{}) if err != nil { return errors.Wrap(err, "failed to run subject review") } @@ -215,9 +203,9 @@ func (c *Collector) CheckRBAC() error { return nil } -func (cs Collectors) CheckRBAC() error { +func (cs Collectors) CheckRBAC(ctx context.Context) error { for _, c := range cs { - if err := c.CheckRBAC(); err != nil { + if err := c.CheckRBAC(ctx); err != nil { return errors.Wrap(err, "failed to check RBAC") } } diff --git a/pkg/collect/copy.go b/pkg/collect/copy.go index d15fde03..a075bbf7 100644 --- a/pkg/collect/copy.go +++ b/pkg/collect/copy.go @@ -2,6 +2,7 @@ package collect import ( "bytes" + "context" "fmt" "path/filepath" @@ -12,15 +13,17 @@ import ( "k8s.io/client-go/tools/remotecommand" ) -func Copy(ctx *Context, copyCollector *troubleshootv1beta1.Copy) (map[string][]byte, error) { - client, err := kubernetes.NewForConfig(ctx.ClientConfig) +func Copy(c *Collector, copyCollector *troubleshootv1beta1.Copy) (map[string][]byte, error) { + client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, err } copyOutput := map[string][]byte{} - pods, podsErrors := listPodsInSelectors(client, copyCollector.Namespace, copyCollector.Selector) + ctx := context.Background() + + pods, podsErrors := listPodsInSelectors(ctx, client, copyCollector.Namespace, copyCollector.Selector) if len(podsErrors) > 0 { errorBytes, err := marshalNonNil(podsErrors) if err != nil { @@ -33,7 +36,7 @@ func Copy(ctx *Context, copyCollector *troubleshootv1beta1.Copy) (map[string][]b for _, pod := range pods { bundlePath := filepath.Join(copyCollector.Name, pod.Namespace, pod.Name, copyCollector.ContainerName) - files, copyErrors := copyFiles(ctx, client, pod, copyCollector) + files, copyErrors := copyFiles(c, client, pod, copyCollector) if len(copyErrors) > 0 { key := filepath.Join(bundlePath, copyCollector.ContainerPath+"-errors.json") copyOutput[key], err = marshalNonNil(copyErrors) @@ -52,7 +55,7 @@ func Copy(ctx *Context, copyCollector *troubleshootv1beta1.Copy) (map[string][]b return copyOutput, nil } -func copyFiles(ctx *Context, client *kubernetes.Clientset, pod corev1.Pod, copyCollector *troubleshootv1beta1.Copy) (map[string][]byte, map[string]string) { +func copyFiles(c *Collector, client *kubernetes.Clientset, pod corev1.Pod, copyCollector *troubleshootv1beta1.Copy) (map[string][]byte, map[string]string) { container := pod.Spec.Containers[0].Name if copyCollector.ContainerName != "" { container = copyCollector.ContainerName @@ -78,7 +81,7 @@ func copyFiles(ctx *Context, client *kubernetes.Clientset, pod corev1.Pod, copyC TTY: false, }, parameterCodec) - exec, err := remotecommand.NewSPDYExecutor(ctx.ClientConfig, "POST", req.URL()) + exec, err := remotecommand.NewSPDYExecutor(c.ClientConfig, "POST", req.URL()) if err != nil { return nil, map[string]string{ filepath.Join(copyCollector.ContainerPath, "error"): err.Error(), diff --git a/pkg/collect/data.go b/pkg/collect/data.go index 3895788f..3f52d4fa 100644 --- a/pkg/collect/data.go +++ b/pkg/collect/data.go @@ -6,7 +6,7 @@ import ( troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" ) -func Data(ctx *Context, dataCollector *troubleshootv1beta1.Data) (map[string][]byte, error) { +func Data(c *Collector, dataCollector *troubleshootv1beta1.Data) (map[string][]byte, error) { bundlePath := filepath.Join(dataCollector.Name, dataCollector.CollectorName) dataOutput := map[string][]byte{ bundlePath: []byte(dataCollector.Data), diff --git a/pkg/collect/exec.go b/pkg/collect/exec.go index 43e1b750..0eb81e5c 100644 --- a/pkg/collect/exec.go +++ b/pkg/collect/exec.go @@ -2,6 +2,7 @@ package collect import ( "bytes" + "context" "errors" "fmt" "path/filepath" @@ -14,9 +15,9 @@ import ( "k8s.io/client-go/tools/remotecommand" ) -func Exec(ctx *Context, execCollector *troubleshootv1beta1.Exec) (map[string][]byte, error) { +func Exec(c *Collector, execCollector *troubleshootv1beta1.Exec) (map[string][]byte, error) { if execCollector.Timeout == "" { - return execWithoutTimeout(ctx, execCollector) + return execWithoutTimeout(c, execCollector) } timeout, err := time.ParseDuration(execCollector.Timeout) @@ -28,7 +29,7 @@ func Exec(ctx *Context, execCollector *troubleshootv1beta1.Exec) (map[string][]b resultCh := make(chan map[string][]byte, 1) go func() { - b, err := execWithoutTimeout(ctx, execCollector) + b, err := execWithoutTimeout(c, execCollector) if err != nil { errCh <- err } else { @@ -46,15 +47,17 @@ func Exec(ctx *Context, execCollector *troubleshootv1beta1.Exec) (map[string][]b } } -func execWithoutTimeout(ctx *Context, execCollector *troubleshootv1beta1.Exec) (map[string][]byte, error) { - client, err := kubernetes.NewForConfig(ctx.ClientConfig) +func execWithoutTimeout(c *Collector, execCollector *troubleshootv1beta1.Exec) (map[string][]byte, error) { + client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, err } execOutput := map[string][]byte{} - pods, podsErrors := listPodsInSelectors(client, execCollector.Namespace, execCollector.Selector) + ctx := context.Background() + + pods, podsErrors := listPodsInSelectors(ctx, client, execCollector.Namespace, execCollector.Selector) if len(podsErrors) > 0 { errorBytes, err := marshalNonNil(podsErrors) if err != nil { @@ -65,7 +68,7 @@ func execWithoutTimeout(ctx *Context, execCollector *troubleshootv1beta1.Exec) ( if len(pods) > 0 { for _, pod := range pods { - stdout, stderr, execErrors := getExecOutputs(ctx, client, pod, execCollector) + stdout, stderr, execErrors := getExecOutputs(c, client, pod, execCollector) bundlePath := filepath.Join(execCollector.Name, pod.Namespace, pod.Name) if len(stdout) > 0 { @@ -89,7 +92,7 @@ func execWithoutTimeout(ctx *Context, execCollector *troubleshootv1beta1.Exec) ( return execOutput, nil } -func getExecOutputs(ctx *Context, client *kubernetes.Clientset, pod corev1.Pod, execCollector *troubleshootv1beta1.Exec) ([]byte, []byte, []string) { +func getExecOutputs(c *Collector, client *kubernetes.Clientset, pod corev1.Pod, execCollector *troubleshootv1beta1.Exec) ([]byte, []byte, []string) { container := pod.Spec.Containers[0].Name if execCollector.ContainerName != "" { container = execCollector.ContainerName @@ -111,7 +114,7 @@ func getExecOutputs(ctx *Context, client *kubernetes.Clientset, pod corev1.Pod, TTY: false, }, parameterCodec) - exec, err := remotecommand.NewSPDYExecutor(ctx.ClientConfig, "POST", req.URL()) + exec, err := remotecommand.NewSPDYExecutor(c.ClientConfig, "POST", req.URL()) if err != nil { return nil, nil, []string{err.Error()} } diff --git a/pkg/collect/http.go b/pkg/collect/http.go index eea244a6..258ae34c 100644 --- a/pkg/collect/http.go +++ b/pkg/collect/http.go @@ -22,7 +22,7 @@ type httpError struct { Message string `json:"message"` } -func HTTP(ctx *Context, httpCollector *troubleshootv1beta1.HTTP) (map[string][]byte, error) { +func HTTP(c *Collector, httpCollector *troubleshootv1beta1.HTTP) (map[string][]byte, error) { var response *http.Response var err error @@ -36,7 +36,7 @@ func HTTP(ctx *Context, httpCollector *troubleshootv1beta1.HTTP) (map[string][]b return nil, errors.New("no supported http request type") } - output, err := responseToOutput(response, err, ctx.Redact) + output, err := responseToOutput(response, err, c.Redact) if err != nil { return nil, err } diff --git a/pkg/collect/logs.go b/pkg/collect/logs.go index 2c8ff159..0ceb0110 100644 --- a/pkg/collect/logs.go +++ b/pkg/collect/logs.go @@ -2,6 +2,7 @@ package collect import ( "bytes" + "context" "fmt" "io" "strings" @@ -15,15 +16,17 @@ import ( "k8s.io/client-go/kubernetes" ) -func Logs(ctx *Context, logsCollector *troubleshootv1beta1.Logs) (map[string][]byte, error) { - client, err := kubernetes.NewForConfig(ctx.ClientConfig) +func Logs(c *Collector, logsCollector *troubleshootv1beta1.Logs) (map[string][]byte, error) { + client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, err } logsOutput := map[string][]byte{} - pods, podsErrors := listPodsInSelectors(client, logsCollector.Namespace, logsCollector.Selector) + ctx := context.Background() + + pods, podsErrors := listPodsInSelectors(ctx, client, logsCollector.Namespace, logsCollector.Selector) if len(podsErrors) > 0 { errorBytes, err := marshalNonNil(podsErrors) if err != nil { @@ -48,7 +51,7 @@ func Logs(ctx *Context, logsCollector *troubleshootv1beta1.Logs) (map[string][]b if len(containerNames) == 1 { containerName = "" // if there was only one container, use the old behavior of not including the container name in the path } - podLogs, err := getPodLogs(client, pod, logsCollector.Name, containerName, logsCollector.Limits, false) + podLogs, err := getPodLogs(ctx, client, pod, logsCollector.Name, containerName, logsCollector.Limits, false) if err != nil { key := fmt.Sprintf("%s/%s-errors.json", logsCollector.Name, pod.Name) if containerName != "" { @@ -66,7 +69,7 @@ func Logs(ctx *Context, logsCollector *troubleshootv1beta1.Logs) (map[string][]b } } else { for _, container := range logsCollector.ContainerNames { - containerLogs, err := getPodLogs(client, pod, logsCollector.Name, container, logsCollector.Limits, false) + containerLogs, err := getPodLogs(ctx, client, pod, logsCollector.Name, container, logsCollector.Limits, false) if err != nil { key := fmt.Sprintf("%s/%s/%s-errors.json", logsCollector.Name, pod.Name, container) logsOutput[key], err = marshalNonNil([]string{err.Error()}) @@ -86,14 +89,14 @@ func Logs(ctx *Context, logsCollector *troubleshootv1beta1.Logs) (map[string][]b return logsOutput, nil } -func listPodsInSelectors(client *kubernetes.Clientset, namespace string, selector []string) ([]corev1.Pod, []string) { +func listPodsInSelectors(ctx context.Context, client *kubernetes.Clientset, namespace string, selector []string) ([]corev1.Pod, []string) { serializedLabelSelector := strings.Join(selector, ",") listOptions := metav1.ListOptions{ LabelSelector: serializedLabelSelector, } - pods, err := client.CoreV1().Pods(namespace).List(listOptions) + pods, err := client.CoreV1().Pods(namespace).List(ctx, listOptions) if err != nil { return nil, []string{err.Error()} } @@ -101,7 +104,7 @@ func listPodsInSelectors(client *kubernetes.Clientset, namespace string, selecto return pods.Items, nil } -func getPodLogs(client *kubernetes.Clientset, pod corev1.Pod, name, container string, limits *troubleshootv1beta1.LogLimits, follow bool) (map[string][]byte, error) { +func getPodLogs(ctx context.Context, client *kubernetes.Clientset, pod corev1.Pod, name, container string, limits *troubleshootv1beta1.LogLimits, follow bool) (map[string][]byte, error) { podLogOpts := corev1.PodLogOptions{ Follow: follow, Container: container, @@ -135,7 +138,7 @@ func getPodLogs(client *kubernetes.Clientset, pod corev1.Pod, name, container st result := make(map[string][]byte) req := client.CoreV1().Pods(pod.Namespace).GetLogs(pod.Name, &podLogOpts) - podLogs, err := req.Stream() + podLogs, err := req.Stream(ctx) if err != nil { return nil, errors.Wrap(err, "failed to get log stream") } @@ -150,7 +153,7 @@ func getPodLogs(client *kubernetes.Clientset, pod corev1.Pod, name, container st podLogOpts.Previous = true req = client.CoreV1().Pods(pod.Namespace).GetLogs(pod.Name, &podLogOpts) - podLogs, err = req.Stream() + podLogs, err = req.Stream(ctx) if err != nil { // maybe fail on !kuberneteserrors.IsNotFound(err)? return result, nil diff --git a/pkg/collect/mysql.go b/pkg/collect/mysql.go index ee79e8c2..5bba0cce 100644 --- a/pkg/collect/mysql.go +++ b/pkg/collect/mysql.go @@ -10,7 +10,7 @@ import ( troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" ) -func Mysql(ctx *Context, databaseCollector *troubleshootv1beta1.Database) (map[string][]byte, error) { +func Mysql(c *Collector, databaseCollector *troubleshootv1beta1.Database) (map[string][]byte, error) { databaseConnection := DatabaseConnection{} db, err := sql.Open("mysql", databaseCollector.URI) diff --git a/pkg/collect/postgres.go b/pkg/collect/postgres.go index a6288af8..677182ab 100644 --- a/pkg/collect/postgres.go +++ b/pkg/collect/postgres.go @@ -11,7 +11,7 @@ import ( troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" ) -func Postgres(ctx *Context, databaseCollector *troubleshootv1beta1.Database) (map[string][]byte, error) { +func Postgres(c *Collector, databaseCollector *troubleshootv1beta1.Database) (map[string][]byte, error) { databaseConnection := DatabaseConnection{} db, err := sql.Open("postgres", databaseCollector.URI) diff --git a/pkg/collect/redis.go b/pkg/collect/redis.go index 20e4583e..c422161f 100644 --- a/pkg/collect/redis.go +++ b/pkg/collect/redis.go @@ -10,7 +10,7 @@ import ( troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" ) -func Redis(ctx *Context, databaseCollector *troubleshootv1beta1.Database) (map[string][]byte, error) { +func Redis(c *Collector, databaseCollector *troubleshootv1beta1.Database) (map[string][]byte, error) { databaseConnection := DatabaseConnection{} opt, err := redis.ParseURL(databaseCollector.URI) diff --git a/pkg/collect/run.go b/pkg/collect/run.go index 5b4a7c63..841d19f3 100644 --- a/pkg/collect/run.go +++ b/pkg/collect/run.go @@ -1,6 +1,7 @@ package collect import ( + "context" "time" "github.com/pkg/errors" @@ -11,25 +12,27 @@ import ( "k8s.io/client-go/kubernetes" ) -func Run(ctx *Context, runCollector *troubleshootv1beta1.Run) (map[string][]byte, error) { - client, err := kubernetes.NewForConfig(ctx.ClientConfig) +func Run(c *Collector, runCollector *troubleshootv1beta1.Run) (map[string][]byte, error) { + ctx := context.Background() + + client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, errors.Wrap(err, "failed to create client from config") } - pod, err := runPod(client, runCollector, ctx.Namespace) + pod, err := runPod(ctx, client, runCollector, c.Namespace) if err != nil { return nil, errors.Wrap(err, "failed to run pod") } defer func() { - if err := client.CoreV1().Pods(pod.Namespace).Delete(pod.Name, &metav1.DeleteOptions{}); err != nil { + if err := client.CoreV1().Pods(pod.Namespace).Delete(ctx, pod.Name, metav1.DeleteOptions{}); err != nil { logger.Printf("Failed to delete pod %s: %v\n", pod.Name, err) } }() if runCollector.Timeout == "" { - return runWithoutTimeout(ctx, pod, runCollector) + return runWithoutTimeout(ctx, c, pod, runCollector) } timeout, err := time.ParseDuration(runCollector.Timeout) @@ -40,7 +43,7 @@ func Run(ctx *Context, runCollector *troubleshootv1beta1.Run) (map[string][]byte errCh := make(chan error, 1) resultCh := make(chan map[string][]byte, 1) go func() { - b, err := runWithoutTimeout(ctx, pod, runCollector) + b, err := runWithoutTimeout(ctx, c, pod, runCollector) if err != nil { errCh <- err } else { @@ -58,14 +61,14 @@ func Run(ctx *Context, runCollector *troubleshootv1beta1.Run) (map[string][]byte } } -func runWithoutTimeout(ctx *Context, pod *corev1.Pod, runCollector *troubleshootv1beta1.Run) (map[string][]byte, error) { - client, err := kubernetes.NewForConfig(ctx.ClientConfig) +func runWithoutTimeout(ctx context.Context, c *Collector, pod *corev1.Pod, runCollector *troubleshootv1beta1.Run) (map[string][]byte, error) { + client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, errors.Wrap(err, "failed create client from config") } for { - status, err := client.CoreV1().Pods(pod.Namespace).Get(pod.Name, metav1.GetOptions{}) + status, err := client.CoreV1().Pods(pod.Namespace).Get(ctx, pod.Name, metav1.GetOptions{}) if err != nil { return nil, errors.Wrap(err, "failed to get pod") } @@ -82,7 +85,7 @@ func runWithoutTimeout(ctx *Context, pod *corev1.Pod, runCollector *troubleshoot limits := troubleshootv1beta1.LogLimits{ MaxLines: 10000, } - podLogs, err := getPodLogs(client, *pod, runCollector.Name, "", &limits, true) + podLogs, err := getPodLogs(ctx, client, *pod, runCollector.Name, "", &limits, true) if err != nil { return nil, errors.Wrap(err, "failed to get pod logs") } @@ -94,7 +97,7 @@ func runWithoutTimeout(ctx *Context, pod *corev1.Pod, runCollector *troubleshoot return runOutput, nil } -func runPod(client *kubernetes.Clientset, runCollector *troubleshootv1beta1.Run, namespace string) (*corev1.Pod, error) { +func runPod(ctx context.Context, client *kubernetes.Clientset, runCollector *troubleshootv1beta1.Run, namespace string) (*corev1.Pod, error) { podLabels := make(map[string]string) podLabels["troubleshoot-role"] = "run-collector" @@ -134,7 +137,7 @@ func runPod(client *kubernetes.Clientset, runCollector *troubleshootv1beta1.Run, }, } - created, err := client.CoreV1().Pods(namespace).Create(&pod) + created, err := client.CoreV1().Pods(namespace).Create(ctx, &pod, metav1.CreateOptions{}) if err != nil { return nil, errors.Wrap(err, "failed to create pod") } diff --git a/pkg/collect/secret.go b/pkg/collect/secret.go index 4a6a60a9..0304db35 100644 --- a/pkg/collect/secret.go +++ b/pkg/collect/secret.go @@ -1,6 +1,7 @@ package collect import ( + "context" "encoding/json" "fmt" "path" @@ -20,15 +21,17 @@ type FoundSecret struct { Value string `json:"value,omitempty"` } -func Secret(ctx *Context, secretCollector *troubleshootv1beta1.Secret) (map[string][]byte, error) { - client, err := kubernetes.NewForConfig(ctx.ClientConfig) +func Secret(c *Collector, secretCollector *troubleshootv1beta1.Secret) (map[string][]byte, error) { + client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, err } secretOutput := map[string][]byte{} - filePath, encoded, err := secret(client, secretCollector) + ctx := context.Background() + + filePath, encoded, err := secret(ctx, client, secretCollector) if err != nil { errorBytes, err := marshalNonNil([]string{err.Error()}) if err != nil { @@ -43,11 +46,11 @@ func Secret(ctx *Context, secretCollector *troubleshootv1beta1.Secret) (map[stri return secretOutput, nil } -func secret(client *kubernetes.Clientset, secretCollector *troubleshootv1beta1.Secret) (string, []byte, error) { +func secret(ctx context.Context, client *kubernetes.Clientset, secretCollector *troubleshootv1beta1.Secret) (string, []byte, error) { ns := secretCollector.Namespace path := fmt.Sprintf("%s.json", filepath.Join(ns, secretCollector.SecretName)) - found, err := client.CoreV1().Secrets(secretCollector.Namespace).Get(secretCollector.SecretName, metav1.GetOptions{}) + found, err := client.CoreV1().Secrets(secretCollector.Namespace).Get(ctx, secretCollector.SecretName, metav1.GetOptions{}) if err != nil { missingSecret := FoundSecret{ Namespace: secretCollector.Namespace, diff --git a/pkg/preflight/collect.go b/pkg/preflight/collect.go index 0b9c557f..e8b3da6b 100644 --- a/pkg/preflight/collect.go +++ b/pkg/preflight/collect.go @@ -1,6 +1,7 @@ package preflight import ( + "context" "fmt" "github.com/pkg/errors" @@ -48,7 +49,7 @@ func Collect(opts CollectOpts, p *troubleshootv1beta1.Preflight) (CollectResult, Spec: p, } - if err := collectors.CheckRBAC(); err != nil { + if err := collectors.CheckRBAC(context.Background()); err != nil { return collectResult, errors.Wrap(err, "failed to check RBAC for collectors") }