From 562a565f1fa7aa80b64ca6808c14a1e2aaf404ea Mon Sep 17 00:00:00 2001 From: Marc Campbell Date: Thu, 19 Mar 2020 17:24:07 -0700 Subject: [PATCH] Adding postgres analyzer --- Makefile | 4 +- examples/preflight/postgres.yaml | 23 +++ examples/preflight/text-analyze.yaml | 20 ++ .../client/troubleshootclientset/clientset.go | 96 +++++++++ .../pkg/client/troubleshootclientset/doc.go | 19 ++ .../fake/clientset_generated.go | 81 ++++++++ .../client/troubleshootclientset/fake/doc.go | 19 ++ .../troubleshootclientset/fake/register.go | 55 +++++ .../troubleshootclientset/scheme/doc.go | 19 ++ .../troubleshootclientset/scheme/register.go | 55 +++++ .../typed/troubleshoot/v1beta1/analyzer.go | 190 ++++++++++++++++++ .../typed/troubleshoot/v1beta1/analyzerjob.go | 190 ++++++++++++++++++ .../typed/troubleshoot/v1beta1/collector.go | 190 ++++++++++++++++++ .../troubleshoot/v1beta1/collectorjob.go | 190 ++++++++++++++++++ .../typed/troubleshoot/v1beta1/doc.go | 19 ++ .../typed/troubleshoot/v1beta1/fake/doc.go | 19 ++ .../v1beta1/fake/fake_analyzer.go | 139 +++++++++++++ .../v1beta1/fake/fake_analyzerjob.go | 139 +++++++++++++ .../v1beta1/fake/fake_collector.go | 139 +++++++++++++ .../v1beta1/fake/fake_collectorjob.go | 139 +++++++++++++ .../v1beta1/fake/fake_preflight.go | 139 +++++++++++++ .../v1beta1/fake/fake_preflightjob.go | 139 +++++++++++++ .../v1beta1/fake/fake_troubleshoot_client.go | 59 ++++++ .../v1beta1/generated_expansion.go | 30 +++ .../typed/troubleshoot/v1beta1/preflight.go | 190 ++++++++++++++++++ .../troubleshoot/v1beta1/preflightjob.go | 190 ++++++++++++++++++ .../v1beta1/troubleshoot_client.go | 113 +++++++++++ go.mod | 15 +- go.sum | 119 +++++++++++ pkg/analyze/analyzer.go | 10 + pkg/analyze/postgres_analyze.go | 154 ++++++++++++++ pkg/analyze/postgres_analyze_test.go | 76 +++++++ pkg/analyze/text_analyze.go | 2 +- .../troubleshoot/v1beta1/analyzer_shared.go | 9 +- .../troubleshoot/v1beta1/collector_shared.go | 6 + .../v1beta1/zz_generated.deepcopy.go | 53 +++++ pkg/collect/collector.go | 10 + pkg/collect/postgres.go | 59 ++++++ pkg/collect/secret.go | 1 + pkg/server/collector.go | 53 ----- pkg/server/preflight.go | 56 ------ 41 files changed, 3109 insertions(+), 119 deletions(-) create mode 100644 examples/preflight/postgres.yaml create mode 100644 examples/preflight/text-analyze.yaml create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/clientset.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/doc.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/clientset_generated.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/doc.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/register.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme/doc.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme/register.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzer.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzerjob.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collector.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collectorjob.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/doc.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/doc.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzer.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzerjob.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collector.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collectorjob.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflight.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflightjob.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_troubleshoot_client.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/generated_expansion.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflight.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflightjob.go create mode 100644 github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/troubleshoot_client.go create mode 100644 pkg/analyze/postgres_analyze.go create mode 100644 pkg/analyze/postgres_analyze_test.go create mode 100644 pkg/collect/postgres.go delete mode 100644 pkg/server/collector.go delete mode 100644 pkg/server/preflight.go diff --git a/Makefile b/Makefile index 52231a6f..10fb4416 100644 --- a/Makefile +++ b/Makefile @@ -67,8 +67,8 @@ vet: .PHONY: generate generate: controller-gen 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 --input troubleshoot/v1beta1 -h ./hack/boilerplate.go.txt + $(shell go env GOPATH)/bin/controller-gen object:headerFile=./hack/boilerplate.go.txt paths=./pkg/apis/... + $(shell go env GOPATH)/bin/client-gen --output-package=github.com/replicatedhq/troubleshoot/pkg/client --clientset-name troubleshootclientset --input-base github.com/replicatedhq/troubleshoot/pkg/apis --input troubleshoot/v1beta1 -h ./hack/boilerplate.go.txt .PHONY: openapischema openapischema: controller-gen diff --git a/examples/preflight/postgres.yaml b/examples/preflight/postgres.yaml new file mode 100644 index 00000000..2fa6989e --- /dev/null +++ b/examples/preflight/postgres.yaml @@ -0,0 +1,23 @@ +apiVersion: troubleshoot.replicated.com/v1beta1 +kind: Preflight +metadata: + name: sample +spec: + collectors: + - postgres: + collectorName: pg + uri: postgres://testuser:password@postgresql:5432/testdb?sslmode=disable + analyzers: + - postgres: + checkName: Must be postgres 10.x or later + collectorName: pg + outcomes: + - fail: + when: "connected == false" + message: Cannot connect to postgres server + - fail: + when: "version < 10.x" + message: The postgres server must be at least version 10 + - pass: + message: The postgres connection checks out + \ No newline at end of file diff --git a/examples/preflight/text-analyze.yaml b/examples/preflight/text-analyze.yaml new file mode 100644 index 00000000..8c28b605 --- /dev/null +++ b/examples/preflight/text-analyze.yaml @@ -0,0 +1,20 @@ +apiVersion: troubleshoot.replicated.com/v1beta1 +kind: Preflight +metadata: + name: example-preflight-checks +spec: + collectors: + - data: + name: config/replicas.txt + data: "2" + analyzers: + - textAnalyze: + checkName: Replica Count + fileName: config/replicas.txt + regexGroups: '(?P\d+)' + outcomes: + - fail: + when: "Replicas < 5" + message: That's not enough replicas! + - pass: + message: You've selected at leat 5 replicas \ No newline at end of file diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/clientset.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/clientset.go new file mode 100644 index 00000000..dd1b3e4e --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/clientset.go @@ -0,0 +1,96 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package troubleshootclientset + +import ( + "fmt" + + troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + TroubleshootV1beta1() troubleshootv1beta1.TroubleshootV1beta1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + troubleshootV1beta1 *troubleshootv1beta1.TroubleshootV1beta1Client +} + +// TroubleshootV1beta1 retrieves the TroubleshootV1beta1Client +func (c *Clientset) TroubleshootV1beta1() troubleshootv1beta1.TroubleshootV1beta1Interface { + return c.troubleshootV1beta1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("Burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.troubleshootV1beta1, err = troubleshootv1beta1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.troubleshootV1beta1 = troubleshootv1beta1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.troubleshootV1beta1 = troubleshootv1beta1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/doc.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/doc.go new file mode 100644 index 00000000..05559a44 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package troubleshootclientset diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/clientset_generated.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/clientset_generated.go new file mode 100644 index 00000000..bb01082c --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/clientset_generated.go @@ -0,0 +1,81 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + clientset "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset" + troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1" + faketroubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery + tracker testing.ObjectTracker +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +func (c *Clientset) Tracker() testing.ObjectTracker { + return c.tracker +} + +var _ clientset.Interface = &Clientset{} + +// TroubleshootV1beta1 retrieves the TroubleshootV1beta1Client +func (c *Clientset) TroubleshootV1beta1() troubleshootv1beta1.TroubleshootV1beta1Interface { + return &faketroubleshootv1beta1.FakeTroubleshootV1beta1{Fake: &c.Fake} +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/doc.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/doc.go new file mode 100644 index 00000000..51266d80 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/register.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/register.go new file mode 100644 index 00000000..71731ac9 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/fake/register.go @@ -0,0 +1,55 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + troubleshootv1beta1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme/doc.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme/doc.go new file mode 100644 index 00000000..37f640ec --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme/register.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme/register.go new file mode 100644 index 00000000..55051e56 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme/register.go @@ -0,0 +1,55 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + troubleshootv1beta1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzer.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzer.go new file mode 100644 index 00000000..2950c600 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzer.go @@ -0,0 +1,190 @@ +/* +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 ( + "time" + + v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// AnalyzersGetter has a method to return a AnalyzerInterface. +// A group's client should implement this interface. +type AnalyzersGetter interface { + Analyzers(namespace string) AnalyzerInterface +} + +// AnalyzerInterface has methods to work with Analyzer resources. +type AnalyzerInterface interface { + Create(*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) + AnalyzerExpansion +} + +// analyzers implements AnalyzerInterface +type analyzers struct { + client rest.Interface + ns string +} + +// newAnalyzers returns a Analyzers +func newAnalyzers(c *TroubleshootV1beta1Client, namespace string) *analyzers { + return &analyzers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the analyzer, and returns the corresponding analyzer object, and an error if there is any. +func (c *analyzers) Get(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(). + 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) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.AnalyzerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("analyzers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested analyzers. +func (c *analyzers) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("analyzers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// 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) { + result = &v1beta1.Analyzer{} + err = c.client.Post(). + Namespace(c.ns). + Resource("analyzers"). + Body(analyzer). + Do(). + 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) { + result = &v1beta1.Analyzer{} + err = c.client.Put(). + Namespace(c.ns). + Resource("analyzers"). + Name(analyzer.Name). + Body(analyzer). + Do(). + 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) { + result = &v1beta1.Analyzer{} + err = c.client.Put(). + Namespace(c.ns). + Resource("analyzers"). + Name(analyzer.Name). + SubResource("status"). + Body(analyzer). + Do(). + 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 { + return c.client.Delete(). + Namespace(c.ns). + Resource("analyzers"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *analyzers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("analyzers"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + 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) { + result = &v1beta1.Analyzer{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("analyzers"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzerjob.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzerjob.go new file mode 100644 index 00000000..10726b7b --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/analyzerjob.go @@ -0,0 +1,190 @@ +/* +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 ( + "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" +) + +// AnalyzerJobsGetter has a method to return a AnalyzerJobInterface. +// A group's client should implement this interface. +type AnalyzerJobsGetter interface { + AnalyzerJobs(namespace string) AnalyzerJobInterface +} + +// AnalyzerJobInterface has methods to work with AnalyzerJob resources. +type AnalyzerJobInterface interface { + Create(*v1beta1.AnalyzerJob) (*v1beta1.AnalyzerJob, error) + Update(*v1beta1.AnalyzerJob) (*v1beta1.AnalyzerJob, error) + UpdateStatus(*v1beta1.AnalyzerJob) (*v1beta1.AnalyzerJob, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta1.AnalyzerJob, error) + List(opts v1.ListOptions) (*v1beta1.AnalyzerJobList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.AnalyzerJob, err error) + AnalyzerJobExpansion +} + +// analyzerJobs implements AnalyzerJobInterface +type analyzerJobs struct { + client rest.Interface + ns string +} + +// newAnalyzerJobs returns a AnalyzerJobs +func newAnalyzerJobs(c *TroubleshootV1beta1Client, namespace string) *analyzerJobs { + return &analyzerJobs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the analyzerJob, and returns the corresponding analyzerJob object, and an error if there is any. +func (c *analyzerJobs) Get(name string, options v1.GetOptions) (result *v1beta1.AnalyzerJob, err error) { + result = &v1beta1.AnalyzerJob{} + err = c.client.Get(). + Namespace(c.ns). + Resource("analyzerjobs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of AnalyzerJobs that match those selectors. +func (c *analyzerJobs) List(opts v1.ListOptions) (result *v1beta1.AnalyzerJobList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.AnalyzerJobList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("analyzerjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested analyzerJobs. +func (c *analyzerJobs) Watch(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("analyzerjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a analyzerJob and creates it. Returns the server's representation of the analyzerJob, and an error, if there is any. +func (c *analyzerJobs) Create(analyzerJob *v1beta1.AnalyzerJob) (result *v1beta1.AnalyzerJob, err error) { + result = &v1beta1.AnalyzerJob{} + err = c.client.Post(). + Namespace(c.ns). + Resource("analyzerjobs"). + Body(analyzerJob). + Do(). + Into(result) + return +} + +// Update takes the representation of a analyzerJob and updates it. Returns the server's representation of the analyzerJob, and an error, if there is any. +func (c *analyzerJobs) Update(analyzerJob *v1beta1.AnalyzerJob) (result *v1beta1.AnalyzerJob, err error) { + result = &v1beta1.AnalyzerJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("analyzerjobs"). + Name(analyzerJob.Name). + Body(analyzerJob). + Do(). + 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 *analyzerJobs) UpdateStatus(analyzerJob *v1beta1.AnalyzerJob) (result *v1beta1.AnalyzerJob, err error) { + result = &v1beta1.AnalyzerJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("analyzerjobs"). + Name(analyzerJob.Name). + SubResource("status"). + Body(analyzerJob). + Do(). + Into(result) + return +} + +// Delete takes name of the analyzerJob and deletes it. Returns an error if one occurs. +func (c *analyzerJobs) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("analyzerjobs"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *analyzerJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("analyzerjobs"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched analyzerJob. +func (c *analyzerJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.AnalyzerJob, err error) { + result = &v1beta1.AnalyzerJob{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("analyzerjobs"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collector.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collector.go new file mode 100644 index 00000000..a36ed680 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collector.go @@ -0,0 +1,190 @@ +/* +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 ( + "time" + + v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CollectorsGetter has a method to return a CollectorInterface. +// A group's client should implement this interface. +type CollectorsGetter interface { + Collectors(namespace string) CollectorInterface +} + +// CollectorInterface has methods to work with Collector resources. +type CollectorInterface interface { + Create(*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) + CollectorExpansion +} + +// collectors implements CollectorInterface +type collectors struct { + client rest.Interface + ns string +} + +// newCollectors returns a Collectors +func newCollectors(c *TroubleshootV1beta1Client, namespace string) *collectors { + return &collectors{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the collector, and returns the corresponding collector object, and an error if there is any. +func (c *collectors) Get(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(). + 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) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.CollectorList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("collectors"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested collectors. +func (c *collectors) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("collectors"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// 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) { + result = &v1beta1.Collector{} + err = c.client.Post(). + Namespace(c.ns). + Resource("collectors"). + Body(collector). + Do(). + 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) { + result = &v1beta1.Collector{} + err = c.client.Put(). + Namespace(c.ns). + Resource("collectors"). + Name(collector.Name). + Body(collector). + Do(). + 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) { + result = &v1beta1.Collector{} + err = c.client.Put(). + Namespace(c.ns). + Resource("collectors"). + Name(collector.Name). + SubResource("status"). + Body(collector). + Do(). + 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 { + return c.client.Delete(). + Namespace(c.ns). + Resource("collectors"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *collectors) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("collectors"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + 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) { + result = &v1beta1.Collector{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("collectors"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collectorjob.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collectorjob.go new file mode 100644 index 00000000..8f8b9c89 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/collectorjob.go @@ -0,0 +1,190 @@ +/* +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 ( + "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" +) + +// CollectorJobsGetter has a method to return a CollectorJobInterface. +// A group's client should implement this interface. +type CollectorJobsGetter interface { + CollectorJobs(namespace string) CollectorJobInterface +} + +// CollectorJobInterface has methods to work with CollectorJob resources. +type CollectorJobInterface interface { + Create(*v1beta1.CollectorJob) (*v1beta1.CollectorJob, error) + Update(*v1beta1.CollectorJob) (*v1beta1.CollectorJob, error) + UpdateStatus(*v1beta1.CollectorJob) (*v1beta1.CollectorJob, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta1.CollectorJob, error) + List(opts v1.ListOptions) (*v1beta1.CollectorJobList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.CollectorJob, err error) + CollectorJobExpansion +} + +// collectorJobs implements CollectorJobInterface +type collectorJobs struct { + client rest.Interface + ns string +} + +// newCollectorJobs returns a CollectorJobs +func newCollectorJobs(c *TroubleshootV1beta1Client, namespace string) *collectorJobs { + return &collectorJobs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the collectorJob, and returns the corresponding collectorJob object, and an error if there is any. +func (c *collectorJobs) Get(name string, options v1.GetOptions) (result *v1beta1.CollectorJob, err error) { + result = &v1beta1.CollectorJob{} + err = c.client.Get(). + Namespace(c.ns). + Resource("collectorjobs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CollectorJobs that match those selectors. +func (c *collectorJobs) List(opts v1.ListOptions) (result *v1beta1.CollectorJobList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.CollectorJobList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("collectorjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested collectorJobs. +func (c *collectorJobs) Watch(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("collectorjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a collectorJob and creates it. Returns the server's representation of the collectorJob, and an error, if there is any. +func (c *collectorJobs) Create(collectorJob *v1beta1.CollectorJob) (result *v1beta1.CollectorJob, err error) { + result = &v1beta1.CollectorJob{} + err = c.client.Post(). + Namespace(c.ns). + Resource("collectorjobs"). + Body(collectorJob). + Do(). + Into(result) + return +} + +// Update takes the representation of a collectorJob and updates it. Returns the server's representation of the collectorJob, and an error, if there is any. +func (c *collectorJobs) Update(collectorJob *v1beta1.CollectorJob) (result *v1beta1.CollectorJob, err error) { + result = &v1beta1.CollectorJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("collectorjobs"). + Name(collectorJob.Name). + Body(collectorJob). + Do(). + 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 *collectorJobs) UpdateStatus(collectorJob *v1beta1.CollectorJob) (result *v1beta1.CollectorJob, err error) { + result = &v1beta1.CollectorJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("collectorjobs"). + Name(collectorJob.Name). + SubResource("status"). + Body(collectorJob). + Do(). + Into(result) + return +} + +// Delete takes name of the collectorJob and deletes it. Returns an error if one occurs. +func (c *collectorJobs) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("collectorjobs"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *collectorJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("collectorjobs"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched collectorJob. +func (c *collectorJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.CollectorJob, err error) { + result = &v1beta1.CollectorJob{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("collectorjobs"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/doc.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/doc.go new file mode 100644 index 00000000..e189fb14 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1beta1 diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/doc.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/doc.go new file mode 100644 index 00000000..0767328a --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzer.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzer.go new file mode 100644 index 00000000..9d640515 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzer.go @@ -0,0 +1,139 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeAnalyzers implements AnalyzerInterface +type FakeAnalyzers struct { + Fake *FakeTroubleshootV1beta1 + ns string +} + +var analyzersResource = schema.GroupVersionResource{Group: "troubleshoot.replicated.com", Version: "v1beta1", Resource: "analyzers"} + +var analyzersKind = schema.GroupVersionKind{Group: "troubleshoot.replicated.com", Version: "v1beta1", Kind: "Analyzer"} + +// Get takes name of the analyzer, and returns the corresponding analyzer object, and an error if there is any. +func (c *FakeAnalyzers) Get(name string, options v1.GetOptions) (result *v1beta1.Analyzer, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(analyzersResource, c.ns, name), &v1beta1.Analyzer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Analyzer), err +} + +// List takes label and field selectors, and returns the list of Analyzers that match those selectors. +func (c *FakeAnalyzers) List(opts v1.ListOptions) (result *v1beta1.AnalyzerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(analyzersResource, analyzersKind, c.ns, opts), &v1beta1.AnalyzerList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.AnalyzerList{ListMeta: obj.(*v1beta1.AnalyzerList).ListMeta} + for _, item := range obj.(*v1beta1.AnalyzerList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested analyzers. +func (c *FakeAnalyzers) Watch(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) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(analyzersResource, c.ns, analyzer), &v1beta1.Analyzer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Analyzer), err +} + +// Update takes the representation of a analyzer and updates it. Returns the server's representation of the analyzer, and an error, if there is any. +func (c *FakeAnalyzers) Update(analyzer *v1beta1.Analyzer) (result *v1beta1.Analyzer, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(analyzersResource, c.ns, analyzer), &v1beta1.Analyzer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Analyzer), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeAnalyzers) UpdateStatus(analyzer *v1beta1.Analyzer) (*v1beta1.Analyzer, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(analyzersResource, "status", c.ns, analyzer), &v1beta1.Analyzer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Analyzer), err +} + +// Delete takes name of the analyzer and deletes it. Returns an error if one occurs. +func (c *FakeAnalyzers) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(analyzersResource, c.ns, name), &v1beta1.Analyzer{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeAnalyzers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(analyzersResource, c.ns, listOptions) + + _, 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) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(analyzersResource, c.ns, name, pt, data, subresources...), &v1beta1.Analyzer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Analyzer), err +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzerjob.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzerjob.go new file mode 100644 index 00000000..8d7391d2 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_analyzerjob.go @@ -0,0 +1,139 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/replicatedhq/troubleshoot/pkg/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" +) + +// FakeAnalyzerJobs implements AnalyzerJobInterface +type FakeAnalyzerJobs struct { + Fake *FakeTroubleshootV1beta1 + ns string +} + +var analyzerjobsResource = schema.GroupVersionResource{Group: "troubleshoot.replicated.com", Version: "v1beta1", Resource: "analyzerjobs"} + +var analyzerjobsKind = schema.GroupVersionKind{Group: "troubleshoot.replicated.com", Version: "v1beta1", Kind: "AnalyzerJob"} + +// Get takes name of the analyzerJob, and returns the corresponding analyzerJob object, and an error if there is any. +func (c *FakeAnalyzerJobs) Get(name string, options v1.GetOptions) (result *v1beta1.AnalyzerJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(analyzerjobsResource, c.ns, name), &v1beta1.AnalyzerJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.AnalyzerJob), err +} + +// List takes label and field selectors, and returns the list of AnalyzerJobs that match those selectors. +func (c *FakeAnalyzerJobs) List(opts v1.ListOptions) (result *v1beta1.AnalyzerJobList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(analyzerjobsResource, analyzerjobsKind, c.ns, opts), &v1beta1.AnalyzerJobList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.AnalyzerJobList{ListMeta: obj.(*v1beta1.AnalyzerJobList).ListMeta} + for _, item := range obj.(*v1beta1.AnalyzerJobList).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 analyzerJobs. +func (c *FakeAnalyzerJobs) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(analyzerjobsResource, c.ns, opts)) + +} + +// Create takes the representation of a analyzerJob and creates it. Returns the server's representation of the analyzerJob, and an error, if there is any. +func (c *FakeAnalyzerJobs) Create(analyzerJob *v1beta1.AnalyzerJob) (result *v1beta1.AnalyzerJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(analyzerjobsResource, c.ns, analyzerJob), &v1beta1.AnalyzerJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.AnalyzerJob), err +} + +// Update takes the representation of a analyzerJob and updates it. Returns the server's representation of the analyzerJob, and an error, if there is any. +func (c *FakeAnalyzerJobs) Update(analyzerJob *v1beta1.AnalyzerJob) (result *v1beta1.AnalyzerJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(analyzerjobsResource, c.ns, analyzerJob), &v1beta1.AnalyzerJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.AnalyzerJob), 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 *FakeAnalyzerJobs) UpdateStatus(analyzerJob *v1beta1.AnalyzerJob) (*v1beta1.AnalyzerJob, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(analyzerjobsResource, "status", c.ns, analyzerJob), &v1beta1.AnalyzerJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.AnalyzerJob), err +} + +// Delete takes name of the analyzerJob and deletes it. Returns an error if one occurs. +func (c *FakeAnalyzerJobs) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(analyzerjobsResource, c.ns, name), &v1beta1.AnalyzerJob{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeAnalyzerJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(analyzerjobsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.AnalyzerJobList{}) + return err +} + +// Patch applies the patch and returns the patched analyzerJob. +func (c *FakeAnalyzerJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.AnalyzerJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(analyzerjobsResource, c.ns, name, pt, data, subresources...), &v1beta1.AnalyzerJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.AnalyzerJob), err +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collector.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collector.go new file mode 100644 index 00000000..adabd949 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collector.go @@ -0,0 +1,139 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCollectors implements CollectorInterface +type FakeCollectors struct { + Fake *FakeTroubleshootV1beta1 + ns string +} + +var collectorsResource = schema.GroupVersionResource{Group: "troubleshoot.replicated.com", Version: "v1beta1", Resource: "collectors"} + +var collectorsKind = schema.GroupVersionKind{Group: "troubleshoot.replicated.com", Version: "v1beta1", Kind: "Collector"} + +// Get takes name of the collector, and returns the corresponding collector object, and an error if there is any. +func (c *FakeCollectors) Get(name string, options v1.GetOptions) (result *v1beta1.Collector, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(collectorsResource, c.ns, name), &v1beta1.Collector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Collector), err +} + +// List takes label and field selectors, and returns the list of Collectors that match those selectors. +func (c *FakeCollectors) List(opts v1.ListOptions) (result *v1beta1.CollectorList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(collectorsResource, collectorsKind, c.ns, opts), &v1beta1.CollectorList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.CollectorList{ListMeta: obj.(*v1beta1.CollectorList).ListMeta} + for _, item := range obj.(*v1beta1.CollectorList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested collectors. +func (c *FakeCollectors) Watch(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) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(collectorsResource, c.ns, collector), &v1beta1.Collector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Collector), err +} + +// Update takes the representation of a collector and updates it. Returns the server's representation of the collector, and an error, if there is any. +func (c *FakeCollectors) Update(collector *v1beta1.Collector) (result *v1beta1.Collector, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(collectorsResource, c.ns, collector), &v1beta1.Collector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Collector), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCollectors) UpdateStatus(collector *v1beta1.Collector) (*v1beta1.Collector, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(collectorsResource, "status", c.ns, collector), &v1beta1.Collector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Collector), err +} + +// Delete takes name of the collector and deletes it. Returns an error if one occurs. +func (c *FakeCollectors) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(collectorsResource, c.ns, name), &v1beta1.Collector{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCollectors) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(collectorsResource, c.ns, listOptions) + + _, 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) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(collectorsResource, c.ns, name, pt, data, subresources...), &v1beta1.Collector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Collector), err +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collectorjob.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collectorjob.go new file mode 100644 index 00000000..3266242b --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_collectorjob.go @@ -0,0 +1,139 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/replicatedhq/troubleshoot/pkg/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" +) + +// FakeCollectorJobs implements CollectorJobInterface +type FakeCollectorJobs struct { + Fake *FakeTroubleshootV1beta1 + ns string +} + +var collectorjobsResource = schema.GroupVersionResource{Group: "troubleshoot.replicated.com", Version: "v1beta1", Resource: "collectorjobs"} + +var collectorjobsKind = schema.GroupVersionKind{Group: "troubleshoot.replicated.com", Version: "v1beta1", Kind: "CollectorJob"} + +// Get takes name of the collectorJob, and returns the corresponding collectorJob object, and an error if there is any. +func (c *FakeCollectorJobs) Get(name string, options v1.GetOptions) (result *v1beta1.CollectorJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(collectorjobsResource, c.ns, name), &v1beta1.CollectorJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.CollectorJob), err +} + +// List takes label and field selectors, and returns the list of CollectorJobs that match those selectors. +func (c *FakeCollectorJobs) List(opts v1.ListOptions) (result *v1beta1.CollectorJobList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(collectorjobsResource, collectorjobsKind, c.ns, opts), &v1beta1.CollectorJobList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.CollectorJobList{ListMeta: obj.(*v1beta1.CollectorJobList).ListMeta} + for _, item := range obj.(*v1beta1.CollectorJobList).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 collectorJobs. +func (c *FakeCollectorJobs) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(collectorjobsResource, c.ns, opts)) + +} + +// Create takes the representation of a collectorJob and creates it. Returns the server's representation of the collectorJob, and an error, if there is any. +func (c *FakeCollectorJobs) Create(collectorJob *v1beta1.CollectorJob) (result *v1beta1.CollectorJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(collectorjobsResource, c.ns, collectorJob), &v1beta1.CollectorJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.CollectorJob), err +} + +// Update takes the representation of a collectorJob and updates it. Returns the server's representation of the collectorJob, and an error, if there is any. +func (c *FakeCollectorJobs) Update(collectorJob *v1beta1.CollectorJob) (result *v1beta1.CollectorJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(collectorjobsResource, c.ns, collectorJob), &v1beta1.CollectorJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.CollectorJob), 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 *FakeCollectorJobs) UpdateStatus(collectorJob *v1beta1.CollectorJob) (*v1beta1.CollectorJob, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(collectorjobsResource, "status", c.ns, collectorJob), &v1beta1.CollectorJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.CollectorJob), err +} + +// Delete takes name of the collectorJob and deletes it. Returns an error if one occurs. +func (c *FakeCollectorJobs) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(collectorjobsResource, c.ns, name), &v1beta1.CollectorJob{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCollectorJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(collectorjobsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.CollectorJobList{}) + return err +} + +// Patch applies the patch and returns the patched collectorJob. +func (c *FakeCollectorJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.CollectorJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(collectorjobsResource, c.ns, name, pt, data, subresources...), &v1beta1.CollectorJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.CollectorJob), err +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflight.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflight.go new file mode 100644 index 00000000..8f7147c2 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflight.go @@ -0,0 +1,139 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePreflights implements PreflightInterface +type FakePreflights struct { + Fake *FakeTroubleshootV1beta1 + ns string +} + +var preflightsResource = schema.GroupVersionResource{Group: "troubleshoot.replicated.com", Version: "v1beta1", Resource: "preflights"} + +var preflightsKind = schema.GroupVersionKind{Group: "troubleshoot.replicated.com", Version: "v1beta1", Kind: "Preflight"} + +// Get takes name of the preflight, and returns the corresponding preflight object, and an error if there is any. +func (c *FakePreflights) Get(name string, options v1.GetOptions) (result *v1beta1.Preflight, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(preflightsResource, c.ns, name), &v1beta1.Preflight{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Preflight), err +} + +// List takes label and field selectors, and returns the list of Preflights that match those selectors. +func (c *FakePreflights) List(opts v1.ListOptions) (result *v1beta1.PreflightList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(preflightsResource, preflightsKind, c.ns, opts), &v1beta1.PreflightList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.PreflightList{ListMeta: obj.(*v1beta1.PreflightList).ListMeta} + for _, item := range obj.(*v1beta1.PreflightList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested preflights. +func (c *FakePreflights) Watch(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) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(preflightsResource, c.ns, preflight), &v1beta1.Preflight{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Preflight), err +} + +// Update takes the representation of a preflight and updates it. Returns the server's representation of the preflight, and an error, if there is any. +func (c *FakePreflights) Update(preflight *v1beta1.Preflight) (result *v1beta1.Preflight, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(preflightsResource, c.ns, preflight), &v1beta1.Preflight{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Preflight), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePreflights) UpdateStatus(preflight *v1beta1.Preflight) (*v1beta1.Preflight, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(preflightsResource, "status", c.ns, preflight), &v1beta1.Preflight{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Preflight), err +} + +// Delete takes name of the preflight and deletes it. Returns an error if one occurs. +func (c *FakePreflights) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(preflightsResource, c.ns, name), &v1beta1.Preflight{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePreflights) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(preflightsResource, c.ns, listOptions) + + _, 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) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(preflightsResource, c.ns, name, pt, data, subresources...), &v1beta1.Preflight{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Preflight), err +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflightjob.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflightjob.go new file mode 100644 index 00000000..f0a8910e --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_preflightjob.go @@ -0,0 +1,139 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/replicatedhq/troubleshoot/pkg/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" +) + +// FakePreflightJobs implements PreflightJobInterface +type FakePreflightJobs struct { + Fake *FakeTroubleshootV1beta1 + ns string +} + +var preflightjobsResource = schema.GroupVersionResource{Group: "troubleshoot.replicated.com", Version: "v1beta1", Resource: "preflightjobs"} + +var preflightjobsKind = schema.GroupVersionKind{Group: "troubleshoot.replicated.com", Version: "v1beta1", Kind: "PreflightJob"} + +// Get takes name of the preflightJob, and returns the corresponding preflightJob object, and an error if there is any. +func (c *FakePreflightJobs) Get(name string, options v1.GetOptions) (result *v1beta1.PreflightJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(preflightjobsResource, c.ns, name), &v1beta1.PreflightJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.PreflightJob), err +} + +// List takes label and field selectors, and returns the list of PreflightJobs that match those selectors. +func (c *FakePreflightJobs) List(opts v1.ListOptions) (result *v1beta1.PreflightJobList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(preflightjobsResource, preflightjobsKind, c.ns, opts), &v1beta1.PreflightJobList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.PreflightJobList{ListMeta: obj.(*v1beta1.PreflightJobList).ListMeta} + for _, item := range obj.(*v1beta1.PreflightJobList).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 preflightJobs. +func (c *FakePreflightJobs) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(preflightjobsResource, c.ns, opts)) + +} + +// Create takes the representation of a preflightJob and creates it. Returns the server's representation of the preflightJob, and an error, if there is any. +func (c *FakePreflightJobs) Create(preflightJob *v1beta1.PreflightJob) (result *v1beta1.PreflightJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(preflightjobsResource, c.ns, preflightJob), &v1beta1.PreflightJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.PreflightJob), err +} + +// Update takes the representation of a preflightJob and updates it. Returns the server's representation of the preflightJob, and an error, if there is any. +func (c *FakePreflightJobs) Update(preflightJob *v1beta1.PreflightJob) (result *v1beta1.PreflightJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(preflightjobsResource, c.ns, preflightJob), &v1beta1.PreflightJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.PreflightJob), 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 *FakePreflightJobs) UpdateStatus(preflightJob *v1beta1.PreflightJob) (*v1beta1.PreflightJob, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(preflightjobsResource, "status", c.ns, preflightJob), &v1beta1.PreflightJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.PreflightJob), err +} + +// Delete takes name of the preflightJob and deletes it. Returns an error if one occurs. +func (c *FakePreflightJobs) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(preflightjobsResource, c.ns, name), &v1beta1.PreflightJob{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePreflightJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(preflightjobsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.PreflightJobList{}) + return err +} + +// Patch applies the patch and returns the patched preflightJob. +func (c *FakePreflightJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.PreflightJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(preflightjobsResource, c.ns, name, pt, data, subresources...), &v1beta1.PreflightJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.PreflightJob), err +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_troubleshoot_client.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_troubleshoot_client.go new file mode 100644 index 00000000..2cf59a9b --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake/fake_troubleshoot_client.go @@ -0,0 +1,59 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeTroubleshootV1beta1 struct { + *testing.Fake +} + +func (c *FakeTroubleshootV1beta1) Analyzers(namespace string) v1beta1.AnalyzerInterface { + return &FakeAnalyzers{c, namespace} +} + +func (c *FakeTroubleshootV1beta1) AnalyzerJobs(namespace string) v1beta1.AnalyzerJobInterface { + return &FakeAnalyzerJobs{c, namespace} +} + +func (c *FakeTroubleshootV1beta1) Collectors(namespace string) v1beta1.CollectorInterface { + return &FakeCollectors{c, namespace} +} + +func (c *FakeTroubleshootV1beta1) CollectorJobs(namespace string) v1beta1.CollectorJobInterface { + return &FakeCollectorJobs{c, namespace} +} + +func (c *FakeTroubleshootV1beta1) Preflights(namespace string) v1beta1.PreflightInterface { + return &FakePreflights{c, namespace} +} + +func (c *FakeTroubleshootV1beta1) PreflightJobs(namespace string) v1beta1.PreflightJobInterface { + return &FakePreflightJobs{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeTroubleshootV1beta1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/generated_expansion.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/generated_expansion.go new file mode 100644 index 00000000..a9cfba8e --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/generated_expansion.go @@ -0,0 +1,30 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +type AnalyzerExpansion interface{} + +type AnalyzerJobExpansion interface{} + +type CollectorExpansion interface{} + +type CollectorJobExpansion interface{} + +type PreflightExpansion interface{} + +type PreflightJobExpansion interface{} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflight.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflight.go new file mode 100644 index 00000000..6bc85f13 --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflight.go @@ -0,0 +1,190 @@ +/* +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 ( + "time" + + v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PreflightsGetter has a method to return a PreflightInterface. +// A group's client should implement this interface. +type PreflightsGetter interface { + Preflights(namespace string) PreflightInterface +} + +// PreflightInterface has methods to work with Preflight resources. +type PreflightInterface interface { + Create(*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) + PreflightExpansion +} + +// preflights implements PreflightInterface +type preflights struct { + client rest.Interface + ns string +} + +// newPreflights returns a Preflights +func newPreflights(c *TroubleshootV1beta1Client, namespace string) *preflights { + return &preflights{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the preflight, and returns the corresponding preflight object, and an error if there is any. +func (c *preflights) Get(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(). + 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) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.PreflightList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("preflights"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested preflights. +func (c *preflights) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("preflights"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// 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) { + result = &v1beta1.Preflight{} + err = c.client.Post(). + Namespace(c.ns). + Resource("preflights"). + Body(preflight). + Do(). + 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) { + result = &v1beta1.Preflight{} + err = c.client.Put(). + Namespace(c.ns). + Resource("preflights"). + Name(preflight.Name). + Body(preflight). + Do(). + 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) { + result = &v1beta1.Preflight{} + err = c.client.Put(). + Namespace(c.ns). + Resource("preflights"). + Name(preflight.Name). + SubResource("status"). + Body(preflight). + Do(). + 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 { + return c.client.Delete(). + Namespace(c.ns). + Resource("preflights"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *preflights) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("preflights"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + 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) { + result = &v1beta1.Preflight{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("preflights"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflightjob.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflightjob.go new file mode 100644 index 00000000..fa1391cd --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/preflightjob.go @@ -0,0 +1,190 @@ +/* +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 ( + "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" +) + +// PreflightJobsGetter has a method to return a PreflightJobInterface. +// A group's client should implement this interface. +type PreflightJobsGetter interface { + PreflightJobs(namespace string) PreflightJobInterface +} + +// PreflightJobInterface has methods to work with PreflightJob resources. +type PreflightJobInterface interface { + Create(*v1beta1.PreflightJob) (*v1beta1.PreflightJob, error) + Update(*v1beta1.PreflightJob) (*v1beta1.PreflightJob, error) + UpdateStatus(*v1beta1.PreflightJob) (*v1beta1.PreflightJob, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta1.PreflightJob, error) + List(opts v1.ListOptions) (*v1beta1.PreflightJobList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.PreflightJob, err error) + PreflightJobExpansion +} + +// preflightJobs implements PreflightJobInterface +type preflightJobs struct { + client rest.Interface + ns string +} + +// newPreflightJobs returns a PreflightJobs +func newPreflightJobs(c *TroubleshootV1beta1Client, namespace string) *preflightJobs { + return &preflightJobs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the preflightJob, and returns the corresponding preflightJob object, and an error if there is any. +func (c *preflightJobs) Get(name string, options v1.GetOptions) (result *v1beta1.PreflightJob, err error) { + result = &v1beta1.PreflightJob{} + err = c.client.Get(). + Namespace(c.ns). + Resource("preflightjobs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PreflightJobs that match those selectors. +func (c *preflightJobs) List(opts v1.ListOptions) (result *v1beta1.PreflightJobList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.PreflightJobList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("preflightjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested preflightJobs. +func (c *preflightJobs) Watch(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("preflightjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a preflightJob and creates it. Returns the server's representation of the preflightJob, and an error, if there is any. +func (c *preflightJobs) Create(preflightJob *v1beta1.PreflightJob) (result *v1beta1.PreflightJob, err error) { + result = &v1beta1.PreflightJob{} + err = c.client.Post(). + Namespace(c.ns). + Resource("preflightjobs"). + Body(preflightJob). + Do(). + Into(result) + return +} + +// Update takes the representation of a preflightJob and updates it. Returns the server's representation of the preflightJob, and an error, if there is any. +func (c *preflightJobs) Update(preflightJob *v1beta1.PreflightJob) (result *v1beta1.PreflightJob, err error) { + result = &v1beta1.PreflightJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("preflightjobs"). + Name(preflightJob.Name). + Body(preflightJob). + Do(). + 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 *preflightJobs) UpdateStatus(preflightJob *v1beta1.PreflightJob) (result *v1beta1.PreflightJob, err error) { + result = &v1beta1.PreflightJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("preflightjobs"). + Name(preflightJob.Name). + SubResource("status"). + Body(preflightJob). + Do(). + Into(result) + return +} + +// Delete takes name of the preflightJob and deletes it. Returns an error if one occurs. +func (c *preflightJobs) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("preflightjobs"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *preflightJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("preflightjobs"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched preflightJob. +func (c *preflightJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.PreflightJob, err error) { + result = &v1beta1.PreflightJob{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("preflightjobs"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/troubleshoot_client.go b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/troubleshoot_client.go new file mode 100644 index 00000000..7940835e --- /dev/null +++ b/github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/troubleshoot_client.go @@ -0,0 +1,113 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + rest "k8s.io/client-go/rest" +) + +type TroubleshootV1beta1Interface interface { + RESTClient() rest.Interface + AnalyzersGetter + AnalyzerJobsGetter + CollectorsGetter + CollectorJobsGetter + PreflightsGetter + PreflightJobsGetter +} + +// TroubleshootV1beta1Client is used to interact with features provided by the troubleshoot.replicated.com group. +type TroubleshootV1beta1Client struct { + restClient rest.Interface +} + +func (c *TroubleshootV1beta1Client) Analyzers(namespace string) AnalyzerInterface { + return newAnalyzers(c, namespace) +} + +func (c *TroubleshootV1beta1Client) AnalyzerJobs(namespace string) AnalyzerJobInterface { + return newAnalyzerJobs(c, namespace) +} + +func (c *TroubleshootV1beta1Client) Collectors(namespace string) CollectorInterface { + return newCollectors(c, namespace) +} + +func (c *TroubleshootV1beta1Client) CollectorJobs(namespace string) CollectorJobInterface { + return newCollectorJobs(c, namespace) +} + +func (c *TroubleshootV1beta1Client) Preflights(namespace string) PreflightInterface { + return newPreflights(c, namespace) +} + +func (c *TroubleshootV1beta1Client) PreflightJobs(namespace string) PreflightJobInterface { + return newPreflightJobs(c, namespace) +} + +// NewForConfig creates a new TroubleshootV1beta1Client for the given config. +func NewForConfig(c *rest.Config) (*TroubleshootV1beta1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &TroubleshootV1beta1Client{client}, nil +} + +// NewForConfigOrDie creates a new TroubleshootV1beta1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *TroubleshootV1beta1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new TroubleshootV1beta1Client for the given RESTClient. +func New(c rest.Interface) *TroubleshootV1beta1Client { + return &TroubleshootV1beta1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1beta1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *TroubleshootV1beta1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/go.mod b/go.mod index 0299ea4b..435c0a1b 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( github.com/aws/aws-sdk-go v1.25.18 // indirect github.com/blang/semver v3.5.1+incompatible github.com/chzyer/logex v1.1.11-0.20160617073814-96a4d311aa9b // indirect - github.com/coreos/etcd v3.3.15+incompatible // indirect github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect github.com/dsnet/compress v0.0.1 // indirect github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484 // indirect @@ -17,12 +16,14 @@ require ( github.com/gin-gonic/gin v1.4.0 github.com/gizak/termui/v3 v3.1.0 github.com/go-openapi/spec v0.19.4 // indirect + github.com/go-openapi/validate v0.19.5 // indirect github.com/golang/snappy v0.0.1 // indirect github.com/google/gofuzz v1.1.0 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/hashicorp/go-getter v1.3.1-0.20190627223108-da0323b9545e github.com/hashicorp/go-multierror v1.0.0 github.com/imdario/mergo v0.3.8 // indirect + github.com/lib/pq v1.3.0 github.com/manifoldco/promptui v0.3.2 github.com/mattn/go-colorable v0.1.4 // indirect github.com/mattn/go-isatty v0.0.9 @@ -43,18 +44,20 @@ require ( github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect go.opencensus.io v0.22.0 // indirect go.undefinedlabs.com/scopeagent v0.1.7 - golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72 // indirect golang.org/x/net v0.0.0-20200202094626-16171245cfb2 // indirect golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 // indirect 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.2 - k8s.io/apiextensions-apiserver v0.17.2 - k8s.io/apimachinery v0.17.3 + k8s.io/api v0.17.4 + k8s.io/apiextensions-apiserver v0.15.12-beta.0 + k8s.io/apimachinery v0.17.4 + k8s.io/apiserver v0.17.4 // indirect k8s.io/cli-runtime v0.17.0 - k8s.io/client-go v0.17.2 + k8s.io/client-go v0.17.4 + k8s.io/code-generator v0.16.5-beta.1 // indirect sigs.k8s.io/controller-runtime v0.4.0 + sigs.k8s.io/controller-tools v0.2.4 // indirect ) replace github.com/appscode/jsonpatch => github.com/gomodules/jsonpatch v2.0.1+incompatible diff --git a/go.sum b/go.sum index 38ca9ab6..9c33ea98 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,7 @@ 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= @@ -17,6 +18,7 @@ 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= @@ -73,9 +75,12 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z github.com/coreos/bbolt v1.3.1-coreos.6/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= 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= @@ -90,6 +95,7 @@ github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2 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= @@ -115,6 +121,7 @@ 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= @@ -126,6 +133,7 @@ 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/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 h1:t8FVkw33L+wilf2QiWkw0UV77qRpcH/JHPKGpKa2E8g= @@ -148,34 +156,41 @@ 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= @@ -188,14 +203,19 @@ github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+Z 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-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/flect v0.1.5 h1:xpKq9ap8MbYfhuPCF0dBH854Gp9CxZjr/IocxELFflo= +github.com/gobuffalo/flect v0.1.5/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80= +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= @@ -221,6 +241,7 @@ 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= @@ -231,6 +252,7 @@ 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= @@ -252,6 +274,7 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/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= @@ -264,6 +287,7 @@ github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:Fecb 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-middleware v1.0.1-0.20190118093823-f849b5445de4/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-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= @@ -298,8 +322,10 @@ 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= @@ -322,6 +348,8 @@ github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= +github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a h1:weJVJJRzAJBFRlAiJQROKQs8oC9vOxvm4rZmBBk0ONw= @@ -338,6 +366,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= @@ -375,6 +404,7 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m 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= @@ -394,6 +424,7 @@ github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ 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= @@ -488,6 +519,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= @@ -566,6 +598,7 @@ 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= @@ -577,6 +610,8 @@ golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1X golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72 h1:+ELyKg6m8UBf0nPFSqD0mi7zUfwPyXo23HNjMnXPz7w= golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +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= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -623,6 +658,7 @@ 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= @@ -663,8 +699,10 @@ golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fq 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= @@ -683,6 +721,7 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 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-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= @@ -711,6 +750,7 @@ 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= @@ -723,6 +763,7 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873 h1:nfPFGzJkUDX6uBm 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= @@ -752,13 +793,16 @@ gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/R 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= @@ -767,6 +811,8 @@ 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= @@ -774,45 +820,115 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh 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.12-beta.0/go.mod h1:SeTuJQed4C1QTmlWawryIM+feNPRReglVrvv+KsbpGk= k8s.io/api v0.17.0 h1:H9d/lw+VkZKEVIUc8F3wgiQ+FUXTTr21M87jXLU7yqM= k8s.io/api v0.17.0/go.mod h1:npsyOePkeP0CPwyGfXDHxvypiYMJxBWAMpQxCaJ4ZxI= +k8s.io/api v0.17.1-beta.0/go.mod h1:t+ColJ7ZemYM/LXgLo4sVuO86DluzcnNHVKfZK4irZM= +k8s.io/api v0.17.1/go.mod h1:zxiAc5y8Ngn4fmhWUtSxuUlkfz1ixT7j9wESokELzOg= k8s.io/api v0.17.2 h1:NF1UFXcKN7/OOv1uxdRz3qfra8AHsPav5M93hlV9+Dc= k8s.io/api v0.17.2/go.mod h1:BS9fjjLc4CMuqfSO8vgbHPKMt5+SF0ET6u/RVDihTo4= +k8s.io/api v0.17.3-beta.0/go.mod h1:II7E2nD74NziEP/I5++IpJ/E4xAnLSVSxsWjEY7nTJc= +k8s.io/api v0.17.3/go.mod h1:YZ0OTkuw7ipbe305fMpIdf3GLXZKRigjtZaV5gzC2J0= +k8s.io/api v0.17.4-beta.0/go.mod h1:GvrPCgJXMjQy7jNXQyJTEtLb97iKYOPIRHf12YpPgsg= +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.12-beta.0 h1:6+6t58za7f5ZwtuCz3zQAkCtn5pKYaSTbPTb3PO3vJA= +k8s.io/apiextensions-apiserver v0.15.12-beta.0/go.mod h1:8Rm/f9mZoGC5Voo4UJjDjsjIoMLAIOVnp2aQ/WCbZiA= +k8s.io/apiextensions-apiserver v0.16.4/go.mod h1:HYQwjujEkXmQNhap2C9YDdIVOSskGZ3et0Mvjcyjbto= +k8s.io/apiextensions-apiserver v0.16.5-beta.0/go.mod h1:pJQvHLCa1NhD0xrfUVjdK04J1R5gXTlmoRhF6e1fF3U= +k8s.io/apiextensions-apiserver v0.16.5-beta.1/go.mod h1:txaziO41KVDNj8knXv8PmmWRDikdmwcLRIPRBA8jEGY= +k8s.io/apiextensions-apiserver v0.16.5/go.mod h1:hxCqHs7KmsPJBF8u2f0VvXQBfFKqHPvXr6GC9/UPQ1E= +k8s.io/apiextensions-apiserver v0.16.6-beta.0/go.mod h1:BIz5vp2CGiLZN/Ag72aqICAkXCJbYnvbUQfzbD4fG4c= +k8s.io/apiextensions-apiserver v0.16.6/go.mod h1:WbwakFromAVhfvLITDk5nRf5UJJwazjeZRx+yKeDcY0= +k8s.io/apiextensions-apiserver v0.16.7-beta.0/go.mod h1:r5ZGIXJyVU+i26QvWASjFjn8cL4b1V5fiaU7xLq6AB8= +k8s.io/apiextensions-apiserver v0.16.7/go.mod h1:6xYRp4trGp6eT5WZ6tPi/TB2nfWQCzwUvBlpg8iswe0= +k8s.io/apiextensions-apiserver v0.16.8-beta.0/go.mod h1:/98faDWCaBZm4Bekzs+/I3l+9dJSstuIAyi6tru0vDk= +k8s.io/apiextensions-apiserver v0.16.8/go.mod h1:R989okvPLerXtLjflp2PROO8mNH+rdW9WAxlD/aQcmw= +k8s.io/apiextensions-apiserver v0.16.9-beta.0/go.mod h1:+hR//QX2aHYvtcWrCQLEFKLPTIIF/z54OraK9r84SlY= +k8s.io/apiextensions-apiserver v0.17.0/go.mod h1:XiIFUakZywkUl54fVXa7QTEHcqQz9HG55nHd1DCoHj8= +k8s.io/apiextensions-apiserver v0.17.1-beta.0/go.mod h1:nAWs3hR7mcARaOgVnu790Kxmv8axnwXkkCdry5gOC04= +k8s.io/apiextensions-apiserver v0.17.1/go.mod h1:DRIFH5x3jalE4rE7JP0MQKby9zdYk9lUJQuMmp+M/L0= k8s.io/apiextensions-apiserver v0.17.2 h1:cP579D2hSZNuO/rZj9XFRzwJNYb41DbNANJb6Kolpss= k8s.io/apiextensions-apiserver v0.17.2/go.mod h1:4KdMpjkEjjDI2pPfBA15OscyNldHWdBCfsWMDWAmSTs= +k8s.io/apiextensions-apiserver v0.17.3-beta.0/go.mod h1:Q5Lyewxl3AQAbJRnKyFOWmwxUatTvyDRBbJ3ewMsgm4= +k8s.io/apiextensions-apiserver v0.17.3/go.mod h1:CJbCyMfkKftAd/X/V6OTHYhVn7zXnDdnkUjS1h0GTeY= +k8s.io/apiextensions-apiserver v0.17.4-beta.0/go.mod h1:kFrCjhzJWXDbZX6ZEH50Io8CR8jCw31sNVYcO5M9NQw= +k8s.io/apiextensions-apiserver v0.17.4 h1:ZKFnw3cJrGZ/9s6y+DerTF4FL+dmK0a04A++7JkmMho= +k8s.io/apiextensions-apiserver v0.17.4/go.mod h1:rCbbbaFS/s3Qau3/1HbPlHblrWpFivoaLYccCffvQGI= k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655/go.mod h1:nL6pwRT8NgfF8TT68DBI8uEePRt89cSvoXUVqbkWHq4= +k8s.io/apimachinery v0.15.12-beta.0/go.mod h1:ZRw+v83FjgEqlzqaBkxL3XB21MSLYdzjsY9Bgxclhdw= k8s.io/apimachinery v0.17.0 h1:xRBnuie9rXcPxUkDizUsGvPf1cnlZCFu210op7J7LJo= k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= +k8s.io/apimachinery v0.17.1-beta.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= +k8s.io/apimachinery v0.17.1/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= k8s.io/apimachinery v0.17.2 h1:hwDQQFbdRlpnnsR64Asdi55GyCaIP/3WQpMmbNBeWr4= k8s.io/apimachinery v0.17.2/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= +k8s.io/apimachinery v0.17.3-beta.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= k8s.io/apimachinery v0.17.3 h1:f+uZV6rm4/tHE7xXgLyToprg6xWairaClGVkm2t8omg= k8s.io/apimachinery v0.17.3/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g= +k8s.io/apimachinery v0.17.4-beta.0/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g= +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.12-beta.0/go.mod h1:8jB/rq3MrxjXmRNKxH5Uo+TmUndNG+fF91H8wIw2SKs= +k8s.io/apiserver v0.17.0/go.mod h1:ABM+9x/prjINN6iiffRVNCBR2Wk7uY4z+EtEGZD48cg= +k8s.io/apiserver v0.17.1-beta.0/go.mod h1:xxqssZuE9bBKTvpkRKvhXPH1H/kfcqb3iwws5xT0+M0= +k8s.io/apiserver v0.17.1/go.mod h1:BQEUObJv8H6ZYO7DeKI5vb50tjk6paRJ4ZhSyJsiSco= k8s.io/apiserver v0.17.2/go.mod h1:lBmw/TtQdtxvrTk0e2cgtOxHizXI+d0mmGQURIHQZlo= +k8s.io/apiserver v0.17.3-beta.0/go.mod h1:3w+4efyQs28hCv8c9jfRkm5hjCaWbGKlzk9MLKHt7Kc= +k8s.io/apiserver v0.17.3/go.mod h1:iJtsPpu1ZpEnHaNawpSV0nYTGBhhX2dUlnn7/QS7QiY= +k8s.io/apiserver v0.17.4-beta.0/go.mod h1:D9CFsgN1LrGE1dMKxBkFV+0ho/4v2eeJvJOWrCBIz/0= +k8s.io/apiserver v0.17.4/go.mod h1:5ZDQ6Xr5MNBxyi3iUZXS84QOhZl+W7Oq2us/29c0j9I= k8s.io/cli-runtime v0.17.0 h1:XEuStbJBHCQlEKFyTQmceDKEWOSYHZkcYWKp3SsQ9Hk= k8s.io/cli-runtime v0.17.0/go.mod h1:1E5iQpMODZq2lMWLUJELwRu2MLWIzwvMgDBpn3Y81Qo= k8s.io/client-go v0.0.0-20190918160344-1fbdaa4c8d90/go.mod h1:J69/JveO6XESwVgG53q3Uz5OSfgsv4uxpScmmyYOOlk= +k8s.io/client-go v0.15.12-beta.0/go.mod h1:ytfQFnpRiHki2QY+iyAYxMbq+Cc/aj6VVmPMDYzleQE= k8s.io/client-go v0.17.0 h1:8QOGvUGdqDMFrm9sD6IUFl256BcffynGoe80sxgTEDg= k8s.io/client-go v0.17.0/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k= +k8s.io/client-go v0.17.1-beta.0/go.mod h1:gzW655fKPI4D5ixyLPt+KzggYNvSbo5KHn1s7Vz0/mA= +k8s.io/client-go v0.17.1/go.mod h1:HZtHJSC/VuSHcETN9QA5QDZky1tXiYrkF/7t7vRpO1A= k8s.io/client-go v0.17.2 h1:ndIfkfXEGrNhLIgkr0+qhRguSD3u6DCmonepn1O6NYc= k8s.io/client-go v0.17.2/go.mod h1:QAzRgsa0C2xl4/eVpeVAZMvikCn8Nm81yqVx3Kk9XYI= +k8s.io/client-go v0.17.3-beta.0/go.mod h1:gGGockCrvyM7XcJzBuqWCxCt77QwOZY9BlWpAqxw204= +k8s.io/client-go v0.17.3/go.mod h1:cLXlTMtWHkuK4tD360KpWz2gG2KtdWEr/OT02i3emRQ= +k8s.io/client-go v0.17.4-beta.0/go.mod h1:jdUo+qJEoO+1LSTIdT1gjYf+g8Hvc2G27yqwBSRWDFE= +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.12-beta.0/go.mod h1:G8bQwmHm2eafm5bgtX67XDZQ8CWKSGu9DekI+yN4Y5I= +k8s.io/code-generator v0.16.5-beta.1 h1:+zWxMQH3a6fd8lZe6utWyW/V7nmG2ZMXwtovSJI2p+0= +k8s.io/code-generator v0.16.5-beta.1/go.mod h1:mJUgkl06XV4kstAnLHAIzJPVCOzVR+ZcfPIv4fUsFCY= +k8s.io/code-generator v0.17.2 h1:pTwl3rLB1fUyxmvEzmVPMM0tBSdUehd7z+bDzpj4lPE= k8s.io/code-generator v0.17.2/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s= +k8s.io/code-generator v0.17.4 h1:C3uu/IvQclEIO4ouUOXuoKWfc4765mYe0uebStg9CaY= +k8s.io/code-generator v0.17.4/go.mod h1:l8BLVwASXQZTo2xamW5mQNFCe1XPiAesVq7Y1t7PiQQ= k8s.io/component-base v0.0.0-20190918160511-547f6c5d7090/go.mod h1:933PBGtQFJky3TEwYx4aEPZ4IxqhWh3R6DCmzqIn1hA= +k8s.io/component-base v0.15.12-beta.0/go.mod h1:jRj5HNzJOrJYcmdWD76c3tlTJXuBMzz5vWHVSqm5e3s= +k8s.io/component-base v0.17.0/go.mod h1:rKuRAokNMY2nn2A6LP/MiwpoaMRHpfRnrPaUJJj1Yoc= +k8s.io/component-base v0.17.1-beta.0/go.mod h1:1XvPfIerYmU92lLkCPsJS3z6SDVUEZP74CmJ/gtpTeU= +k8s.io/component-base v0.17.1/go.mod h1:LrBPZkXtlvGjBzDJa0+b7E5Ij4VoAAKrOGudRC5z2eY= k8s.io/component-base v0.17.2/go.mod h1:zMPW3g5aH7cHJpKYQ/ZsGMcgbsA/VyhEugF3QT1awLs= +k8s.io/component-base v0.17.3-beta.0/go.mod h1:+mpaQoQGz+U8vcy33M6XQyavg+EzVPLMgAsvLPfO5oQ= +k8s.io/component-base v0.17.3/go.mod h1:GeQf4BrgelWm64PXkIXiPh/XS0hnO42d9gx9BtbZRp8= +k8s.io/component-base v0.17.4-beta.0/go.mod h1:+xMhnjtdsA69bNdgm6F+poz/CNgNTBkLBTaoX6RIDpY= +k8s.io/component-base v0.17.4/go.mod h1:5BRqHMbbQPm2kKu35v3G+CpVq4K0RJKC7TRioF0I9lE= +k8s.io/gengo v0.0.0-20190116091435-f8a0810f38af/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= 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/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/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/utils v0.0.0-20191114184206-e782cd3c129f h1:GiPwtSzdP43eI1hpPCbROQCCIgCuiMMNF8YUVLF3vJo= k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= @@ -823,8 +939,11 @@ 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/controller-tools v0.2.4 h1:la1h46EzElvWefWLqfsXrnsO3lZjpkI0asTpX6h8PLA= +sigs.k8s.io/controller-tools v0.2.4/go.mod h1:m/ztfQNocGYBgTTCmFdnK94uVvgxeZeE3LtJvd/jIzA= 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/go.mod h1:IIgPezJWb76P0hotTxzDbWsMYB8APh18qZnxkomBpxA= sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06/go.mod h1:/ULNhyfzRopfcjskuui0cTITekDduZ7ycKN3oUT9R18= diff --git a/pkg/analyze/analyzer.go b/pkg/analyze/analyzer.go index 4ac6b52a..ff758676 100644 --- a/pkg/analyze/analyzer.go +++ b/pkg/analyze/analyzer.go @@ -157,6 +157,16 @@ func Analyze(analyzer *troubleshootv1beta1.Analyze, getFile getCollectedFileCont } return analyzeTextAnalyze(analyzer.TextAnalyze, getFile) } + if analyzer.PostgresAnalyze != nil { + isExcluded, err := isExcluded(analyzer.PostgresAnalyze.Exclude) + if err != nil { + return nil, err + } + if isExcluded { + return nil, nil + } + return analyzePostgresAnalyze(analyzer.PostgresAnalyze, getFile) + } return nil, errors.New("invalid analyzer") } diff --git a/pkg/analyze/postgres_analyze.go b/pkg/analyze/postgres_analyze.go new file mode 100644 index 00000000..cbd521c6 --- /dev/null +++ b/pkg/analyze/postgres_analyze.go @@ -0,0 +1,154 @@ +package analyzer + +import ( + "encoding/json" + "fmt" + "path" + "strconv" + "strings" + + "github.com/blang/semver" + "github.com/pkg/errors" + troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + "github.com/replicatedhq/troubleshoot/pkg/collect" +) + +func analyzePostgresAnalyze(analyzer *troubleshootv1beta1.PostgresAnalyze, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { + collectorName := analyzer.CollectorName + if collectorName == "" { + collectorName = "postgres" + } + + fullPath := path.Join("postgres", fmt.Sprintf("%s.json", collectorName)) + + collected, err := getCollectedFileContents(fullPath) + if err != nil { + return nil, errors.Wrapf(err, "failed to read collected file name: %s", fullPath) + } + + databaseConnection := collect.DatabaseConnection{} + if err := json.Unmarshal(collected, &databaseConnection); err != nil { + return nil, errors.Wrap(err, "failed to unmarshal databased connection result") + } + + checkName := analyzer.CheckName + if checkName == "" { + checkName = collectorName + } + + result := &AnalyzeResult{ + Title: checkName, + IconKey: "kubernetes_postgres_analyze", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/postgres-analyze.svg", + } + + for _, outcome := range analyzer.Outcomes { + if outcome.Fail != nil { + if outcome.Fail.When == "" { + result.IsFail = true + result.Message = outcome.Fail.Message + result.URI = outcome.Fail.URI + + return result, nil + } + + isMatch, err := compareDatabaseConditionalToActual(outcome.Fail.When, &databaseConnection) + if err != nil { + return result, errors.Wrap(err, "failed to compare postgres database conditional") + } + + if isMatch { + result.IsFail = true + result.Message = outcome.Fail.Message + result.URI = outcome.Fail.URI + + return result, nil + } + } else if outcome.Warn != nil { + if outcome.Pass.When == "" { + result.IsWarn = true + result.Message = outcome.Warn.Message + result.URI = outcome.Warn.URI + + return result, nil + } + + isMatch, err := compareDatabaseConditionalToActual(outcome.Warn.When, &databaseConnection) + if err != nil { + return result, errors.Wrap(err, "failed to compare postgres database conditional") + } + + if isMatch { + result.IsWarn = true + result.Message = outcome.Warn.Message + result.URI = outcome.Warn.URI + + return result, nil + } + } else if outcome.Pass != nil { + if outcome.Pass.When == "" { + result.IsPass = true + result.Message = outcome.Pass.Message + result.URI = outcome.Pass.URI + + return result, nil + } + + isMatch, err := compareDatabaseConditionalToActual(outcome.Pass.When, &databaseConnection) + if err != nil { + return result, errors.Wrap(err, "failed to compare postgres database conditional") + } + + if isMatch { + result.IsPass = true + result.Message = outcome.Pass.Message + result.URI = outcome.Pass.URI + + return result, nil + } + } + } + + return result, nil +} + +func compareDatabaseConditionalToActual(conditional string, result *collect.DatabaseConnection) (bool, error) { + parts := strings.Split(strings.TrimSpace(conditional), " ") + + if len(parts) != 3 { + return false, errors.New("unable to parse conditional") + } + + switch parts[0] { + case "connected": + expected, err := strconv.ParseBool(parts[2]) + if err != nil { + return false, errors.Wrap(err, "failed to parse bool") + } + + switch parts[1] { + case "=", "==", "===": + return expected == result.IsConnected, nil + case "!=", "!==": + return expected != result.IsConnected, nil + + } + + return false, errors.New("unable to parse postgres connected analyzer") + + case "version": + expectedRange, err := semver.ParseRange(fmt.Sprintf("%s %s", parts[1], parts[2])) + if err != nil { + return false, errors.Wrap(err, "failed to parse semver range") + } + + actual, err := semver.Parse(result.Version) + if err != nil { + return false, errors.Wrap(err, "failed to parse actual psotgres version") + } + + return expectedRange(actual), nil + } + + return false, nil +} diff --git a/pkg/analyze/postgres_analyze_test.go b/pkg/analyze/postgres_analyze_test.go new file mode 100644 index 00000000..b09f55cc --- /dev/null +++ b/pkg/analyze/postgres_analyze_test.go @@ -0,0 +1,76 @@ +package analyzer + +import ( + "testing" + + "github.com/replicatedhq/troubleshoot/pkg/collect" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.undefinedlabs.com/scopeagent" +) + +func Test_compareDatabaseConditionalToActual(t *testing.T) { + tests := []struct { + name string + conditional string + result collect.DatabaseConnection + expectedMatch bool + }{ + { + name: "not connected, expected not connected", + conditional: "connected == false", + result: collect.DatabaseConnection{ + IsConnected: false, + }, + expectedMatch: true, + }, + { + name: "connected, expected connected", + conditional: "connected == true", + result: collect.DatabaseConnection{ + IsConnected: true, + }, + expectedMatch: true, + }, + { + name: "not connected, expected connected", + conditional: "connected == true", + result: collect.DatabaseConnection{ + IsConnected: false, + }, + expectedMatch: false, + }, + { + name: "version 9.3.0, want > 10.0.0", + conditional: "version >= 10.0.0", + result: collect.DatabaseConnection{ + IsConnected: true, + Version: "9.3.0", + }, + expectedMatch: false, + }, + { + name: "version 12.0.0, want > 10.0.0", + conditional: "version >= 10.0.0", + result: collect.DatabaseConnection{ + IsConnected: true, + Version: "12.0.0", + }, + expectedMatch: true, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + scopetest := scopeagent.StartTest(t) + defer scopetest.End() + req := require.New(t) + + actual, err := compareDatabaseConditionalToActual(test.conditional, &test.result) + req.NoError(err) + + assert.Equal(t, test.expectedMatch, actual) + + }) + } +} diff --git a/pkg/analyze/text_analyze.go b/pkg/analyze/text_analyze.go index f1e5a5ff..18e1bd93 100644 --- a/pkg/analyze/text_analyze.go +++ b/pkg/analyze/text_analyze.go @@ -31,7 +31,7 @@ func analyzeTextAnalyze(analyzer *troubleshootv1beta1.TextAnalyze, getCollectedF } return &AnalyzeResult{ - Title: analyzer.CheckName, + Title: checkName, IconKey: "kubernetes_text_analyze", IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg", IsFail: true, diff --git a/pkg/apis/troubleshoot/v1beta1/analyzer_shared.go b/pkg/apis/troubleshoot/v1beta1/analyzer_shared.go index ff89c83e..a1f0fb20 100644 --- a/pkg/apis/troubleshoot/v1beta1/analyzer_shared.go +++ b/pkg/apis/troubleshoot/v1beta1/analyzer_shared.go @@ -53,7 +53,6 @@ type ImagePullSecret struct { Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` RegistryName string `json:"registryName" yaml:"registryName"` } - type DeploymentStatus struct { AnalyzeMeta `json:",inline" yaml:",inline"` Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` @@ -104,6 +103,13 @@ type TextAnalyze struct { Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` } +type PostgresAnalyze struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` + CollectorName string `json:"collectorName" yaml:"collectorName"` + FileName string `json:"fileName,omitempty" yaml:"fileName,omitempty"` +} + type AnalyzeMeta struct { CheckName string `json:"checkName,omitempty" yaml:"checkName,omitempty"` Exclude multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"` @@ -122,4 +128,5 @@ type Analyze struct { Distribution *Distribution `json:"distribution,omitempty" yaml:"distribution,omitempty"` NodeResources *NodeResources `json:"nodeResources,omitempty" yaml:"nodeResources,omitempty"` TextAnalyze *TextAnalyze `json:"textAnalyze,omitempty" yaml:"textAnalyze,omitempty"` + PostgresAnalyze *PostgresAnalyze `json:"postgres,omitempty" yaml:"postgres,omitempty"` } diff --git a/pkg/apis/troubleshoot/v1beta1/collector_shared.go b/pkg/apis/troubleshoot/v1beta1/collector_shared.go index fa8ae993..c78bc108 100644 --- a/pkg/apis/troubleshoot/v1beta1/collector_shared.go +++ b/pkg/apis/troubleshoot/v1beta1/collector_shared.go @@ -109,6 +109,11 @@ type Put struct { Body string `json:"body,omitempty" yaml:"body,omitempty"` } +type Postgres struct { + CollectorMeta `json:",inline" yaml:",inline"` + URI string `json:"uri" yaml:"uri"` +} + type Collect struct { ClusterInfo *ClusterInfo `json:"clusterInfo,omitempty" yaml:"clusterInfo,omitempty"` ClusterResources *ClusterResources `json:"clusterResources,omitempty" yaml:"clusterResources,omitempty"` @@ -119,6 +124,7 @@ type Collect struct { Data *Data `json:"data,omitempty" yaml:"data,omitempty"` Copy *Copy `json:"copy,omitempty" yaml:"copy,omitempty"` HTTP *HTTP `json:"http,omitempty" yaml:"http,omitempty"` + Postgres *Postgres `json:"postgres,omitempty" yaml:"postgres,omitempty"` } func (c *Collect) AccessReviewSpecs(overrideNS string) []authorizationv1.SelfSubjectAccessReviewSpec { diff --git a/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go b/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go index bc5cece2..9df6565c 100644 --- a/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go @@ -112,6 +112,11 @@ func (in *Analyze) DeepCopyInto(out *Analyze) { *out = new(TextAnalyze) (*in).DeepCopyInto(*out) } + if in.PostgresAnalyze != nil { + in, out := &in.PostgresAnalyze, &out.PostgresAnalyze + *out = new(PostgresAnalyze) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Analyze. @@ -463,6 +468,11 @@ func (in *Collect) DeepCopyInto(out *Collect) { *out = new(HTTP) (*in).DeepCopyInto(*out) } + if in.Postgres != nil { + in, out := &in.Postgres, &out.Postgres + *out = new(Postgres) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Collect. @@ -1150,6 +1160,49 @@ func (in *Post) DeepCopy() *Post { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Postgres) DeepCopyInto(out *Postgres) { + *out = *in + out.CollectorMeta = in.CollectorMeta +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Postgres. +func (in *Postgres) DeepCopy() *Postgres { + if in == nil { + return nil + } + out := new(Postgres) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PostgresAnalyze) DeepCopyInto(out *PostgresAnalyze) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + if in.Outcomes != nil { + in, out := &in.Outcomes, &out.Outcomes + *out = make([]*Outcome, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Outcome) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresAnalyze. +func (in *PostgresAnalyze) DeepCopy() *PostgresAnalyze { + if in == nil { + return nil + } + out := new(PostgresAnalyze) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Preflight) DeepCopyInto(out *Preflight) { *out = *in diff --git a/pkg/collect/collector.go b/pkg/collect/collector.go index 9aa3880e..31c96b1a 100644 --- a/pkg/collect/collector.go +++ b/pkg/collect/collector.go @@ -131,6 +131,16 @@ func (c *Collector) RunCollectorSync() ([]byte, error) { } return HTTP(c.GetContext(), c.Collect.HTTP) } + if c.Collect.Postgres != nil { + isExcluded, err := isExcluded(c.Collect.Postgres.Exclude) + if err != nil { + return nil, err + } + if isExcluded { + return nil, nil + } + return Postgres(c.GetContext(), c.Collect.Postgres) + } return nil, errors.New("no spec found to run") } diff --git a/pkg/collect/postgres.go b/pkg/collect/postgres.go new file mode 100644 index 00000000..5d4263c8 --- /dev/null +++ b/pkg/collect/postgres.go @@ -0,0 +1,59 @@ +package collect + +import ( + "database/sql" + "encoding/json" + "fmt" + + _ "github.com/lib/pq" + "github.com/pkg/errors" + troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" +) + +type PostgresOutput map[string][]byte + +type DatabaseConnection struct { + IsConnected bool `json:"isConnected"` + Error string `json:"error"` + Version string `json:"version"` +} + +func Postgres(ctx *Context, postgresCollector *troubleshootv1beta1.Postgres) ([]byte, error) { + databaseConnection := DatabaseConnection{} + + db, err := sql.Open("postgres", postgresCollector.URI) + if err != nil { + databaseConnection.Error = err.Error() + } else { + query := `select version()` + row := db.QueryRow(query) + version := "" + if err := row.Scan(&version); err != nil { + databaseConnection.Error = err.Error() + } else { + databaseConnection.IsConnected = true + databaseConnection.Version = version + } + } + + b, err := json.Marshal(databaseConnection) + if err != nil { + return nil, errors.Wrap(err, "failed to marshal database connection") + } + + collectorName := postgresCollector.CollectorName + if collectorName == "" { + collectorName = "postgres" + } + + postgresOutput := map[string][]byte{ + fmt.Sprintf("postgres/%s.json", collectorName): b, + } + + bb, err := json.Marshal(postgresOutput) + if err != nil { + return nil, errors.Wrap(err, "failed to marshal postgres output") + } + + return bb, nil +} diff --git a/pkg/collect/secret.go b/pkg/collect/secret.go index 64db4291..99a401e4 100644 --- a/pkg/collect/secret.go +++ b/pkg/collect/secret.go @@ -17,6 +17,7 @@ type FoundSecret struct { KeyExists bool `json:"keyExists"` Value string `json:"value,omitempty"` } + type SecretOutput struct { FoundSecret map[string][]byte `json:"secrets/,omitempty"` Errors map[string][]byte `json:"secrets-errors/,omitempty"` diff --git a/pkg/server/collector.go b/pkg/server/collector.go deleted file mode 100644 index 7993429c..00000000 --- a/pkg/server/collector.go +++ /dev/null @@ -1,53 +0,0 @@ -package server - -import ( - "context" - "encoding/base64" - "io/ioutil" - "net/http" - - "github.com/gin-gonic/gin" -) - -var collectorQueue = make(map[string][]byte) - -func ServeCollector(ctx context.Context, address string) { - g := gin.New() - - root := g.Group("/") - root.PUT("/", putCollectorOutput) - root.GET("/", getQueuedCollectors) - root.GET("/collector/:id", getCollectorOutput) - - srvr := http.Server{Addr: address, Handler: g} - go func() { - srvr.ListenAndServe() - }() -} - -func putCollectorOutput(c *gin.Context) { - collectorID := c.Request.Header.Get("collector-id") - - body, err := ioutil.ReadAll(c.Request.Body) - if err != nil { - c.AbortWithStatus(500) - return - } - - collectorQueue[collectorID] = body - c.Status(201) -} - -func getCollectorOutput(c *gin.Context) { - encoded := base64.StdEncoding.EncodeToString(collectorQueue[c.Param("id")]) - c.String(200, encoded) -} - -func getQueuedCollectors(c *gin.Context) { - keys := make([]string, 0, len(collectorQueue)) - for k := range collectorQueue { - keys = append(keys, k) - } - - c.JSON(200, keys) -} diff --git a/pkg/server/preflight.go b/pkg/server/preflight.go deleted file mode 100644 index 6c90dbda..00000000 --- a/pkg/server/preflight.go +++ /dev/null @@ -1,56 +0,0 @@ -package server - -import ( - "context" - "encoding/base64" - "io/ioutil" - "net/http" - - "github.com/gin-gonic/gin" - "github.com/replicatedhq/troubleshoot/pkg/logger" -) - -var preflightQueue = make(map[string][]byte) - -func ServePreflight(ctx context.Context, address string) { - g := gin.New() - - root := g.Group("/") - root.PUT("/", putPreflightOutput) - root.GET("/", getQueuedPreflights) - root.GET("/preflight/:id", getPreflightOutput) - - srvr := http.Server{Addr: address, Handler: g} - go func() { - srvr.ListenAndServe() - }() -} - -func putPreflightOutput(c *gin.Context) { - preflightID := c.Request.Header.Get("collector-id") - - body, err := ioutil.ReadAll(c.Request.Body) - if err != nil { - c.AbortWithStatus(500) - return - } - - preflightQueue[preflightID] = body - - logger.Printf("preflightQueue = %#v\n", preflightQueue) - c.Status(201) -} - -func getPreflightOutput(c *gin.Context) { - encoded := base64.StdEncoding.EncodeToString(preflightQueue[c.Param("id")]) - c.String(200, encoded) -} - -func getQueuedPreflights(c *gin.Context) { - keys := make([]string, 0, len(preflightQueue)) - for k := range preflightQueue { - keys = append(keys, k) - } - - c.JSON(200, keys) -}