diff --git a/Makefile b/Makefile index d4806f7f6..1dc81c411 100644 --- a/Makefile +++ b/Makefile @@ -74,11 +74,13 @@ generate: controller-gen client-gen --clientset-name troubleshootclientset \ --input-base github.com/replicatedhq/troubleshoot/pkg/apis \ --input troubleshoot/v1beta1 \ + --input troubleshoot/v1beta2 \ -h ./hack/boilerplate.go.txt .PHONY: openapischema openapischema: controller-gen controller-gen crd +output:dir=./config/crds paths=./pkg/apis/troubleshoot/v1beta1 + controller-gen crd +output:dir=./config/crds paths=./pkg/apis/troubleshoot/v1beta2 .PHONY: schemas schemas: fmt vet openapischema diff --git a/cmd/preflight/cli/run.go b/cmd/preflight/cli/run.go index 38685d8ab..68eb03cce 100644 --- a/cmd/preflight/cli/run.go +++ b/cmd/preflight/cli/run.go @@ -11,8 +11,9 @@ import ( "github.com/fatih/color" "github.com/pkg/errors" "github.com/replicatedhq/troubleshoot/cmd/util" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" troubleshootclientsetscheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + "github.com/replicatedhq/troubleshoot/pkg/docrewrite" "github.com/replicatedhq/troubleshoot/pkg/preflight" "github.com/spf13/viper" spin "github.com/tj/go-spin" @@ -23,7 +24,7 @@ func runPreflights(v *viper.Viper, arg string) error { fmt.Print(cursor.Hide()) defer fmt.Print(cursor.Show()) - preflightContent := "" + var preflightContent []byte var err error if _, err = os.Stat(arg); err == nil { b, err := ioutil.ReadFile(arg) @@ -31,7 +32,7 @@ func runPreflights(v *viper.Viper, arg string) error { return err } - preflightContent = string(b) + preflightContent = b } else { if !util.IsURL(arg) { return fmt.Errorf("%s is not a URL and was not found (err %s)", arg, err) @@ -41,7 +42,7 @@ func runPreflights(v *viper.Viper, arg string) error { if err != nil { return err } - req.Header.Set("User-Agent", "Replicated_Preflight/v1beta1") + req.Header.Set("User-Agent", "Replicated_Preflight/v1beta2") resp, err := http.DefaultClient.Do(req) if err != nil { return err @@ -53,7 +54,12 @@ func runPreflights(v *viper.Viper, arg string) error { return err } - preflightContent = string(body) + preflightContent = body + } + + preflightContent, err = docrewrite.ConvertToV1Beta2(preflightContent) + if err != nil { + return errors.Wrap(err, "failed to convert to v1beta2") } troubleshootclientsetscheme.AddToScheme(scheme.Scheme) @@ -63,7 +69,7 @@ func runPreflights(v *viper.Viper, arg string) error { return errors.Wrapf(err, "failed to parse %s", arg) } - preflightSpec := obj.(*troubleshootv1beta1.Preflight) + preflightSpec := obj.(*troubleshootv1beta2.Preflight) s := spin.New() finishedCh := make(chan bool, 1) diff --git a/cmd/preflight/cli/util.go b/cmd/preflight/cli/util.go deleted file mode 100644 index 5fe0ffdf4..000000000 --- a/cmd/preflight/cli/util.go +++ /dev/null @@ -1,21 +0,0 @@ -package cli - -import ( - "github.com/pkg/errors" - troubleshootclientv1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1" - "k8s.io/cli-runtime/pkg/genericclioptions" -) - -func createTroubleshootK8sClient(configFlags *genericclioptions.ConfigFlags) (*troubleshootclientv1beta1.TroubleshootV1beta1Client, error) { - config, err := configFlags.ToRESTConfig() - if err != nil { - return nil, errors.Wrap(err, "failed to convert kube flags to rest config") - } - - troubleshootClient, err := troubleshootclientv1beta1.NewForConfig(config) - if err != nil { - return nil, errors.Wrap(err, "failed to create troubleshoot client") - } - - return troubleshootClient, nil -} diff --git a/cmd/schemagen/cli/root.go b/cmd/schemagen/cli/root.go index 7502c4183..9b862f6bf 100644 --- a/cmd/schemagen/cli/root.go +++ b/cmd/schemagen/cli/root.go @@ -62,44 +62,60 @@ func generateSchemas(v *viper.Viper) error { return errors.Wrap(err, "failed to get workdir") } - preflightContents, err := ioutil.ReadFile(filepath.Join(workdir, "config", "crds", "troubleshoot.replicated.com_preflights.yaml")) - if err != nil { - return errors.Wrap(err, "failed to read preflight crd") - } - if err := generateSchemaFromCRD(preflightContents, filepath.Join(workdir, v.GetString("output-dir"), "preflight-troubleshoot-v1beta1.json")); err != nil { - return errors.Wrap(err, "failed to write preflight schema") - } - - analyzersContents, err := ioutil.ReadFile(filepath.Join(workdir, "config", "crds", "troubleshoot.replicated.com_analyzers.yaml")) - if err != nil { - return errors.Wrap(err, "failed to read analyzers crd") - } - if err := generateSchemaFromCRD(analyzersContents, filepath.Join(workdir, v.GetString("output-dir"), "analyzer-troubleshoot-v1beta1.json")); err != nil { - return errors.Wrap(err, "failed to write analyzers schema") - } - - collectorsContents, err := ioutil.ReadFile(filepath.Join(workdir, "config", "crds", "troubleshoot.replicated.com_collectors.yaml")) - if err != nil { - return errors.Wrap(err, "failed to read collectors crd") - } - if err := generateSchemaFromCRD(collectorsContents, filepath.Join(workdir, v.GetString("output-dir"), "collector-troubleshoot-v1beta1.json")); err != nil { - return errors.Wrap(err, "failed to write collectors schema") - } - - redactorsContents, err := ioutil.ReadFile(filepath.Join(workdir, "config", "crds", "troubleshoot.replicated.com_redactors.yaml")) - if err != nil { - return errors.Wrap(err, "failed to read redactors crd") - } - if err := generateSchemaFromCRD(redactorsContents, filepath.Join(workdir, v.GetString("output-dir"), "redactor-troubleshoot-v1beta1.json")); err != nil { - return errors.Wrap(err, "failed to write redactors schema") + files := []struct { + inFilename string + outFilename string + }{ + { + "troubleshoot.replicated.com_preflights.yaml", + "preflight-troubleshoot-v1beta1.json", + }, + { + "troubleshoot.replicated.com_analyzers.yaml", + "analyzer-troubleshoot-v1beta1.json", + }, + { + "troubleshoot.replicated.com_collectors.yaml", + "collector-troubleshoot-v1beta1.json", + }, + { + "troubleshoot.replicated.com_redactors.yaml", + "redactor-troubleshoot-v1beta1.json", + }, + { + "troubleshoot.replicated.com_supportbundles.yaml", + "supportbundle-troubleshoot-v1beta1.json", + }, + { + "troubleshoot.sh_analyzers.yaml", + "analyzer-troubleshoot-v1beta2.json", + }, + { + "troubleshoot.sh_collectors.yaml", + "collector-troubleshoot-v1beta2.json", + }, + { + "troubleshoot.sh_preflights.yaml", + "preflight-troubleshoot-v1beta2.json", + }, + { + "troubleshoot.sh_redactors.yaml", + "redactor-troubleshoot-v1beta2.json", + }, + { + "troubleshoot.sh_supportbundles.yaml", + "supportbundle-troubleshoot-v1beta2.json", + }, } - supportBundlesContents, err := ioutil.ReadFile(filepath.Join(workdir, "config", "crds", "troubleshoot.replicated.com_supportbundles.yaml")) - if err != nil { - return errors.Wrap(err, "failed to read supportbundles crd") - } - if err := generateSchemaFromCRD(supportBundlesContents, filepath.Join(workdir, v.GetString("output-dir"), "supportbundle-troubleshoot-v1beta1.json")); err != nil { - return errors.Wrap(err, "failed to write supportbundles schema") + for _, file := range files { + contents, err := ioutil.ReadFile(filepath.Join(workdir, "config", "crds", file.inFilename)) + if err != nil { + return errors.Wrapf(err, "failed to read crd from %s", file.inFilename) + } + if err := generateSchemaFromCRD(contents, filepath.Join(workdir, v.GetString("output-dir"), file.outFilename)); err != nil { + return errors.Wrapf(err, "failed to write crd schema to %s", file.outFilename) + } } return nil diff --git a/cmd/troubleshoot/cli/root.go b/cmd/troubleshoot/cli/root.go index 2f27c1104..7d14f0063 100644 --- a/cmd/troubleshoot/cli/root.go +++ b/cmd/troubleshoot/cli/root.go @@ -5,7 +5,7 @@ import ( "os" "strings" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/logger" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -69,7 +69,7 @@ func initConfig() { viper.AutomaticEnv() } -func ensureCollectorInList(list []*troubleshootv1beta1.Collect, collector troubleshootv1beta1.Collect) []*troubleshootv1beta1.Collect { +func ensureCollectorInList(list []*troubleshootv1beta2.Collect, collector troubleshootv1beta2.Collect) []*troubleshootv1beta2.Collect { for _, inList := range list { if collector.ClusterResources != nil && inList.ClusterResources != nil { return list diff --git a/cmd/troubleshoot/cli/run.go b/cmd/troubleshoot/cli/run.go index e670666ee..6e20e87bc 100644 --- a/cmd/troubleshoot/cli/run.go +++ b/cmd/troubleshoot/cli/run.go @@ -25,11 +25,12 @@ import ( "github.com/pkg/errors" "github.com/replicatedhq/troubleshoot/cmd/util" analyzer "github.com/replicatedhq/troubleshoot/pkg/analyze" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" troubleshootclientsetscheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" "github.com/replicatedhq/troubleshoot/pkg/collect" "github.com/replicatedhq/troubleshoot/pkg/convert" + "github.com/replicatedhq/troubleshoot/pkg/docrewrite" "github.com/replicatedhq/troubleshoot/pkg/redact" "github.com/spf13/viper" spin "github.com/tj/go-spin" @@ -57,7 +58,7 @@ func runTroubleshoot(v *viper.Viper, arg string) error { return errors.Wrap(err, "failed to load collector spec") } - multidocs := strings.Split(string(collectorContent), "---") + multidocs := strings.Split(string(collectorContent), "\n---\n") // we suppory both raw collector kinds and supportbundle kinds here supportBundleSpec, err := parseSupportBundleFromDoc([]byte(multidocs[0])) @@ -68,31 +69,42 @@ func runTroubleshoot(v *viper.Viper, arg string) error { troubleshootclientsetscheme.AddToScheme(scheme.Scheme) decode := scheme.Codecs.UniversalDeserializer().Decode - additionalRedactors := &troubleshootv1beta1.Redactor{} + additionalRedactors := &troubleshootv1beta2.Redactor{} for idx, redactor := range v.GetStringSlice("redactors") { redactorContent, err := loadSpec(v, redactor) if err != nil { return errors.Wrapf(err, "failed to load redactor spec #%d", idx) } + redactorContent, err = docrewrite.ConvertToV1Beta2(redactorContent) + if err != nil { + return errors.Wrap(err, "failed to convert to v1beta2") + } obj, _, err := decode([]byte(redactorContent), nil, nil) if err != nil { return errors.Wrapf(err, "failed to parse redactors %s", redactor) } - loopRedactors, ok := obj.(*troubleshootv1beta1.Redactor) + loopRedactors, ok := obj.(*troubleshootv1beta2.Redactor) if !ok { - return fmt.Errorf("%s is not a troubleshootv1beta1 redactor type", redactor) + return fmt.Errorf("%s is not a troubleshootv1beta2 redactor type", redactor) } if loopRedactors != nil { additionalRedactors.Spec.Redactors = append(additionalRedactors.Spec.Redactors, loopRedactors.Spec.Redactors...) } } - for i, additionalDoc := range multidocs[1:] { - obj, _, err := decode([]byte(additionalDoc), nil, nil) + for i, additionalDoc := range multidocs { + if i == 0 { + continue + } + additionalDoc, err := docrewrite.ConvertToV1Beta2([]byte(additionalDoc)) + if err != nil { + return errors.Wrap(err, "failed to convert to v1beta2") + } + obj, _, err := decode(additionalDoc, nil, nil) if err != nil { return errors.Wrapf(err, "failed to parse additional doc %d", i) } - multidocRedactors, ok := obj.(*troubleshootv1beta1.Redactor) + multidocRedactors, ok := obj.(*troubleshootv1beta2.Redactor) if !ok { continue } @@ -274,7 +286,12 @@ func loadSpec(v *viper.Viper, arg string) ([]byte, error) { } } -func parseSupportBundleFromDoc(doc []byte) (*troubleshootv1beta1.SupportBundle, error) { +func parseSupportBundleFromDoc(doc []byte) (*troubleshootv1beta2.SupportBundle, error) { + doc, err := docrewrite.ConvertToV1Beta2(doc) + if err != nil { + return nil, errors.Wrap(err, "failed to convert to v1beta2") + } + troubleshootclientsetscheme.AddToScheme(scheme.Scheme) decode := scheme.Codecs.UniversalDeserializer().Decode @@ -283,17 +300,17 @@ func parseSupportBundleFromDoc(doc []byte) (*troubleshootv1beta1.SupportBundle, return nil, errors.Wrap(err, "failed to parse document") } - collector, ok := obj.(*troubleshootv1beta1.Collector) + collector, ok := obj.(*troubleshootv1beta2.Collector) if ok { - supportBundle := troubleshootv1beta1.SupportBundle{ + supportBundle := troubleshootv1beta2.SupportBundle{ TypeMeta: metav1.TypeMeta{ - APIVersion: "troubleshoot.replicated.com/v1beta1", + APIVersion: "troubleshoot.sh/v1beta2", Kind: "SupportBundle", }, ObjectMeta: collector.ObjectMeta, - Spec: troubleshootv1beta1.SupportBundleSpec{ + Spec: troubleshootv1beta2.SupportBundleSpec{ Collectors: collector.Spec.Collectors, - Analyzers: []*troubleshootv1beta1.Analyze{}, + Analyzers: []*troubleshootv1beta2.Analyze{}, AfterCollection: collector.Spec.AfterCollection, }, } @@ -301,7 +318,7 @@ func parseSupportBundleFromDoc(doc []byte) (*troubleshootv1beta1.SupportBundle, return &supportBundle, nil } - supportBundle, ok := obj.(*troubleshootv1beta1.SupportBundle) + supportBundle, ok := obj.(*troubleshootv1beta2.SupportBundle) if ok { return supportBundle, nil } @@ -326,7 +343,7 @@ func canTryInsecure(v *viper.Viper) bool { return true } -func runCollectors(v *viper.Viper, collectors []*troubleshootv1beta1.Collect, additionalRedactors *troubleshootv1beta1.Redactor, progressChan chan interface{}) (string, error) { +func runCollectors(v *viper.Viper, collectors []*troubleshootv1beta2.Collect, additionalRedactors *troubleshootv1beta2.Redactor, progressChan chan interface{}) (string, error) { bundlePath, err := ioutil.TempDir("", "troubleshoot") if err != nil { return "", errors.Wrap(err, "create temp dir") @@ -337,10 +354,10 @@ func runCollectors(v *viper.Viper, collectors []*troubleshootv1beta1.Collect, ad return "", errors.Wrap(err, "write version file") } - collectSpecs := make([]*troubleshootv1beta1.Collect, 0, 0) + collectSpecs := make([]*troubleshootv1beta2.Collect, 0, 0) collectSpecs = append(collectSpecs, collectors...) - collectSpecs = ensureCollectorInList(collectSpecs, troubleshootv1beta1.Collect{ClusterInfo: &troubleshootv1beta1.ClusterInfo{}}) - collectSpecs = ensureCollectorInList(collectSpecs, troubleshootv1beta1.Collect{ClusterResources: &troubleshootv1beta1.ClusterResources{}}) + collectSpecs = ensureCollectorInList(collectSpecs, troubleshootv1beta2.Collect{ClusterInfo: &troubleshootv1beta2.ClusterInfo{}}) + collectSpecs = ensureCollectorInList(collectSpecs, troubleshootv1beta2.Collect{ClusterResources: &troubleshootv1beta2.ClusterResources{}}) config, err := KubernetesConfigFlags.ToRESTConfig() if err != nil { @@ -374,7 +391,7 @@ func runCollectors(v *viper.Viper, collectors []*troubleshootv1beta1.Collect, ad return "", errors.New("insufficient permissions to run all collectors") } - globalRedactors := []*troubleshootv1beta1.Redact{} + globalRedactors := []*troubleshootv1beta2.Redact{} if additionalRedactors != nil { globalRedactors = additionalRedactors.Spec.Redactors } @@ -441,6 +458,7 @@ func saveCollectorOutput(output map[string][]byte, bundlePath string, c *collect return nil } + func untarAndSave(tarFile []byte, bundlePath string) error { keys := make([]string, 0) dirs := make(map[string]*tar.Header) @@ -494,7 +512,7 @@ func untarAndSave(tarFile []byte, bundlePath string) error { } return nil } -func uploadSupportBundle(r *troubleshootv1beta1.ResultRequest, archivePath string) error { +func uploadSupportBundle(r *troubleshootv1beta2.ResultRequest, archivePath string) error { contentType := getExpectedContentType(r.URI) if contentType != "" && contentType != "application/tar+gzip" { return fmt.Errorf("cannot upload content type %s", contentType) @@ -567,7 +585,7 @@ func getExpectedContentType(uploadURL string) string { return parsedURL.Query().Get("Content-Type") } -func callbackSupportBundleAPI(r *troubleshootv1beta1.ResultRequest, archivePath string) error { +func callbackSupportBundleAPI(r *troubleshootv1beta2.ResultRequest, archivePath string) error { req, err := http.NewRequest(r.Method, r.URI, nil) if err != nil { return errors.Wrap(err, "create request") @@ -615,6 +633,6 @@ func tarSupportBundleDir(inputDir, outputFilename string) error { } type CollectorFailure struct { - Collector *troubleshootv1beta1.Collect + Collector *troubleshootv1beta2.Collect Failure string } diff --git a/cmd/troubleshoot/cli/util.go b/cmd/troubleshoot/cli/util.go index 3c7702c05..738d301a0 100644 --- a/cmd/troubleshoot/cli/util.go +++ b/cmd/troubleshoot/cli/util.go @@ -5,24 +5,8 @@ import ( "os" "github.com/pkg/errors" - troubleshootclientv1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1" - "k8s.io/cli-runtime/pkg/genericclioptions" ) -func createTroubleshootK8sClient(configFlags *genericclioptions.ConfigFlags) (*troubleshootclientv1beta1.TroubleshootV1beta1Client, error) { - config, err := configFlags.ToRESTConfig() - if err != nil { - return nil, errors.Wrap(err, "failed to convert kube flags to rest config") - } - - troubleshootClient, err := troubleshootclientv1beta1.NewForConfig(config) - if err != nil { - return nil, errors.Wrap(err, "failed to create troubleshoot client") - } - - return troubleshootClient, nil -} - func findFileName(basename, extension string) (string, error) { n := 1 name := basename diff --git a/cmd/troubleshoot/cli/version.go b/cmd/troubleshoot/cli/version.go index 28634e2ec..a19d384a9 100644 --- a/cmd/troubleshoot/cli/version.go +++ b/cmd/troubleshoot/cli/version.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "path/filepath" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/version" "github.com/spf13/cobra" "gopkg.in/yaml.v2" @@ -29,10 +29,10 @@ func VersionCmd() *cobra.Command { const VersionFilename = "version.yaml" func writeVersionFile(path string) error { - version := troubleshootv1beta1.SupportBundleVersion{ - ApiVersion: "troubleshoot.replicated.com/v1beta1", + version := troubleshootv1beta2.SupportBundleVersion{ + ApiVersion: "troubleshoot.sh/v1beta2", Kind: "SupportBundle", - Spec: troubleshootv1beta1.SupportBundleVersionSpec{ + Spec: troubleshootv1beta2.SupportBundleVersionSpec{ VersionNumber: version.Version(), }, } diff --git a/config/crds/troubleshoot.replicated.com_analyzers.yaml b/config/crds/troubleshoot.replicated.com_analyzers.yaml index a4dff778a..ac266bf34 100644 --- a/config/crds/troubleshoot.replicated.com_analyzers.yaml +++ b/config/crds/troubleshoot.replicated.com_analyzers.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.2.8 + controller-gen.kubebuilder.io/version: v0.3.0 creationTimestamp: null name: analyzers.troubleshoot.replicated.com spec: @@ -457,6 +457,13 @@ spec: type: string podCapacity: type: string + selector: + properties: + matchLabel: + additionalProperties: + type: string + type: object + type: object type: object outcomes: items: diff --git a/config/crds/troubleshoot.replicated.com_collectors.yaml b/config/crds/troubleshoot.replicated.com_collectors.yaml index 9bbe3ad38..528186da9 100644 --- a/config/crds/troubleshoot.replicated.com_collectors.yaml +++ b/config/crds/troubleshoot.replicated.com_collectors.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.2.8 + controller-gen.kubebuilder.io/version: v0.3.0 creationTimestamp: null name: collectors.troubleshoot.replicated.com spec: diff --git a/config/crds/troubleshoot.replicated.com_preflights.yaml b/config/crds/troubleshoot.replicated.com_preflights.yaml index 903b15cc0..10910ad07 100644 --- a/config/crds/troubleshoot.replicated.com_preflights.yaml +++ b/config/crds/troubleshoot.replicated.com_preflights.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.2.8 + controller-gen.kubebuilder.io/version: v0.3.0 creationTimestamp: null name: preflights.troubleshoot.replicated.com spec: @@ -457,6 +457,13 @@ spec: type: string podCapacity: type: string + selector: + properties: + matchLabel: + additionalProperties: + type: string + type: object + type: object type: object outcomes: items: diff --git a/config/crds/troubleshoot.replicated.com_redactors.yaml b/config/crds/troubleshoot.replicated.com_redactors.yaml index 8c469b4d2..f8e215716 100644 --- a/config/crds/troubleshoot.replicated.com_redactors.yaml +++ b/config/crds/troubleshoot.replicated.com_redactors.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.2.8 + controller-gen.kubebuilder.io/version: v0.3.0 creationTimestamp: null name: redactors.troubleshoot.replicated.com spec: diff --git a/config/crds/troubleshoot.replicated.com_supportbundles.yaml b/config/crds/troubleshoot.replicated.com_supportbundles.yaml index 0c362ad01..aae1abd10 100644 --- a/config/crds/troubleshoot.replicated.com_supportbundles.yaml +++ b/config/crds/troubleshoot.replicated.com_supportbundles.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.2.8 + controller-gen.kubebuilder.io/version: v0.3.0 creationTimestamp: null name: supportbundles.troubleshoot.replicated.com spec: @@ -488,6 +488,13 @@ spec: type: string podCapacity: type: string + selector: + properties: + matchLabel: + additionalProperties: + type: string + type: object + type: object type: object outcomes: items: diff --git a/config/crds/troubleshoot.sh_analyzers.yaml b/config/crds/troubleshoot.sh_analyzers.yaml new file mode 100644 index 000000000..83eb8bfde --- /dev/null +++ b/config/crds/troubleshoot.sh_analyzers.yaml @@ -0,0 +1,831 @@ + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.3.0 + creationTimestamp: null + name: analyzers.troubleshoot.sh +spec: + group: troubleshoot.sh + names: + kind: Analyzer + listKind: AnalyzerList + plural: analyzers + singular: analyzer + scope: Namespaced + validation: + openAPIV3Schema: + description: Analyzer is the Schema for the analyzers API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: AnalyzerSpec defines the desired state of Analyzer + properties: + analyzers: + items: + properties: + clusterVersion: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + containerRuntime: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + customResourceDefinition: + properties: + checkName: + type: string + customResourceDefinitionName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - customResourceDefinitionName + - outcomes + type: object + deploymentStatus: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - name + - namespace + - outcomes + type: object + distribution: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + imagePullSecret: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + registryName: + type: string + required: + - outcomes + - registryName + type: object + ingress: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + ingressName: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - ingressName + - namespace + - outcomes + type: object + mysql: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - collectorName + - outcomes + type: object + nodeResources: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + filters: + properties: + cpuAllocatable: + type: string + cpuCapacity: + type: string + ephemeralStorageAllocatable: + type: string + ephemeralStorageCapacity: + type: string + memoryAllocatable: + type: string + memoryCapacity: + type: string + podAllocatable: + type: string + podCapacity: + type: string + selector: + properties: + matchLabel: + additionalProperties: + type: string + type: object + type: object + type: object + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + postgres: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - collectorName + - outcomes + type: object + redis: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - collectorName + - outcomes + type: object + secret: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + key: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + secretName: + type: string + required: + - namespace + - outcomes + - secretName + type: object + statefulsetStatus: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - name + - namespace + - outcomes + type: object + storageClass: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + storageClassName: + type: string + required: + - outcomes + - storageClassName + type: object + textAnalyze: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + regex: + type: string + regexGroups: + type: string + required: + - outcomes + type: object + type: object + type: array + type: object + status: + description: AnalyzerStatus defines the observed state of Analyzer + type: object + type: object + version: v1beta2 + versions: + - name: v1beta2 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/troubleshoot.sh_collectors.yaml b/config/crds/troubleshoot.sh_collectors.yaml new file mode 100644 index 000000000..660a778e7 --- /dev/null +++ b/config/crds/troubleshoot.sh_collectors.yaml @@ -0,0 +1,387 @@ + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.3.0 + creationTimestamp: null + name: collectors.troubleshoot.sh +spec: + group: troubleshoot.sh + names: + kind: Collector + listKind: CollectorList + plural: collectors + singular: collector + scope: Namespaced + validation: + openAPIV3Schema: + description: Collector is the Schema for the collectors API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: CollectorSpec defines the desired state of Collector + properties: + afterCollection: + items: + properties: + callback: + properties: + method: + type: string + redactUri: + type: string + uri: + type: string + required: + - method + - redactUri + - uri + type: object + uploadResultsTo: + properties: + method: + type: string + redactUri: + type: string + uri: + type: string + required: + - method + - redactUri + - uri + type: object + type: object + type: array + collectors: + items: + properties: + clusterInfo: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + type: object + clusterResources: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + type: object + copy: + properties: + collectorName: + type: string + containerName: + type: string + containerPath: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + selector: + items: + type: string + type: array + required: + - containerPath + - namespace + - selector + type: object + data: + properties: + collectorName: + type: string + data: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + required: + - data + type: object + exec: + properties: + args: + items: + type: string + type: array + collectorName: + type: string + command: + items: + type: string + type: array + containerName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + selector: + items: + type: string + type: array + timeout: + type: string + required: + - namespace + - selector + type: object + http: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + get: + properties: + headers: + additionalProperties: + type: string + type: object + insecureSkipVerify: + type: boolean + url: + type: string + required: + - url + type: object + name: + type: string + post: + properties: + body: + type: string + headers: + additionalProperties: + type: string + type: object + insecureSkipVerify: + type: boolean + url: + type: string + required: + - url + type: object + put: + properties: + body: + type: string + headers: + additionalProperties: + type: string + type: object + insecureSkipVerify: + type: boolean + url: + type: string + required: + - url + type: object + type: object + logs: + properties: + collectorName: + type: string + containerNames: + items: + type: string + type: array + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + limits: + properties: + maxAge: + type: string + maxLines: + format: int64 + type: integer + type: object + name: + type: string + namespace: + type: string + selector: + items: + type: string + type: array + required: + - selector + type: object + mysql: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + uri: + type: string + required: + - uri + type: object + postgres: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + uri: + type: string + required: + - uri + type: object + redis: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + uri: + type: string + required: + - uri + type: object + run: + properties: + args: + items: + type: string + type: array + collectorName: + type: string + command: + items: + type: string + type: array + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + image: + type: string + imagePullPolicy: + type: string + name: + type: string + namespace: + type: string + timeout: + type: string + required: + - image + - namespace + type: object + secret: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + includeValue: + type: boolean + key: + type: string + name: + type: string + namespace: + type: string + required: + - name + type: object + type: object + type: array + type: object + status: + description: CollectorStatus defines the observed state of Collector + type: object + type: object + version: v1beta2 + versions: + - name: v1beta2 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/troubleshoot.sh_preflights.yaml b/config/crds/troubleshoot.sh_preflights.yaml new file mode 100644 index 000000000..c6c0e2d3c --- /dev/null +++ b/config/crds/troubleshoot.sh_preflights.yaml @@ -0,0 +1,1137 @@ + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.3.0 + creationTimestamp: null + name: preflights.troubleshoot.sh +spec: + group: troubleshoot.sh + names: + kind: Preflight + listKind: PreflightList + plural: preflights + singular: preflight + scope: Namespaced + validation: + openAPIV3Schema: + description: Preflight is the Schema for the preflights API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: PreflightSpec defines the desired state of Preflight + properties: + analyzers: + items: + properties: + clusterVersion: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + containerRuntime: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + customResourceDefinition: + properties: + checkName: + type: string + customResourceDefinitionName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - customResourceDefinitionName + - outcomes + type: object + deploymentStatus: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - name + - namespace + - outcomes + type: object + distribution: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + imagePullSecret: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + registryName: + type: string + required: + - outcomes + - registryName + type: object + ingress: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + ingressName: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - ingressName + - namespace + - outcomes + type: object + mysql: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - collectorName + - outcomes + type: object + nodeResources: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + filters: + properties: + cpuAllocatable: + type: string + cpuCapacity: + type: string + ephemeralStorageAllocatable: + type: string + ephemeralStorageCapacity: + type: string + memoryAllocatable: + type: string + memoryCapacity: + type: string + podAllocatable: + type: string + podCapacity: + type: string + selector: + properties: + matchLabel: + additionalProperties: + type: string + type: object + type: object + type: object + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + postgres: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - collectorName + - outcomes + type: object + redis: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - collectorName + - outcomes + type: object + secret: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + key: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + secretName: + type: string + required: + - namespace + - outcomes + - secretName + type: object + statefulsetStatus: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - name + - namespace + - outcomes + type: object + storageClass: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + storageClassName: + type: string + required: + - outcomes + - storageClassName + type: object + textAnalyze: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + regex: + type: string + regexGroups: + type: string + required: + - outcomes + type: object + type: object + type: array + collectors: + items: + properties: + clusterInfo: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + type: object + clusterResources: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + type: object + copy: + properties: + collectorName: + type: string + containerName: + type: string + containerPath: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + selector: + items: + type: string + type: array + required: + - containerPath + - namespace + - selector + type: object + data: + properties: + collectorName: + type: string + data: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + required: + - data + type: object + exec: + properties: + args: + items: + type: string + type: array + collectorName: + type: string + command: + items: + type: string + type: array + containerName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + selector: + items: + type: string + type: array + timeout: + type: string + required: + - namespace + - selector + type: object + http: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + get: + properties: + headers: + additionalProperties: + type: string + type: object + insecureSkipVerify: + type: boolean + url: + type: string + required: + - url + type: object + name: + type: string + post: + properties: + body: + type: string + headers: + additionalProperties: + type: string + type: object + insecureSkipVerify: + type: boolean + url: + type: string + required: + - url + type: object + put: + properties: + body: + type: string + headers: + additionalProperties: + type: string + type: object + insecureSkipVerify: + type: boolean + url: + type: string + required: + - url + type: object + type: object + logs: + properties: + collectorName: + type: string + containerNames: + items: + type: string + type: array + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + limits: + properties: + maxAge: + type: string + maxLines: + format: int64 + type: integer + type: object + name: + type: string + namespace: + type: string + selector: + items: + type: string + type: array + required: + - selector + type: object + mysql: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + uri: + type: string + required: + - uri + type: object + postgres: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + uri: + type: string + required: + - uri + type: object + redis: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + uri: + type: string + required: + - uri + type: object + run: + properties: + args: + items: + type: string + type: array + collectorName: + type: string + command: + items: + type: string + type: array + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + image: + type: string + imagePullPolicy: + type: string + name: + type: string + namespace: + type: string + timeout: + type: string + required: + - image + - namespace + type: object + secret: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + includeValue: + type: boolean + key: + type: string + name: + type: string + namespace: + type: string + required: + - name + type: object + type: object + type: array + uploadResultsTo: + type: string + type: object + status: + description: PreflightStatus defines the observed state of Preflight + type: object + type: object + version: v1beta2 + versions: + - name: v1beta2 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/troubleshoot.sh_redactors.yaml b/config/crds/troubleshoot.sh_redactors.yaml new file mode 100644 index 000000000..5b1a3996d --- /dev/null +++ b/config/crds/troubleshoot.sh_redactors.yaml @@ -0,0 +1,88 @@ + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.3.0 + creationTimestamp: null + name: redactors.troubleshoot.sh +spec: + group: troubleshoot.sh + names: + kind: Redactor + listKind: RedactorList + plural: redactors + singular: redactor + scope: Namespaced + validation: + openAPIV3Schema: + description: Redactor is the Schema for the redaction API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: RedactorSpec defines the desired state of Redactor + properties: + redactors: + items: + properties: + fileSelector: + properties: + file: + type: string + files: + items: + type: string + type: array + type: object + name: + type: string + removals: + properties: + regex: + items: + properties: + redactor: + type: string + selector: + type: string + type: object + type: array + values: + items: + type: string + type: array + yamlPath: + items: + type: string + type: array + type: object + type: object + type: array + type: object + status: + description: RedactorStatus defines the observed state of Redactor + type: object + type: object + version: v1beta2 + versions: + - name: v1beta2 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/troubleshoot.sh_supportbundles.yaml b/config/crds/troubleshoot.sh_supportbundles.yaml new file mode 100644 index 000000000..00305dbed --- /dev/null +++ b/config/crds/troubleshoot.sh_supportbundles.yaml @@ -0,0 +1,1166 @@ + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.3.0 + creationTimestamp: null + name: supportbundles.troubleshoot.sh +spec: + group: troubleshoot.sh + names: + kind: SupportBundle + listKind: SupportBundleList + plural: supportbundles + singular: supportbundle + scope: Namespaced + validation: + openAPIV3Schema: + description: SupportBundle is the Schema for the SupportBundles API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: SupportBundleSpec defines the desired state of SupportBundle + properties: + afterCollection: + items: + properties: + callback: + properties: + method: + type: string + redactUri: + type: string + uri: + type: string + required: + - method + - redactUri + - uri + type: object + uploadResultsTo: + properties: + method: + type: string + redactUri: + type: string + uri: + type: string + required: + - method + - redactUri + - uri + type: object + type: object + type: array + analyzers: + items: + properties: + clusterVersion: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + containerRuntime: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + customResourceDefinition: + properties: + checkName: + type: string + customResourceDefinitionName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - customResourceDefinitionName + - outcomes + type: object + deploymentStatus: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - name + - namespace + - outcomes + type: object + distribution: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + imagePullSecret: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + registryName: + type: string + required: + - outcomes + - registryName + type: object + ingress: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + ingressName: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - ingressName + - namespace + - outcomes + type: object + mysql: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - collectorName + - outcomes + type: object + nodeResources: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + filters: + properties: + cpuAllocatable: + type: string + cpuCapacity: + type: string + ephemeralStorageAllocatable: + type: string + ephemeralStorageCapacity: + type: string + memoryAllocatable: + type: string + memoryCapacity: + type: string + podAllocatable: + type: string + podCapacity: + type: string + selector: + properties: + matchLabel: + additionalProperties: + type: string + type: object + type: object + type: object + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - outcomes + type: object + postgres: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - collectorName + - outcomes + type: object + redis: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - collectorName + - outcomes + type: object + secret: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + key: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + secretName: + type: string + required: + - namespace + - outcomes + - secretName + type: object + statefulsetStatus: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + required: + - name + - namespace + - outcomes + type: object + storageClass: + properties: + checkName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + storageClassName: + type: string + required: + - outcomes + - storageClassName + type: object + textAnalyze: + properties: + checkName: + type: string + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + fileName: + type: string + outcomes: + items: + properties: + fail: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + pass: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + warn: + properties: + message: + type: string + uri: + type: string + when: + type: string + type: object + type: object + type: array + regex: + type: string + regexGroups: + type: string + required: + - outcomes + type: object + type: object + type: array + collectors: + items: + properties: + clusterInfo: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + type: object + clusterResources: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + type: object + copy: + properties: + collectorName: + type: string + containerName: + type: string + containerPath: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + selector: + items: + type: string + type: array + required: + - containerPath + - namespace + - selector + type: object + data: + properties: + collectorName: + type: string + data: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + required: + - data + type: object + exec: + properties: + args: + items: + type: string + type: array + collectorName: + type: string + command: + items: + type: string + type: array + containerName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + name: + type: string + namespace: + type: string + selector: + items: + type: string + type: array + timeout: + type: string + required: + - namespace + - selector + type: object + http: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + get: + properties: + headers: + additionalProperties: + type: string + type: object + insecureSkipVerify: + type: boolean + url: + type: string + required: + - url + type: object + name: + type: string + post: + properties: + body: + type: string + headers: + additionalProperties: + type: string + type: object + insecureSkipVerify: + type: boolean + url: + type: string + required: + - url + type: object + put: + properties: + body: + type: string + headers: + additionalProperties: + type: string + type: object + insecureSkipVerify: + type: boolean + url: + type: string + required: + - url + type: object + type: object + logs: + properties: + collectorName: + type: string + containerNames: + items: + type: string + type: array + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + limits: + properties: + maxAge: + type: string + maxLines: + format: int64 + type: integer + type: object + name: + type: string + namespace: + type: string + selector: + items: + type: string + type: array + required: + - selector + type: object + mysql: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + uri: + type: string + required: + - uri + type: object + postgres: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + uri: + type: string + required: + - uri + type: object + redis: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + uri: + type: string + required: + - uri + type: object + run: + properties: + args: + items: + type: string + type: array + collectorName: + type: string + command: + items: + type: string + type: array + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + image: + type: string + imagePullPolicy: + type: string + name: + type: string + namespace: + type: string + timeout: + type: string + required: + - image + - namespace + type: object + secret: + properties: + collectorName: + type: string + exclude: + description: BoolOrString is a type that can hold an bool + or a string. When used in JSON or YAML marshalling and + unmarshalling, it produces or consumes the inner type. This + allows you to have, for example, a JSON field that can accept + a booolean string or raw bool. + type: BoolString + includeValue: + type: boolean + key: + type: string + name: + type: string + namespace: + type: string + required: + - name + type: object + type: object + type: array + type: object + status: + description: SupportBundleStatus defines the observed state of SupportBundle + type: object + type: object + version: v1beta2 + versions: + - name: v1beta2 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/samples/troubleshoot_v1beta1_analyzer.yaml b/config/samples/troubleshoot_v1beta2_analyzer.yaml similarity index 73% rename from config/samples/troubleshoot_v1beta1_analyzer.yaml rename to config/samples/troubleshoot_v1beta2_analyzer.yaml index f985de7a4..b91857a55 100644 --- a/config/samples/troubleshoot_v1beta1_analyzer.yaml +++ b/config/samples/troubleshoot_v1beta2_analyzer.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Analyzer metadata: labels: diff --git a/config/samples/troubleshoot_v1beta1_collector.yaml b/config/samples/troubleshoot_v1beta2_collector.yaml similarity index 97% rename from config/samples/troubleshoot_v1beta1_collector.yaml rename to config/samples/troubleshoot_v1beta2_collector.yaml index ea48da37e..7f2de4961 100644 --- a/config/samples/troubleshoot_v1beta1_collector.yaml +++ b/config/samples/troubleshoot_v1beta2_collector.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Collector metadata: name: collector-sample diff --git a/config/samples/troubleshoot_v1beta1_preflight.yaml b/config/samples/troubleshoot_v1beta2_preflight.yaml similarity index 97% rename from config/samples/troubleshoot_v1beta1_preflight.yaml rename to config/samples/troubleshoot_v1beta2_preflight.yaml index c175f3506..51272b386 100644 --- a/config/samples/troubleshoot_v1beta1_preflight.yaml +++ b/config/samples/troubleshoot_v1beta2_preflight.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Preflight metadata: name: support-io diff --git a/examples/preflight/node-resources.yaml b/examples/preflight/node-resources.yaml index 8abeb3d33..9d9214be5 100644 --- a/examples/preflight/node-resources.yaml +++ b/examples/preflight/node-resources.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Preflight metadata: name: sample diff --git a/examples/preflight/postgres.yaml b/examples/preflight/postgres.yaml index 469890cc6..d2369c1b4 100644 --- a/examples/preflight/postgres.yaml +++ b/examples/preflight/postgres.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Preflight metadata: name: sample diff --git a/examples/preflight/redis.yaml b/examples/preflight/redis.yaml index 1ab7f302b..ece1e156c 100644 --- a/examples/preflight/redis.yaml +++ b/examples/preflight/redis.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Preflight metadata: name: sample diff --git a/examples/preflight/sample-preflight.yaml b/examples/preflight/sample-preflight.yaml index 019c383c2..90c5ee68b 100644 --- a/examples/preflight/sample-preflight.yaml +++ b/examples/preflight/sample-preflight.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Preflight metadata: name: example diff --git a/examples/preflight/text-analyze.yaml b/examples/preflight/text-analyze.yaml index 8c28b6057..9f3c4598c 100644 --- a/examples/preflight/text-analyze.yaml +++ b/examples/preflight/text-analyze.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Preflight metadata: name: example-preflight-checks diff --git a/examples/support-bundle/sample-analyzers.yaml b/examples/support-bundle/sample-analyzers.yaml index 3215c2794..1a6c92e43 100644 --- a/examples/support-bundle/sample-analyzers.yaml +++ b/examples/support-bundle/sample-analyzers.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Analyzer metadata: name: a diff --git a/examples/support-bundle/sample-collectors.yaml b/examples/support-bundle/sample-collectors.yaml index 0d57c3c1d..ca4536f3e 100644 --- a/examples/support-bundle/sample-collectors.yaml +++ b/examples/support-bundle/sample-collectors.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Collector metadata: name: collector-sample diff --git a/examples/support-bundle/sample-supportbundle.yaml b/examples/support-bundle/sample-supportbundle.yaml index 812a3619d..63d75d098 100644 --- a/examples/support-bundle/sample-supportbundle.yaml +++ b/examples/support-bundle/sample-supportbundle.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: SupportBundle metadata: name: example diff --git a/examples/troubleshoot/sample-analyzers.yaml b/examples/troubleshoot/sample-analyzers.yaml new file mode 100644 index 000000000..1a6c92e43 --- /dev/null +++ b/examples/troubleshoot/sample-analyzers.yaml @@ -0,0 +1,24 @@ +apiVersion: troubleshoot.sh/v1beta2 +kind: Analyzer +metadata: + name: a +spec: + analyzers: + - distribution: + outcomes: + - fail: + when: "= dockerdesktop" + message: "docker for desktop is not allowed" + # - fail: + # when: "microk8s" + # message: "mickrk8s is not prod" + - fail: + when: "!= openshift" + message: "this should fail on anything other than openshift" + - warn: + when: "!= eks" + message: "YMMV on not eks" + - pass: + message: "good work" + + diff --git a/examples/troubleshoot/sample-troubleshoot.yaml b/examples/troubleshoot/sample-troubleshoot.yaml new file mode 100644 index 000000000..ca4536f3e --- /dev/null +++ b/examples/troubleshoot/sample-troubleshoot.yaml @@ -0,0 +1,6 @@ +apiVersion: troubleshoot.sh/v1beta2 +kind: Collector +metadata: + name: collector-sample +spec: + collectors: [] diff --git a/pkg/analyze/analyzer.go b/pkg/analyze/analyzer.go index bff88187e..9d2f9156f 100644 --- a/pkg/analyze/analyzer.go +++ b/pkg/analyze/analyzer.go @@ -4,7 +4,7 @@ import ( "strconv" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/multitype" ) @@ -40,7 +40,7 @@ func isExcluded(excludeVal multitype.BoolOrString) (bool, error) { return parsed, nil } -func Analyze(analyzer *troubleshootv1beta1.Analyze, getFile getCollectedFileContents, findFiles getChildCollectedFileContents) (*AnalyzeResult, error) { +func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileContents, findFiles getChildCollectedFileContents) (*AnalyzeResult, error) { if analyzer.ClusterVersion != nil { isExcluded, err := isExcluded(analyzer.ClusterVersion.Exclude) if err != nil { diff --git a/pkg/analyze/cluster_version.go b/pkg/analyze/cluster_version.go index 4c6aa2e5e..8a9c8974f 100644 --- a/pkg/analyze/cluster_version.go +++ b/pkg/analyze/cluster_version.go @@ -6,11 +6,11 @@ import ( "github.com/blang/semver" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/collect" ) -func analyzeClusterVersion(analyzer *troubleshootv1beta1.ClusterVersion, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeClusterVersion(analyzer *troubleshootv1beta2.ClusterVersion, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { clusterInfo, err := getCollectedFileContents("cluster-info/cluster_version.json") if err != nil { return nil, errors.Wrap(err, "failed to get contents of cluster_version.json") @@ -29,7 +29,7 @@ func analyzeClusterVersion(analyzer *troubleshootv1beta1.ClusterVersion, getColl return analyzeClusterVersionResult(k8sVersion, analyzer.Outcomes, analyzer.CheckName) } -func analyzeClusterVersionResult(k8sVersion semver.Version, outcomes []*troubleshootv1beta1.Outcome, checkName string) (*AnalyzeResult, error) { +func analyzeClusterVersionResult(k8sVersion semver.Version, outcomes []*troubleshootv1beta2.Outcome, checkName string) (*AnalyzeResult, error) { for _, outcome := range outcomes { when := "" message := "" diff --git a/pkg/analyze/cluster_version_test.go b/pkg/analyze/cluster_version_test.go index ef17d2f97..28d9eae2d 100644 --- a/pkg/analyze/cluster_version_test.go +++ b/pkg/analyze/cluster_version_test.go @@ -5,28 +5,28 @@ import ( "testing" "github.com/blang/semver" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "go.undefinedlabs.com/scopeagent" ) func Test_analyzeClusterVersionResult(t *testing.T) { - outcomes := []*troubleshootv1beta1.Outcome{ + outcomes := []*troubleshootv1beta2.Outcome{ { - Fail: &troubleshootv1beta1.SingleOutcome{ + Fail: &troubleshootv1beta2.SingleOutcome{ When: "< 1.13.0", Message: "Sentry requires at Kubernetes 1.13.0 or later, and recommends 1.15.0.", URI: "https://www.kubernetes.io", }, }, { - Warn: &troubleshootv1beta1.SingleOutcome{ + Warn: &troubleshootv1beta2.SingleOutcome{ When: "< 1.15.0", Message: "Your cluster meets the minimum version of Kubernetes, but we recommend you update to 1.15.0 or later.", URI: "https://www.kubernetes.io", }, }, { - Pass: &troubleshootv1beta1.SingleOutcome{ + Pass: &troubleshootv1beta2.SingleOutcome{ Message: "Your cluster meets the recommended and required versions of Kubernetes.", }, }, @@ -34,7 +34,7 @@ func Test_analyzeClusterVersionResult(t *testing.T) { type args struct { k8sVersion semver.Version - outcomes []*troubleshootv1beta1.Outcome + outcomes []*troubleshootv1beta2.Outcome checkName string } tests := []struct { diff --git a/pkg/analyze/common_status.go b/pkg/analyze/common_status.go index ac891396b..7c1e2adf6 100644 --- a/pkg/analyze/common_status.go +++ b/pkg/analyze/common_status.go @@ -5,10 +5,10 @@ import ( "strings" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" ) -func commonStatus(outcomes []*troubleshootv1beta1.Outcome, title, iconKey string, iconURI string, readyReplicas int) (*AnalyzeResult, error) { +func commonStatus(outcomes []*troubleshootv1beta2.Outcome, title, iconKey string, iconURI string, readyReplicas int) (*AnalyzeResult, error) { result := &AnalyzeResult{ Title: title, IconKey: iconKey, diff --git a/pkg/analyze/container_runtime.go b/pkg/analyze/container_runtime.go index 86de89007..596347bec 100644 --- a/pkg/analyze/container_runtime.go +++ b/pkg/analyze/container_runtime.go @@ -6,11 +6,11 @@ import ( "strings" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" corev1 "k8s.io/api/core/v1" ) -func analyzeContainerRuntime(analyzer *troubleshootv1beta1.ContainerRuntime, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeContainerRuntime(analyzer *troubleshootv1beta2.ContainerRuntime, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { collected, err := getCollectedFileContents("cluster-resources/nodes.json") if err != nil { return nil, errors.Wrap(err, "failed to get contents of nodes.json") diff --git a/pkg/analyze/container_runtime_test.go b/pkg/analyze/container_runtime_test.go index a866b40ad..dd565dc4f 100644 --- a/pkg/analyze/container_runtime_test.go +++ b/pkg/analyze/container_runtime_test.go @@ -3,7 +3,7 @@ package analyzer import ( "testing" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.undefinedlabs.com/scopeagent" @@ -72,22 +72,22 @@ func Test_compareRuntimeConditionalToActual(t *testing.T) { func Test_containerRuntime(t *testing.T) { tests := []struct { name string - analyzer troubleshootv1beta1.ContainerRuntime + analyzer troubleshootv1beta2.ContainerRuntime expectResult AnalyzeResult files map[string][]byte }{ { name: "no containerd, when it's containerd", - analyzer: troubleshootv1beta1.ContainerRuntime{ - Outcomes: []*troubleshootv1beta1.Outcome{ + analyzer: troubleshootv1beta2.ContainerRuntime{ + Outcomes: []*troubleshootv1beta2.Outcome{ { - Pass: &troubleshootv1beta1.SingleOutcome{ + Pass: &troubleshootv1beta2.SingleOutcome{ When: "!= containerd", Message: "pass", }, }, { - Fail: &troubleshootv1beta1.SingleOutcome{ + Fail: &troubleshootv1beta2.SingleOutcome{ Message: "containerd detected", }, }, diff --git a/pkg/analyze/crd.go b/pkg/analyze/crd.go index 3cb12b6cf..45f8e5212 100644 --- a/pkg/analyze/crd.go +++ b/pkg/analyze/crd.go @@ -4,11 +4,11 @@ import ( "encoding/json" "fmt" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" ) -func analyzeCustomResourceDefinition(analyzer *troubleshootv1beta1.CustomResourceDefinition, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeCustomResourceDefinition(analyzer *troubleshootv1beta2.CustomResourceDefinition, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { crdData, err := getCollectedFileContents("cluster-resources/custom-resource-definitions.json") if err != nil { return nil, err diff --git a/pkg/analyze/deployment_status.go b/pkg/analyze/deployment_status.go index 24e5e4c7a..49d26b9e7 100644 --- a/pkg/analyze/deployment_status.go +++ b/pkg/analyze/deployment_status.go @@ -6,11 +6,11 @@ import ( "path" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" appsv1 "k8s.io/api/apps/v1" ) -func analyzeDeploymentStatus(analyzer *troubleshootv1beta1.DeploymentStatus, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeDeploymentStatus(analyzer *troubleshootv1beta2.DeploymentStatus, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { collected, err := getCollectedFileContents(path.Join("cluster-resources", "deployments", fmt.Sprintf("%s.json", analyzer.Namespace))) if err != nil { return nil, errors.Wrap(err, "failed to read collected deployments from namespace") diff --git a/pkg/analyze/deployment_status_test.go b/pkg/analyze/deployment_status_test.go index e4a2daca5..12af84420 100644 --- a/pkg/analyze/deployment_status_test.go +++ b/pkg/analyze/deployment_status_test.go @@ -3,7 +3,7 @@ package analyzer import ( "testing" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.undefinedlabs.com/scopeagent" @@ -12,22 +12,22 @@ import ( func Test_deploymentStatus(t *testing.T) { tests := []struct { name string - analyzer troubleshootv1beta1.DeploymentStatus + analyzer troubleshootv1beta2.DeploymentStatus expectResult AnalyzeResult files map[string][]byte }{ { name: "1/1, pass when = 1", - analyzer: troubleshootv1beta1.DeploymentStatus{ - Outcomes: []*troubleshootv1beta1.Outcome{ + analyzer: troubleshootv1beta2.DeploymentStatus{ + Outcomes: []*troubleshootv1beta2.Outcome{ { - Pass: &troubleshootv1beta1.SingleOutcome{ + Pass: &troubleshootv1beta2.SingleOutcome{ When: "= 1", Message: "pass", }, }, { - Fail: &troubleshootv1beta1.SingleOutcome{ + Fail: &troubleshootv1beta2.SingleOutcome{ Message: "fail", }, }, @@ -50,16 +50,16 @@ func Test_deploymentStatus(t *testing.T) { }, { name: "1/1, pass when = 2", - analyzer: troubleshootv1beta1.DeploymentStatus{ - Outcomes: []*troubleshootv1beta1.Outcome{ + analyzer: troubleshootv1beta2.DeploymentStatus{ + Outcomes: []*troubleshootv1beta2.Outcome{ { - Pass: &troubleshootv1beta1.SingleOutcome{ + Pass: &troubleshootv1beta2.SingleOutcome{ When: "= 2", Message: "pass", }, }, { - Fail: &troubleshootv1beta1.SingleOutcome{ + Fail: &troubleshootv1beta2.SingleOutcome{ Message: "fail", }, }, @@ -82,22 +82,22 @@ func Test_deploymentStatus(t *testing.T) { }, { name: "1/1, pass when >= 2, warn when = 1, fail when 0", - analyzer: troubleshootv1beta1.DeploymentStatus{ - Outcomes: []*troubleshootv1beta1.Outcome{ + analyzer: troubleshootv1beta2.DeploymentStatus{ + Outcomes: []*troubleshootv1beta2.Outcome{ { - Pass: &troubleshootv1beta1.SingleOutcome{ + Pass: &troubleshootv1beta2.SingleOutcome{ When: ">= 2", Message: "pass", }, }, { - Warn: &troubleshootv1beta1.SingleOutcome{ + Warn: &troubleshootv1beta2.SingleOutcome{ When: "= 1", Message: "warn", }, }, { - Fail: &troubleshootv1beta1.SingleOutcome{ + Fail: &troubleshootv1beta2.SingleOutcome{ Message: "fail", }, }, diff --git a/pkg/analyze/distribution.go b/pkg/analyze/distribution.go index 6dc8c5f49..9d9afa8bd 100644 --- a/pkg/analyze/distribution.go +++ b/pkg/analyze/distribution.go @@ -5,7 +5,7 @@ import ( "strings" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -100,7 +100,7 @@ func ParseNodesForProviders(nodes []corev1.Node) (providers, string) { return foundProviders, stringProvider } -func analyzeDistribution(analyzer *troubleshootv1beta1.Distribution, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeDistribution(analyzer *troubleshootv1beta2.Distribution, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { collected, err := getCollectedFileContents("cluster-resources/nodes.json") if err != nil { return nil, errors.Wrap(err, "failed to get contents of nodes.json") diff --git a/pkg/analyze/download.go b/pkg/analyze/download.go index c24602e0c..aaf7a2230 100644 --- a/pkg/analyze/download.go +++ b/pkg/analyze/download.go @@ -10,8 +10,9 @@ import ( getter "github.com/hashicorp/go-getter" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" troubleshootscheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + "github.com/replicatedhq/troubleshoot/pkg/docrewrite" "github.com/replicatedhq/troubleshoot/pkg/logger" "k8s.io/client-go/kubernetes/scheme" ) @@ -21,7 +22,7 @@ type fileContentProvider struct { } // Analyze local will analyze a locally available (already downloaded) bundle -func AnalyzeLocal(localBundlePath string, analyzers []*troubleshootv1beta1.Analyze) ([]*AnalyzeResult, error) { +func AnalyzeLocal(localBundlePath string, analyzers []*troubleshootv1beta2.Analyze) ([]*AnalyzeResult, error) { fcp := fileContentProvider{rootDir: localBundlePath} analyzeResults := []*AnalyzeResult{} @@ -56,7 +57,7 @@ func DownloadAndAnalyze(bundleURL string, analyzersSpec string) ([]*AnalyzeResul return nil, errors.Wrap(err, "failed to read version.yaml") } - analyzers := []*troubleshootv1beta1.Analyze{} + analyzers := []*troubleshootv1beta2.Analyze{} if analyzersSpec == "" { defaultAnalyzers, err := getDefaultAnalyzers() @@ -154,21 +155,26 @@ func ExtractTroubleshootBundle(reader io.Reader, destDir string) error { return nil } -func parseAnalyzers(spec string) ([]*troubleshootv1beta1.Analyze, error) { +func parseAnalyzers(spec string) ([]*troubleshootv1beta2.Analyze, error) { troubleshootscheme.AddToScheme(scheme.Scheme) decode := scheme.Codecs.UniversalDeserializer().Decode - obj, _, err := decode([]byte(spec), nil, nil) + convertedSpec, err := docrewrite.ConvertToV1Beta2([]byte(spec)) + if err != nil { + return nil, errors.Wrap(err, "failed to convert to v1beta2") + } + + obj, _, err := decode(convertedSpec, nil, nil) if err != nil { return nil, errors.Wrap(err, "failed to decode analyzers") } - analyzer := obj.(*troubleshootv1beta1.Analyzer) + analyzer := obj.(*troubleshootv1beta2.Analyzer) return analyzer.Spec.Analyzers, nil } -func getDefaultAnalyzers() ([]*troubleshootv1beta1.Analyze, error) { - spec := `apiVersion: troubleshoot.replicated.com/v1beta1 +func getDefaultAnalyzers() ([]*troubleshootv1beta2.Analyze, error) { + spec := `apiVersion: troubleshoot.sh/v1beta2 kind: Analyzer metadata: name: defaultAnalyzers diff --git a/pkg/analyze/image_pull_secret.go b/pkg/analyze/image_pull_secret.go index 0792d929a..4fbc55469 100644 --- a/pkg/analyze/image_pull_secret.go +++ b/pkg/analyze/image_pull_secret.go @@ -4,17 +4,17 @@ import ( "encoding/json" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" ) -func analyzeImagePullSecret(analyzer *troubleshootv1beta1.ImagePullSecret, getChildCollectedFileContents func(string) (map[string][]byte, error)) (*AnalyzeResult, error) { +func analyzeImagePullSecret(analyzer *troubleshootv1beta2.ImagePullSecret, getChildCollectedFileContents func(string) (map[string][]byte, error)) (*AnalyzeResult, error) { imagePullSecrets, err := getChildCollectedFileContents("cluster-resources/image-pull-secrets") if err != nil { return nil, errors.Wrap(err, "failed to get file contents for image pull secrets") } - var failOutcome *troubleshootv1beta1.Outcome - var passOutcome *troubleshootv1beta1.Outcome + var failOutcome *troubleshootv1beta2.Outcome + var passOutcome *troubleshootv1beta2.Outcome for _, outcome := range analyzer.Outcomes { if outcome.Fail != nil { failOutcome = outcome diff --git a/pkg/analyze/ingress.go b/pkg/analyze/ingress.go index 079aa8206..605a9bb68 100644 --- a/pkg/analyze/ingress.go +++ b/pkg/analyze/ingress.go @@ -4,11 +4,11 @@ import ( "encoding/json" "fmt" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" extensionsv1beta1 "k8s.io/api/extensions/v1beta1" ) -func analyzeIngress(analyzer *troubleshootv1beta1.Ingress, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeIngress(analyzer *troubleshootv1beta2.Ingress, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { ingressData, err := getCollectedFileContents("cluster-resources/storage-classes.json") if err != nil { return nil, err diff --git a/pkg/analyze/mysql.go b/pkg/analyze/mysql.go index 5426d4c85..bd332cddf 100644 --- a/pkg/analyze/mysql.go +++ b/pkg/analyze/mysql.go @@ -6,11 +6,11 @@ import ( "path" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/collect" ) -func analyzeMysql(analyzer *troubleshootv1beta1.DatabaseAnalyze, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeMysql(analyzer *troubleshootv1beta2.DatabaseAnalyze, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { collectorName := analyzer.CollectorName if collectorName == "" { collectorName = "mysql" diff --git a/pkg/analyze/node_resources.go b/pkg/analyze/node_resources.go index 6e21bdebc..5e274a2c8 100644 --- a/pkg/analyze/node_resources.go +++ b/pkg/analyze/node_resources.go @@ -8,12 +8,12 @@ import ( "strings" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" ) -func analyzeNodeResources(analyzer *troubleshootv1beta1.NodeResources, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeNodeResources(analyzer *troubleshootv1beta2.NodeResources, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { collected, err := getCollectedFileContents("cluster-resources/nodes.json") if err != nil { return nil, errors.Wrap(err, "failed to get contents of nodes.json") @@ -313,7 +313,7 @@ func findMax(nodes []corev1.Node, property string) *resource.Quantity { return max } -func nodeMatchesFilters(node corev1.Node, filters *troubleshootv1beta1.NodeResourceFilters) (bool, error) { +func nodeMatchesFilters(node corev1.Node, filters *troubleshootv1beta2.NodeResourceFilters) (bool, error) { if filters == nil { return true, nil } diff --git a/pkg/analyze/node_resources_test.go b/pkg/analyze/node_resources_test.go index 529db51bf..8aec429bf 100644 --- a/pkg/analyze/node_resources_test.go +++ b/pkg/analyze/node_resources_test.go @@ -3,7 +3,7 @@ package analyzer import ( "testing" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" @@ -411,13 +411,13 @@ func Test_nodeMatchesFilters(t *testing.T) { tests := []struct { name string node corev1.Node - filters *troubleshootv1beta1.NodeResourceFilters + filters *troubleshootv1beta2.NodeResourceFilters expectResult bool }{ { name: "true when empty filters", node: node, - filters: &troubleshootv1beta1.NodeResourceFilters{}, + filters: &troubleshootv1beta2.NodeResourceFilters{}, expectResult: true, }, { @@ -428,7 +428,7 @@ func Test_nodeMatchesFilters(t *testing.T) { { name: "false when allocatable memory is too high", node: node, - filters: &troubleshootv1beta1.NodeResourceFilters{ + filters: &troubleshootv1beta2.NodeResourceFilters{ MemoryAllocatable: "16Gi", }, expectResult: false, @@ -436,7 +436,7 @@ func Test_nodeMatchesFilters(t *testing.T) { { name: "true when allocatable memory is available", node: node, - filters: &troubleshootv1beta1.NodeResourceFilters{ + filters: &troubleshootv1beta2.NodeResourceFilters{ MemoryAllocatable: "4Gi", }, expectResult: true, diff --git a/pkg/analyze/postgres.go b/pkg/analyze/postgres.go index 8be4c304d..5ed09cd98 100644 --- a/pkg/analyze/postgres.go +++ b/pkg/analyze/postgres.go @@ -6,11 +6,11 @@ import ( "path" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/collect" ) -func analyzePostgres(analyzer *troubleshootv1beta1.DatabaseAnalyze, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzePostgres(analyzer *troubleshootv1beta2.DatabaseAnalyze, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { collectorName := analyzer.CollectorName if collectorName == "" { collectorName = "postgres" diff --git a/pkg/analyze/redis.go b/pkg/analyze/redis.go index b92e40da8..79e0f29a1 100644 --- a/pkg/analyze/redis.go +++ b/pkg/analyze/redis.go @@ -6,11 +6,11 @@ import ( "path" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/collect" ) -func analyzeRedis(analyzer *troubleshootv1beta1.DatabaseAnalyze, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeRedis(analyzer *troubleshootv1beta2.DatabaseAnalyze, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { collectorName := analyzer.CollectorName if collectorName == "" { collectorName = "redis" diff --git a/pkg/analyze/secret.go b/pkg/analyze/secret.go index 36751e0ca..012289c8c 100644 --- a/pkg/analyze/secret.go +++ b/pkg/analyze/secret.go @@ -4,11 +4,11 @@ import ( "encoding/json" "fmt" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/collect" ) -func analyzeSecret(analyzer *troubleshootv1beta1.AnalyzeSecret, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeSecret(analyzer *troubleshootv1beta2.AnalyzeSecret, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { secretData, err := getCollectedFileContents(fmt.Sprintf("secrets/%s/%s.json", analyzer.Namespace, analyzer.SecretName)) if err != nil { return nil, err @@ -30,7 +30,7 @@ func analyzeSecret(analyzer *troubleshootv1beta1.AnalyzeSecret, getCollectedFile IconURI: "https://troubleshoot.sh/images/analyzer-icons/secret.svg?w=13&h=16", } - var failOutcome *troubleshootv1beta1.Outcome + var failOutcome *troubleshootv1beta2.Outcome for _, outcome := range analyzer.Outcomes { if outcome.Fail != nil { failOutcome = outcome diff --git a/pkg/analyze/statefulset_status.go b/pkg/analyze/statefulset_status.go index 2f061d896..dc7a19d24 100644 --- a/pkg/analyze/statefulset_status.go +++ b/pkg/analyze/statefulset_status.go @@ -6,11 +6,11 @@ import ( "path" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" appsv1 "k8s.io/api/apps/v1" ) -func analyzeStatefulsetStatus(analyzer *troubleshootv1beta1.StatefulsetStatus, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeStatefulsetStatus(analyzer *troubleshootv1beta2.StatefulsetStatus, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { collected, err := getCollectedFileContents(path.Join("cluster-resources", "statefulsets", fmt.Sprintf("%s.json", analyzer.Namespace))) if err != nil { return nil, errors.Wrap(err, "failed to read collected statefulsets from namespace") diff --git a/pkg/analyze/storage_class.go b/pkg/analyze/storage_class.go index 1f77a04fa..2f08cfc79 100644 --- a/pkg/analyze/storage_class.go +++ b/pkg/analyze/storage_class.go @@ -4,11 +4,11 @@ import ( "encoding/json" "fmt" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" storagev1beta1 "k8s.io/api/storage/v1beta1" ) -func analyzeStorageClass(analyzer *troubleshootv1beta1.StorageClass, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeStorageClass(analyzer *troubleshootv1beta2.StorageClass, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { storageClassesData, err := getCollectedFileContents("cluster-resources/storage-classes.json") if err != nil { return nil, err diff --git a/pkg/analyze/text_analyze.go b/pkg/analyze/text_analyze.go index a1ac61022..435ee0e0f 100644 --- a/pkg/analyze/text_analyze.go +++ b/pkg/analyze/text_analyze.go @@ -8,10 +8,10 @@ import ( "strings" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" ) -func analyzeTextAnalyze(analyzer *troubleshootv1beta1.TextAnalyze, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { +func analyzeTextAnalyze(analyzer *troubleshootv1beta2.TextAnalyze, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) { fullPath := filepath.Join(analyzer.CollectorName, analyzer.FileName) collected, err := getCollectedFileContents(fullPath) if err != nil { @@ -40,14 +40,14 @@ func analyzeTextAnalyze(analyzer *troubleshootv1beta1.TextAnalyze, getCollectedF }, nil } -func analyzeRegexPattern(pattern string, collected []byte, outcomes []*troubleshootv1beta1.Outcome, checkName string) (*AnalyzeResult, error) { +func analyzeRegexPattern(pattern string, collected []byte, outcomes []*troubleshootv1beta2.Outcome, checkName string) (*AnalyzeResult, error) { re, err := regexp.Compile(pattern) if err != nil { return nil, errors.Wrapf(err, "failed to compile regex: %s", pattern) } - var failOutcome *troubleshootv1beta1.Outcome - var passOutcome *troubleshootv1beta1.Outcome + var failOutcome *troubleshootv1beta2.Outcome + var passOutcome *troubleshootv1beta2.Outcome for _, outcome := range outcomes { if outcome.Fail != nil { failOutcome = outcome @@ -75,7 +75,7 @@ func analyzeRegexPattern(pattern string, collected []byte, outcomes []*troublesh }, nil } -func analyzeRegexGroups(pattern string, collected []byte, outcomes []*troubleshootv1beta1.Outcome, checkName string) (*AnalyzeResult, error) { +func analyzeRegexGroups(pattern string, collected []byte, outcomes []*troubleshootv1beta2.Outcome, checkName string) (*AnalyzeResult, error) { re, err := regexp.Compile(pattern) if err != nil { return nil, errors.Wrapf(err, "failed to compile regex: %s", pattern) diff --git a/pkg/analyze/text_analyze_test.go b/pkg/analyze/text_analyze_test.go index 2643a39a3..b6aa699e9 100644 --- a/pkg/analyze/text_analyze_test.go +++ b/pkg/analyze/text_analyze_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.undefinedlabs.com/scopeagent" @@ -13,21 +13,21 @@ import ( func Test_textAnalyze(t *testing.T) { tests := []struct { name string - analyzer troubleshootv1beta1.TextAnalyze + analyzer troubleshootv1beta2.TextAnalyze expectResult AnalyzeResult files map[string][]byte }{ { name: "success case 1", - analyzer: troubleshootv1beta1.TextAnalyze{ - Outcomes: []*troubleshootv1beta1.Outcome{ + analyzer: troubleshootv1beta2.TextAnalyze{ + Outcomes: []*troubleshootv1beta2.Outcome{ { - Pass: &troubleshootv1beta1.SingleOutcome{ + Pass: &troubleshootv1beta2.SingleOutcome{ Message: "pass", }, }, { - Fail: &troubleshootv1beta1.SingleOutcome{ + Fail: &troubleshootv1beta2.SingleOutcome{ Message: "fail", }, }, @@ -49,15 +49,15 @@ func Test_textAnalyze(t *testing.T) { }, { name: "failure case 1", - analyzer: troubleshootv1beta1.TextAnalyze{ - Outcomes: []*troubleshootv1beta1.Outcome{ + analyzer: troubleshootv1beta2.TextAnalyze{ + Outcomes: []*troubleshootv1beta2.Outcome{ { - Pass: &troubleshootv1beta1.SingleOutcome{ + Pass: &troubleshootv1beta2.SingleOutcome{ Message: "success", }, }, { - Fail: &troubleshootv1beta1.SingleOutcome{ + Fail: &troubleshootv1beta2.SingleOutcome{ Message: "fail", }, }, @@ -81,15 +81,15 @@ func Test_textAnalyze(t *testing.T) { }, { name: "success case 2", - analyzer: troubleshootv1beta1.TextAnalyze{ - Outcomes: []*troubleshootv1beta1.Outcome{ + analyzer: troubleshootv1beta2.TextAnalyze{ + Outcomes: []*troubleshootv1beta2.Outcome{ { - Pass: &troubleshootv1beta1.SingleOutcome{ + Pass: &troubleshootv1beta2.SingleOutcome{ Message: "success", }, }, { - Fail: &troubleshootv1beta1.SingleOutcome{ + Fail: &troubleshootv1beta2.SingleOutcome{ Message: "fail", }, }, @@ -113,15 +113,15 @@ func Test_textAnalyze(t *testing.T) { }, { name: "success case 3", - analyzer: troubleshootv1beta1.TextAnalyze{ - Outcomes: []*troubleshootv1beta1.Outcome{ + analyzer: troubleshootv1beta2.TextAnalyze{ + Outcomes: []*troubleshootv1beta2.Outcome{ { - Pass: &troubleshootv1beta1.SingleOutcome{ + Pass: &troubleshootv1beta2.SingleOutcome{ Message: "success", }, }, { - Fail: &troubleshootv1beta1.SingleOutcome{ + Fail: &troubleshootv1beta2.SingleOutcome{ Message: "fail", }, }, @@ -143,15 +143,15 @@ func Test_textAnalyze(t *testing.T) { }, { name: "failure case 3", - analyzer: troubleshootv1beta1.TextAnalyze{ - Outcomes: []*troubleshootv1beta1.Outcome{ + analyzer: troubleshootv1beta2.TextAnalyze{ + Outcomes: []*troubleshootv1beta2.Outcome{ { - Pass: &troubleshootv1beta1.SingleOutcome{ + Pass: &troubleshootv1beta2.SingleOutcome{ Message: "success", }, }, { - Fail: &troubleshootv1beta1.SingleOutcome{ + Fail: &troubleshootv1beta2.SingleOutcome{ Message: "fail", }, }, @@ -175,15 +175,15 @@ func Test_textAnalyze(t *testing.T) { }, { name: "failure case 4", - analyzer: troubleshootv1beta1.TextAnalyze{ - Outcomes: []*troubleshootv1beta1.Outcome{ + analyzer: troubleshootv1beta2.TextAnalyze{ + Outcomes: []*troubleshootv1beta2.Outcome{ { - Pass: &troubleshootv1beta1.SingleOutcome{ + Pass: &troubleshootv1beta2.SingleOutcome{ Message: "success", }, }, { - Fail: &troubleshootv1beta1.SingleOutcome{ + Fail: &troubleshootv1beta2.SingleOutcome{ Message: "fail", }, }, diff --git a/pkg/apis/addtoscheme_troubleshoot_v1beta2.go b/pkg/apis/addtoscheme_troubleshoot_v1beta2.go new file mode 100644 index 000000000..8129e441c --- /dev/null +++ b/pkg/apis/addtoscheme_troubleshoot_v1beta2.go @@ -0,0 +1,26 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apis + +import ( + "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" +) + +func init() { + // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back + AddToSchemes = append(AddToSchemes, v1beta2.SchemeBuilder.AddToScheme) +} diff --git a/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go b/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go index 0a3e6a364..f20321c33 100644 --- a/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go @@ -938,6 +938,11 @@ func (in *Logs) DeepCopy() *Logs { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeResourceFilters) DeepCopyInto(out *NodeResourceFilters) { *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(NodeResourceSelectors) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeResourceFilters. @@ -950,6 +955,28 @@ func (in *NodeResourceFilters) DeepCopy() *NodeResourceFilters { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeResourceSelectors) DeepCopyInto(out *NodeResourceSelectors) { + *out = *in + if in.MatchLabel != nil { + in, out := &in.MatchLabel, &out.MatchLabel + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeResourceSelectors. +func (in *NodeResourceSelectors) DeepCopy() *NodeResourceSelectors { + if in == nil { + return nil + } + out := new(NodeResourceSelectors) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeResources) DeepCopyInto(out *NodeResources) { *out = *in @@ -968,7 +995,7 @@ func (in *NodeResources) DeepCopyInto(out *NodeResources) { if in.Filters != nil { in, out := &in.Filters, &out.Filters *out = new(NodeResourceFilters) - **out = **in + (*in).DeepCopyInto(*out) } } diff --git a/pkg/apis/troubleshoot/v1beta2/analyzer_shared.go b/pkg/apis/troubleshoot/v1beta2/analyzer_shared.go new file mode 100644 index 000000000..ffa530690 --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/analyzer_shared.go @@ -0,0 +1,139 @@ +package v1beta2 + +import ( + "github.com/replicatedhq/troubleshoot/pkg/multitype" +) + +type SingleOutcome struct { + When string `json:"when,omitempty" yaml:"when,omitempty"` + Message string `json:"message,omitempty" yaml:"message,omitempty"` + URI string `json:"uri,omitempty" yaml:"uri,omitempty"` +} + +type Outcome struct { + Fail *SingleOutcome `json:"fail,omitempty" yaml:"fail,omitempty"` + Warn *SingleOutcome `json:"warn,omitempty" yaml:"warn,omitempty"` + Pass *SingleOutcome `json:"pass,omitempty" yaml:"pass,omitempty"` +} + +type ClusterVersion struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` +} + +type StorageClass struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` + StorageClassName string `json:"storageClassName" yaml:"storageClassName"` +} + +type CustomResourceDefinition struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` + CustomResourceDefinitionName string `json:"customResourceDefinitionName" yaml:"customResourceDefinitionName"` +} + +type Ingress struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` + IngressName string `json:"ingressName" yaml:"ingressName"` + Namespace string `json:"namespace" yaml:"namespace"` +} + +type AnalyzeSecret struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` + SecretName string `json:"secretName" yaml:"secretName"` + Namespace string `json:"namespace" yaml:"namespace"` + Key string `json:"key,omitempty" yaml:"key,omitempty"` +} + +type ImagePullSecret struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + 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"` + Namespace string `json:"namespace" yaml:"namespace"` + Name string `json:"name" yaml:"name"` +} + +type StatefulsetStatus struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` + Namespace string `json:"namespace" yaml:"namespace"` + Name string `json:"name" yaml:"name"` +} + +type ContainerRuntime struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` +} + +type Distribution struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` +} + +type NodeResources struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` + Filters *NodeResourceFilters `json:"filters,omitempty" yaml:"filters,omitempty"` +} + +type NodeResourceFilters struct { + CPUCapacity string `json:"cpuCapacity,omitempty" yaml:"cpuCapacity,omitempty"` + CPUAllocatable string `json:"cpuAllocatable,omitempty" yaml:"cpuAllocatable,omitempty"` + MemoryCapacity string `json:"memoryCapacity,omitempty" yaml:"memoryCapacity,omitempty"` + MemoryAllocatable string `json:"memoryAllocatable,omitempty" yaml:"memoryAllocatable,omitempty"` + PodCapacity string `json:"podCapacity,omitempty" yaml:"podCapacity,omitempty"` + PodAllocatable string `json:"podAllocatable,omitempty" yaml:"podAllocatable,omitempty"` + EphemeralStorageCapacity string `json:"ephemeralStorageCapacity,omitempty" yaml:"ephemeralStorageCapacity,omitempty"` + EphemeralStorageAllocatable string `json:"ephemeralStorageAllocatable,omitempty" yaml:"ephemeralStorageAllocatable,omitempty"` + Selector *NodeResourceSelectors `json:"selector,omitempty" yaml:"selector,omitempty"` +} + +type NodeResourceSelectors struct { + MatchLabel map[string]string `json:"matchLabel,omitempty" yaml:"matchLabel,omitempty"` +} + +type TextAnalyze struct { + AnalyzeMeta `json:",inline" yaml:",inline"` + CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"` + FileName string `json:"fileName,omitempty" yaml:"fileName,omitempty"` + RegexPattern string `json:"regex,omitempty" yaml:"regex,omitempty"` + RegexGroups string `json:"regexGroups,omitempty" yaml:"regexGroups,omitempty"` + Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` +} + +type DatabaseAnalyze 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"` +} + +type Analyze struct { + ClusterVersion *ClusterVersion `json:"clusterVersion,omitempty" yaml:"clusterVersion,omitempty"` + StorageClass *StorageClass `json:"storageClass,omitempty" yaml:"storageClass,omitempty"` + CustomResourceDefinition *CustomResourceDefinition `json:"customResourceDefinition,omitempty" yaml:"customResourceDefinition,omitempty"` + Ingress *Ingress `json:"ingress,omitempty" yaml:"ingress,omitempty"` + Secret *AnalyzeSecret `json:"secret,omitempty" yaml:"secret,omitempty"` + ImagePullSecret *ImagePullSecret `json:"imagePullSecret,omitempty" yaml:"imagePullSecret,omitempty"` + DeploymentStatus *DeploymentStatus `json:"deploymentStatus,omitempty" yaml:"deploymentStatus,omitempty"` + StatefulsetStatus *StatefulsetStatus `json:"statefulsetStatus,omitempty" yaml:"statefulsetStatus,omitempty"` + ContainerRuntime *ContainerRuntime `json:"containerRuntime,omitempty" yaml:"containerRuntime,omitempty"` + Distribution *Distribution `json:"distribution,omitempty" yaml:"distribution,omitempty"` + NodeResources *NodeResources `json:"nodeResources,omitempty" yaml:"nodeResources,omitempty"` + TextAnalyze *TextAnalyze `json:"textAnalyze,omitempty" yaml:"textAnalyze,omitempty"` + Postgres *DatabaseAnalyze `json:"postgres,omitempty" yaml:"postgres,omitempty"` + Mysql *DatabaseAnalyze `json:"mysql,omitempty" yaml:"mysql,omitempty"` + Redis *DatabaseAnalyze `json:"redis,omitempty" yaml:"redis,omitempty"` +} diff --git a/pkg/apis/troubleshoot/v1beta2/analyzer_types.go b/pkg/apis/troubleshoot/v1beta2/analyzer_types.go new file mode 100644 index 000000000..4e3985b8e --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/analyzer_types.go @@ -0,0 +1,56 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// AnalyzerSpec defines the desired state of Analyzer +type AnalyzerSpec struct { + Analyzers []*Analyze `json:"analyzers,omitempty"` +} + +// AnalyzerStatus defines the observed state of Analyzer +type AnalyzerStatus struct { +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Analyzer is the Schema for the analyzers API +// +k8s:openapi-gen=true +type Analyzer struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AnalyzerSpec `json:"spec,omitempty"` + Status AnalyzerStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AnalyzerList contains a list of Analyzer +type AnalyzerList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Analyzer `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Analyzer{}, &AnalyzerList{}) +} diff --git a/pkg/apis/troubleshoot/v1beta2/collector_shared.go b/pkg/apis/troubleshoot/v1beta2/collector_shared.go new file mode 100644 index 000000000..970098567 --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/collector_shared.go @@ -0,0 +1,350 @@ +package v1beta2 + +import ( + "fmt" + "strings" + + "github.com/replicatedhq/troubleshoot/pkg/multitype" + authorizationv1 "k8s.io/api/authorization/v1" +) + +type CollectorMeta struct { + CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"` + // +optional + Exclude multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"` +} + +type ClusterInfo struct { + CollectorMeta `json:",inline" yaml:",inline"` +} + +type ClusterResources struct { + CollectorMeta `json:",inline" yaml:",inline"` +} + +type Secret struct { + CollectorMeta `json:",inline" yaml:",inline"` + SecretName string `json:"name" yaml:"name"` + Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"` + Key string `json:"key,omitempty" yaml:"key,omitempty"` + IncludeValue bool `json:"includeValue,omitempty" yaml:"includeValue,omitempty"` +} + +type LogLimits struct { + MaxAge string `json:"maxAge,omitempty" yaml:"maxAge,omitempty"` + MaxLines int64 `json:"maxLines,omitempty" yaml:"maxLines,omitempty"` +} + +type Logs struct { + CollectorMeta `json:",inline" yaml:",inline"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Selector []string `json:"selector" yaml:"selector"` + Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"` + ContainerNames []string `json:"containerNames,omitempty" yaml:"containerNames,omitempty"` + Limits *LogLimits `json:"limits,omitempty" yaml:"omitempty"` +} + +type Data struct { + CollectorMeta `json:",inline" yaml:",inline"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Data string `json:"data" yaml:"data"` +} + +type Run struct { + CollectorMeta `json:",inline" yaml:",inline"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Namespace string `json:"namespace" yaml:"namespace"` + Image string `json:"image" yaml:"image"` + Command []string `json:"command,omitempty" yaml:"command,omitempty"` + Args []string `json:"args,omitempty" yaml:"args,omitempty"` + Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"` + ImagePullPolicy string `json:"imagePullPolicy,omitempty" yaml:"imagePullPolicy,omitempty"` +} + +type Exec struct { + CollectorMeta `json:",inline" yaml:",inline"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Selector []string `json:"selector" yaml:"selector"` + Namespace string `json:"namespace" yaml:"namespace"` + ContainerName string `json:"containerName,omitempty" yaml:"containerName,omitempty"` + Command []string `json:"command,omitempty" yaml:"command,omitempty"` + Args []string `json:"args,omitempty" yaml:"args,omitempty"` + Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"` +} + +type Copy struct { + CollectorMeta `json:",inline" yaml:",inline"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Selector []string `json:"selector" yaml:"selector"` + Namespace string `json:"namespace" yaml:"namespace"` + ContainerPath string `json:"containerPath" yaml:"containerPath"` + ContainerName string `json:"containerName,omitempty" yaml:"containerName,omitempty"` +} + +type HTTP struct { + CollectorMeta `json:",inline" yaml:",inline"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Get *Get `json:"get,omitempty" yaml:"get,omitempty"` + Post *Post `json:"post,omitempty" yaml:"post,omitempty"` + Put *Put `json:"put,omitempty" yaml:"put,omitempty"` +} + +type Get struct { + URL string `json:"url" yaml:"url"` + InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"` + Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"` +} + +type Post struct { + URL string `json:"url" yaml:"url"` + InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"` + Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"` + Body string `json:"body,omitempty" yaml:"body,omitempty"` +} + +type Put struct { + URL string `json:"url" yaml:"url"` + InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"` + Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"` + Body string `json:"body,omitempty" yaml:"body,omitempty"` +} + +type Database 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"` + Secret *Secret `json:"secret,omitempty" yaml:"secret,omitempty"` + Logs *Logs `json:"logs,omitempty" yaml:"logs,omitempty"` + Run *Run `json:"run,omitempty" yaml:"run,omitempty"` + Exec *Exec `json:"exec,omitempty" yaml:"exec,omitempty"` + Data *Data `json:"data,omitempty" yaml:"data,omitempty"` + Copy *Copy `json:"copy,omitempty" yaml:"copy,omitempty"` + HTTP *HTTP `json:"http,omitempty" yaml:"http,omitempty"` + Postgres *Database `json:"postgres,omitempty" yaml:"postgres,omitempty"` + Mysql *Database `json:"mysql,omitempty" yaml:"mysql,omitempty"` + Redis *Database `json:"redis,omitempty" yaml:"redis,omitempty"` +} + +func (c *Collect) AccessReviewSpecs(overrideNS string) []authorizationv1.SelfSubjectAccessReviewSpec { + result := make([]authorizationv1.SelfSubjectAccessReviewSpec, 0) + + if c.ClusterInfo != nil { + // NOOP + } else if c.ClusterResources != nil { + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: "", + Verb: "list", + Group: "", + Version: "", + Resource: "Namespace", + Subresource: "", + Name: "", + }, + NonResourceAttributes: nil, + }) + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: "", + Verb: "list", + Group: "", + Version: "", + Resource: "Node", + Subresource: "", + Name: "", + }, + NonResourceAttributes: nil, + }) + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: "", + Verb: "list", + Group: "apiextensions.k8s.io", + Version: "", + Resource: "CustomResourceDefinition", + Subresource: "", + Name: "", + }, + NonResourceAttributes: nil, + }) + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: "", + Verb: "list", + Group: "storage.k8s.io", + Version: "", + Resource: "StorageClasses", + Subresource: "", + Name: "", + }, + NonResourceAttributes: nil, + }) + } else if c.Secret != nil { + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: pickNamespaceOrDefault(c.Secret.Namespace, overrideNS), + Verb: "get", + Group: "", + Version: "", + Resource: "Secret", + Subresource: "", + Name: c.Secret.SecretName, + }, + NonResourceAttributes: nil, + }) + } else if c.Logs != nil { + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: pickNamespaceOrDefault(c.Logs.Namespace, overrideNS), + Verb: "list", + Group: "", + Version: "", + Resource: "Pod", + Subresource: "", + Name: "", + }, + NonResourceAttributes: nil, + }) + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: pickNamespaceOrDefault(c.Logs.Namespace, overrideNS), + Verb: "get", + Group: "", + Version: "", + Resource: "Pod", + Subresource: "log", + Name: "", + }, + NonResourceAttributes: nil, + }) + } else if c.Run != nil { + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: pickNamespaceOrDefault(c.Run.Namespace, overrideNS), + Verb: "create", + Group: "", + Version: "", + Resource: "Pod", + Subresource: "", + Name: "", + }, + NonResourceAttributes: nil, + }) + } else if c.Exec != nil { + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: pickNamespaceOrDefault(c.Exec.Namespace, overrideNS), + Verb: "list", + Group: "", + Version: "", + Resource: "Pod", + Subresource: "", + Name: "", + }, + NonResourceAttributes: nil, + }) + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: pickNamespaceOrDefault(c.Exec.Namespace, overrideNS), + Verb: "get", + Group: "", + Version: "", + Resource: "Pod", + Subresource: "exec", + Name: "", + }, + NonResourceAttributes: nil, + }) + } else if c.Copy != nil { + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: pickNamespaceOrDefault(c.Copy.Namespace, overrideNS), + Verb: "list", + Group: "", + Version: "", + Resource: "Pod", + Subresource: "", + Name: "", + }, + NonResourceAttributes: nil, + }) + result = append(result, authorizationv1.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationv1.ResourceAttributes{ + Namespace: pickNamespaceOrDefault(c.Copy.Namespace, overrideNS), + Verb: "get", + Group: "", + Version: "", + Resource: "Pod", + Subresource: "exec", + Name: "", + }, + NonResourceAttributes: nil, + }) + } else if c.HTTP != nil { + // NOOP + } + + return result +} + +func (c *Collect) GetName() string { + var collector, name, selector string + if c.ClusterInfo != nil { + collector = "cluster-info" + } + if c.ClusterResources != nil { + collector = "cluster-resources" + } + if c.Secret != nil { + collector = "secret" + name = c.Secret.CollectorName + } + if c.Logs != nil { + collector = "logs" + name = c.Logs.CollectorName + selector = strings.Join(c.Logs.Selector, ",") + } + if c.Run != nil { + collector = "run" + name = c.Run.CollectorName + } + if c.Exec != nil { + collector = "exec" + name = c.Exec.CollectorName + selector = strings.Join(c.Exec.Selector, ",") + } + if c.Copy != nil { + collector = "copy" + name = c.Copy.CollectorName + selector = strings.Join(c.Copy.Selector, ",") + } + if c.HTTP != nil { + collector = "http" + name = c.HTTP.CollectorName + } + + if collector == "" { + return "" + } + if name != "" { + return fmt.Sprintf("%s/%s", collector, name) + } + if selector != "" { + return fmt.Sprintf("%s/%s", collector, selector) + } + return collector +} + +func pickNamespaceOrDefault(collectorNS string, overrideNS string) string { + if overrideNS != "" { + return overrideNS + } + if collectorNS != "" { + return collectorNS + } + return "default" +} diff --git a/pkg/apis/troubleshoot/v1beta2/collector_types.go b/pkg/apis/troubleshoot/v1beta2/collector_types.go new file mode 100644 index 000000000..9a284458b --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/collector_types.go @@ -0,0 +1,70 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type ResultRequest struct { + URI string `json:"uri" yaml:"uri"` + Method string `json:"method" yaml:"method"` + RedactURI string `json:"redactUri" yaml:"redactUri"` // the URI to POST redaction reports to +} + +type AfterCollection struct { + UploadResultsTo *ResultRequest `json:"uploadResultsTo,omitempty" yaml:"uploadResultsTo,omitempty"` + Callback *ResultRequest `json:"callback,omitempty" yaml:"callback,omitempty"` +} + +// CollectorSpec defines the desired state of Collector +type CollectorSpec struct { + Collectors []*Collect `json:"collectors,omitempty" yaml:"collectors,omitempty"` + AfterCollection []*AfterCollection `json:"afterCollection,omitempty" yaml:"afterCollection,omitempty"` +} + +// CollectorStatus defines the observed state of Collector +type CollectorStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Collector is the Schema for the collectors API +// +k8s:openapi-gen=true +type Collector struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Spec CollectorSpec `json:"spec,omitempty" yaml:"spec,omitempty"` + Status CollectorStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// CollectorList contains a list of Collector +type CollectorList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Collector `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Collector{}, &CollectorList{}) +} diff --git a/pkg/apis/troubleshoot/v1beta2/doc.go b/pkg/apis/troubleshoot/v1beta2/doc.go new file mode 100644 index 000000000..45b014c9d --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1beta2 contains API Schema definitions for the troubleshoot v1beta2 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot +// +k8s:defaulter-gen=TypeMeta +// +groupName=troubleshoot.sh +package v1beta2 diff --git a/pkg/apis/troubleshoot/v1beta2/preflight_types.go b/pkg/apis/troubleshoot/v1beta2/preflight_types.go new file mode 100644 index 000000000..f6c3bac64 --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/preflight_types.go @@ -0,0 +1,60 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PreflightSpec defines the desired state of Preflight +type PreflightSpec struct { + UploadResultsTo string `json:"uploadResultsTo,omitempty" yaml:"uploadResultsTo,omitempty"` + Collectors []*Collect `json:"collectors,omitempty" yaml:"collectors,omitempty"` + Analyzers []*Analyze `json:"analyzers,omitempty" yaml:"analyzers,omitempty"` +} + +// PreflightStatus defines the observed state of Preflight +type PreflightStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Preflight is the Schema for the preflights API +// +k8s:openapi-gen=true +type Preflight struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Spec PreflightSpec `json:"spec,omitempty" yaml:"spec,omitempty"` + Status PreflightStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PreflightList contains a list of Preflight +type PreflightList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Preflight `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Preflight{}, &PreflightList{}) +} diff --git a/pkg/apis/troubleshoot/v1beta2/redact_shared.go b/pkg/apis/troubleshoot/v1beta2/redact_shared.go new file mode 100644 index 000000000..74d19de3d --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/redact_shared.go @@ -0,0 +1,23 @@ +package v1beta2 + +type Regex struct { + Selector string `json:"selector,omitempty" yaml:"selector,omitempty"` + Redactor string `json:"redactor,omitempty" yaml:"redactor,omitempty"` +} + +type FileSelector struct { + File string `json:"file,omitempty" yaml:"file,omitempty"` + Files []string `json:"files,omitempty" yaml:"files,omitempty"` +} + +type Removals struct { + Values []string `json:"values,omitempty" yaml:"values,omitempty"` + Regex []Regex `json:"regex,omitempty" yaml:"regex,omitempty"` + YamlPath []string `json:"yamlPath,omitempty" yaml:"yamlPath,omitempty"` +} + +type Redact struct { + Name string `json:"name,omitempty" yaml:"name,omitempty"` + FileSelector FileSelector `json:"fileSelector,omitempty" yaml:"fileSelector,omitempty"` + Removals Removals `json:"removals,omitempty" yaml:"removals,omitempty"` +} diff --git a/pkg/apis/troubleshoot/v1beta2/redact_types.go b/pkg/apis/troubleshoot/v1beta2/redact_types.go new file mode 100644 index 000000000..68fc0089e --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/redact_types.go @@ -0,0 +1,56 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// RedactorSpec defines the desired state of Redactor +type RedactorSpec struct { + Redactors []*Redact `json:"redactors,omitempty"` +} + +// RedactorStatus defines the observed state of Redactor +type RedactorStatus struct { +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Redactor is the Schema for the redaction API +// +k8s:openapi-gen=true +type Redactor struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec RedactorSpec `json:"spec,omitempty"` + Status RedactorStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// RedactorList contains a list of Redactor +type RedactorList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Redactor `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Redactor{}, &RedactorList{}) +} diff --git a/pkg/apis/troubleshoot/v1beta2/register.go b/pkg/apis/troubleshoot/v1beta2/register.go new file mode 100644 index 000000000..2bf20bdfc --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/register.go @@ -0,0 +1,46 @@ +/* +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. +*/ + +// NOTE: Boilerplate only. Ignore this file. + +// Package v1beta2 contains API Schema definitions for the troubleshoot v1beta2 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot +// +k8s:defaulter-gen=TypeMeta +// +groupName=troubleshoot.sh +package v1beta2 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "troubleshoot.sh", Version: "v1beta2"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} + + // AddToScheme is required by pkg/client/... + AddToScheme = SchemeBuilder.AddToScheme +) + +// Resource is required by pkg/client/listers/... +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/pkg/apis/troubleshoot/v1beta2/supportbundle_types.go b/pkg/apis/troubleshoot/v1beta2/supportbundle_types.go new file mode 100644 index 000000000..c18565e78 --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/supportbundle_types.go @@ -0,0 +1,60 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// SupportBundleSpec defines the desired state of SupportBundle +type SupportBundleSpec struct { + AfterCollection []*AfterCollection `json:"afterCollection,omitempty" yaml:"afterCollection,omitempty"` + Collectors []*Collect `json:"collectors,omitempty" yaml:"collectors,omitempty"` + Analyzers []*Analyze `json:"analyzers,omitempty" yaml:"analyzers,omitempty"` +} + +// SupportBundleStatus defines the observed state of SupportBundle +type SupportBundleStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// SupportBundle is the Schema for the SupportBundles API +// +k8s:openapi-gen=true +type SupportBundle struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Spec SupportBundleSpec `json:"spec,omitempty" yaml:"spec,omitempty"` + Status SupportBundleStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// SupportBundleList contains a list of SupportBundle +type SupportBundleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []SupportBundle `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SupportBundle{}, &SupportBundleList{}) +} diff --git a/pkg/apis/troubleshoot/v1beta2/version.go b/pkg/apis/troubleshoot/v1beta2/version.go new file mode 100644 index 000000000..25a173339 --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/version.go @@ -0,0 +1,11 @@ +package v1beta2 + +type SupportBundleVersionSpec struct { + VersionNumber string `json:"versionNumber" yaml:"versionNumber"` +} + +type SupportBundleVersion struct { + ApiVersion string `json:"apiVersion" yaml:"apiVersion"` + Kind string `json:"kind" yaml:"kind"` + Spec SupportBundleVersionSpec `json:"spec" yaml:"spec"` +} diff --git a/pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go b/pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go new file mode 100644 index 000000000..638bccca6 --- /dev/null +++ b/pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go @@ -0,0 +1,1663 @@ +// +build !ignore_autogenerated + +/* +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 controller-gen. DO NOT EDIT. + +package v1beta2 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AfterCollection) DeepCopyInto(out *AfterCollection) { + *out = *in + if in.UploadResultsTo != nil { + in, out := &in.UploadResultsTo, &out.UploadResultsTo + *out = new(ResultRequest) + **out = **in + } + if in.Callback != nil { + in, out := &in.Callback, &out.Callback + *out = new(ResultRequest) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AfterCollection. +func (in *AfterCollection) DeepCopy() *AfterCollection { + if in == nil { + return nil + } + out := new(AfterCollection) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Analyze) DeepCopyInto(out *Analyze) { + *out = *in + if in.ClusterVersion != nil { + in, out := &in.ClusterVersion, &out.ClusterVersion + *out = new(ClusterVersion) + (*in).DeepCopyInto(*out) + } + if in.StorageClass != nil { + in, out := &in.StorageClass, &out.StorageClass + *out = new(StorageClass) + (*in).DeepCopyInto(*out) + } + if in.CustomResourceDefinition != nil { + in, out := &in.CustomResourceDefinition, &out.CustomResourceDefinition + *out = new(CustomResourceDefinition) + (*in).DeepCopyInto(*out) + } + if in.Ingress != nil { + in, out := &in.Ingress, &out.Ingress + *out = new(Ingress) + (*in).DeepCopyInto(*out) + } + if in.Secret != nil { + in, out := &in.Secret, &out.Secret + *out = new(AnalyzeSecret) + (*in).DeepCopyInto(*out) + } + if in.ImagePullSecret != nil { + in, out := &in.ImagePullSecret, &out.ImagePullSecret + *out = new(ImagePullSecret) + (*in).DeepCopyInto(*out) + } + if in.DeploymentStatus != nil { + in, out := &in.DeploymentStatus, &out.DeploymentStatus + *out = new(DeploymentStatus) + (*in).DeepCopyInto(*out) + } + if in.StatefulsetStatus != nil { + in, out := &in.StatefulsetStatus, &out.StatefulsetStatus + *out = new(StatefulsetStatus) + (*in).DeepCopyInto(*out) + } + if in.ContainerRuntime != nil { + in, out := &in.ContainerRuntime, &out.ContainerRuntime + *out = new(ContainerRuntime) + (*in).DeepCopyInto(*out) + } + if in.Distribution != nil { + in, out := &in.Distribution, &out.Distribution + *out = new(Distribution) + (*in).DeepCopyInto(*out) + } + if in.NodeResources != nil { + in, out := &in.NodeResources, &out.NodeResources + *out = new(NodeResources) + (*in).DeepCopyInto(*out) + } + if in.TextAnalyze != nil { + in, out := &in.TextAnalyze, &out.TextAnalyze + *out = new(TextAnalyze) + (*in).DeepCopyInto(*out) + } + if in.Postgres != nil { + in, out := &in.Postgres, &out.Postgres + *out = new(DatabaseAnalyze) + (*in).DeepCopyInto(*out) + } + if in.Mysql != nil { + in, out := &in.Mysql, &out.Mysql + *out = new(DatabaseAnalyze) + (*in).DeepCopyInto(*out) + } + if in.Redis != nil { + in, out := &in.Redis, &out.Redis + *out = new(DatabaseAnalyze) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Analyze. +func (in *Analyze) DeepCopy() *Analyze { + if in == nil { + return nil + } + out := new(Analyze) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AnalyzeMeta) DeepCopyInto(out *AnalyzeMeta) { + *out = *in + out.Exclude = in.Exclude +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalyzeMeta. +func (in *AnalyzeMeta) DeepCopy() *AnalyzeMeta { + if in == nil { + return nil + } + out := new(AnalyzeMeta) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AnalyzeSecret) DeepCopyInto(out *AnalyzeSecret) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 AnalyzeSecret. +func (in *AnalyzeSecret) DeepCopy() *AnalyzeSecret { + if in == nil { + return nil + } + out := new(AnalyzeSecret) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Analyzer) DeepCopyInto(out *Analyzer) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Analyzer. +func (in *Analyzer) DeepCopy() *Analyzer { + if in == nil { + return nil + } + out := new(Analyzer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Analyzer) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AnalyzerList) DeepCopyInto(out *AnalyzerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Analyzer, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalyzerList. +func (in *AnalyzerList) DeepCopy() *AnalyzerList { + if in == nil { + return nil + } + out := new(AnalyzerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AnalyzerList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AnalyzerSpec) DeepCopyInto(out *AnalyzerSpec) { + *out = *in + if in.Analyzers != nil { + in, out := &in.Analyzers, &out.Analyzers + *out = make([]*Analyze, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Analyze) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalyzerSpec. +func (in *AnalyzerSpec) DeepCopy() *AnalyzerSpec { + if in == nil { + return nil + } + out := new(AnalyzerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AnalyzerStatus) DeepCopyInto(out *AnalyzerStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalyzerStatus. +func (in *AnalyzerStatus) DeepCopy() *AnalyzerStatus { + if in == nil { + return nil + } + out := new(AnalyzerStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterInfo) DeepCopyInto(out *ClusterInfo) { + *out = *in + out.CollectorMeta = in.CollectorMeta +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterInfo. +func (in *ClusterInfo) DeepCopy() *ClusterInfo { + if in == nil { + return nil + } + out := new(ClusterInfo) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterResources) DeepCopyInto(out *ClusterResources) { + *out = *in + out.CollectorMeta = in.CollectorMeta +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResources. +func (in *ClusterResources) DeepCopy() *ClusterResources { + if in == nil { + return nil + } + out := new(ClusterResources) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterVersion) DeepCopyInto(out *ClusterVersion) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 ClusterVersion. +func (in *ClusterVersion) DeepCopy() *ClusterVersion { + if in == nil { + return nil + } + out := new(ClusterVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Collect) DeepCopyInto(out *Collect) { + *out = *in + if in.ClusterInfo != nil { + in, out := &in.ClusterInfo, &out.ClusterInfo + *out = new(ClusterInfo) + **out = **in + } + if in.ClusterResources != nil { + in, out := &in.ClusterResources, &out.ClusterResources + *out = new(ClusterResources) + **out = **in + } + if in.Secret != nil { + in, out := &in.Secret, &out.Secret + *out = new(Secret) + **out = **in + } + if in.Logs != nil { + in, out := &in.Logs, &out.Logs + *out = new(Logs) + (*in).DeepCopyInto(*out) + } + if in.Run != nil { + in, out := &in.Run, &out.Run + *out = new(Run) + (*in).DeepCopyInto(*out) + } + if in.Exec != nil { + in, out := &in.Exec, &out.Exec + *out = new(Exec) + (*in).DeepCopyInto(*out) + } + if in.Data != nil { + in, out := &in.Data, &out.Data + *out = new(Data) + **out = **in + } + if in.Copy != nil { + in, out := &in.Copy, &out.Copy + *out = new(Copy) + (*in).DeepCopyInto(*out) + } + if in.HTTP != nil { + in, out := &in.HTTP, &out.HTTP + *out = new(HTTP) + (*in).DeepCopyInto(*out) + } + if in.Postgres != nil { + in, out := &in.Postgres, &out.Postgres + *out = new(Database) + **out = **in + } + if in.Mysql != nil { + in, out := &in.Mysql, &out.Mysql + *out = new(Database) + **out = **in + } + if in.Redis != nil { + in, out := &in.Redis, &out.Redis + *out = new(Database) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Collect. +func (in *Collect) DeepCopy() *Collect { + if in == nil { + return nil + } + out := new(Collect) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Collector) DeepCopyInto(out *Collector) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Collector. +func (in *Collector) DeepCopy() *Collector { + if in == nil { + return nil + } + out := new(Collector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Collector) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CollectorList) DeepCopyInto(out *CollectorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Collector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectorList. +func (in *CollectorList) DeepCopy() *CollectorList { + if in == nil { + return nil + } + out := new(CollectorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CollectorList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CollectorMeta) DeepCopyInto(out *CollectorMeta) { + *out = *in + out.Exclude = in.Exclude +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectorMeta. +func (in *CollectorMeta) DeepCopy() *CollectorMeta { + if in == nil { + return nil + } + out := new(CollectorMeta) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CollectorSpec) DeepCopyInto(out *CollectorSpec) { + *out = *in + if in.Collectors != nil { + in, out := &in.Collectors, &out.Collectors + *out = make([]*Collect, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Collect) + (*in).DeepCopyInto(*out) + } + } + } + if in.AfterCollection != nil { + in, out := &in.AfterCollection, &out.AfterCollection + *out = make([]*AfterCollection, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(AfterCollection) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectorSpec. +func (in *CollectorSpec) DeepCopy() *CollectorSpec { + if in == nil { + return nil + } + out := new(CollectorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CollectorStatus) DeepCopyInto(out *CollectorStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectorStatus. +func (in *CollectorStatus) DeepCopy() *CollectorStatus { + if in == nil { + return nil + } + out := new(CollectorStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerRuntime) DeepCopyInto(out *ContainerRuntime) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 ContainerRuntime. +func (in *ContainerRuntime) DeepCopy() *ContainerRuntime { + if in == nil { + return nil + } + out := new(ContainerRuntime) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Copy) DeepCopyInto(out *Copy) { + *out = *in + out.CollectorMeta = in.CollectorMeta + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Copy. +func (in *Copy) DeepCopy() *Copy { + if in == nil { + return nil + } + out := new(Copy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomResourceDefinition) DeepCopyInto(out *CustomResourceDefinition) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 CustomResourceDefinition. +func (in *CustomResourceDefinition) DeepCopy() *CustomResourceDefinition { + if in == nil { + return nil + } + out := new(CustomResourceDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Data) DeepCopyInto(out *Data) { + *out = *in + out.CollectorMeta = in.CollectorMeta +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Data. +func (in *Data) DeepCopy() *Data { + if in == nil { + return nil + } + out := new(Data) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Database) DeepCopyInto(out *Database) { + *out = *in + out.CollectorMeta = in.CollectorMeta +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Database. +func (in *Database) DeepCopy() *Database { + if in == nil { + return nil + } + out := new(Database) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatabaseAnalyze) DeepCopyInto(out *DatabaseAnalyze) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 DatabaseAnalyze. +func (in *DatabaseAnalyze) DeepCopy() *DatabaseAnalyze { + if in == nil { + return nil + } + out := new(DatabaseAnalyze) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeploymentStatus) DeepCopyInto(out *DeploymentStatus) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 DeploymentStatus. +func (in *DeploymentStatus) DeepCopy() *DeploymentStatus { + if in == nil { + return nil + } + out := new(DeploymentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Distribution) DeepCopyInto(out *Distribution) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 Distribution. +func (in *Distribution) DeepCopy() *Distribution { + if in == nil { + return nil + } + out := new(Distribution) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Exec) DeepCopyInto(out *Exec) { + *out = *in + out.CollectorMeta = in.CollectorMeta + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Exec. +func (in *Exec) DeepCopy() *Exec { + if in == nil { + return nil + } + out := new(Exec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FileSelector) DeepCopyInto(out *FileSelector) { + *out = *in + if in.Files != nil { + in, out := &in.Files, &out.Files + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileSelector. +func (in *FileSelector) DeepCopy() *FileSelector { + if in == nil { + return nil + } + out := new(FileSelector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Get) DeepCopyInto(out *Get) { + *out = *in + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Get. +func (in *Get) DeepCopy() *Get { + if in == nil { + return nil + } + out := new(Get) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTP) DeepCopyInto(out *HTTP) { + *out = *in + out.CollectorMeta = in.CollectorMeta + if in.Get != nil { + in, out := &in.Get, &out.Get + *out = new(Get) + (*in).DeepCopyInto(*out) + } + if in.Post != nil { + in, out := &in.Post, &out.Post + *out = new(Post) + (*in).DeepCopyInto(*out) + } + if in.Put != nil { + in, out := &in.Put, &out.Put + *out = new(Put) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTP. +func (in *HTTP) DeepCopy() *HTTP { + if in == nil { + return nil + } + out := new(HTTP) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImagePullSecret) DeepCopyInto(out *ImagePullSecret) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 ImagePullSecret. +func (in *ImagePullSecret) DeepCopy() *ImagePullSecret { + if in == nil { + return nil + } + out := new(ImagePullSecret) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Ingress) DeepCopyInto(out *Ingress) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 Ingress. +func (in *Ingress) DeepCopy() *Ingress { + if in == nil { + return nil + } + out := new(Ingress) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LogLimits) DeepCopyInto(out *LogLimits) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogLimits. +func (in *LogLimits) DeepCopy() *LogLimits { + if in == nil { + return nil + } + out := new(LogLimits) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Logs) DeepCopyInto(out *Logs) { + *out = *in + out.CollectorMeta = in.CollectorMeta + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ContainerNames != nil { + in, out := &in.ContainerNames, &out.ContainerNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Limits != nil { + in, out := &in.Limits, &out.Limits + *out = new(LogLimits) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Logs. +func (in *Logs) DeepCopy() *Logs { + if in == nil { + return nil + } + out := new(Logs) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeResourceFilters) DeepCopyInto(out *NodeResourceFilters) { + *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(NodeResourceSelectors) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeResourceFilters. +func (in *NodeResourceFilters) DeepCopy() *NodeResourceFilters { + if in == nil { + return nil + } + out := new(NodeResourceFilters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeResourceSelectors) DeepCopyInto(out *NodeResourceSelectors) { + *out = *in + if in.MatchLabel != nil { + in, out := &in.MatchLabel, &out.MatchLabel + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeResourceSelectors. +func (in *NodeResourceSelectors) DeepCopy() *NodeResourceSelectors { + if in == nil { + return nil + } + out := new(NodeResourceSelectors) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeResources) DeepCopyInto(out *NodeResources) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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) + } + } + } + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = new(NodeResourceFilters) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeResources. +func (in *NodeResources) DeepCopy() *NodeResources { + if in == nil { + return nil + } + out := new(NodeResources) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Outcome) DeepCopyInto(out *Outcome) { + *out = *in + if in.Fail != nil { + in, out := &in.Fail, &out.Fail + *out = new(SingleOutcome) + **out = **in + } + if in.Warn != nil { + in, out := &in.Warn, &out.Warn + *out = new(SingleOutcome) + **out = **in + } + if in.Pass != nil { + in, out := &in.Pass, &out.Pass + *out = new(SingleOutcome) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Outcome. +func (in *Outcome) DeepCopy() *Outcome { + if in == nil { + return nil + } + out := new(Outcome) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Post) DeepCopyInto(out *Post) { + *out = *in + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Post. +func (in *Post) DeepCopy() *Post { + if in == nil { + return nil + } + out := new(Post) + 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 + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Preflight. +func (in *Preflight) DeepCopy() *Preflight { + if in == nil { + return nil + } + out := new(Preflight) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Preflight) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PreflightList) DeepCopyInto(out *PreflightList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Preflight, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PreflightList. +func (in *PreflightList) DeepCopy() *PreflightList { + if in == nil { + return nil + } + out := new(PreflightList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PreflightList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PreflightSpec) DeepCopyInto(out *PreflightSpec) { + *out = *in + if in.Collectors != nil { + in, out := &in.Collectors, &out.Collectors + *out = make([]*Collect, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Collect) + (*in).DeepCopyInto(*out) + } + } + } + if in.Analyzers != nil { + in, out := &in.Analyzers, &out.Analyzers + *out = make([]*Analyze, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Analyze) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PreflightSpec. +func (in *PreflightSpec) DeepCopy() *PreflightSpec { + if in == nil { + return nil + } + out := new(PreflightSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PreflightStatus) DeepCopyInto(out *PreflightStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PreflightStatus. +func (in *PreflightStatus) DeepCopy() *PreflightStatus { + if in == nil { + return nil + } + out := new(PreflightStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Put) DeepCopyInto(out *Put) { + *out = *in + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Put. +func (in *Put) DeepCopy() *Put { + if in == nil { + return nil + } + out := new(Put) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Redact) DeepCopyInto(out *Redact) { + *out = *in + in.FileSelector.DeepCopyInto(&out.FileSelector) + in.Removals.DeepCopyInto(&out.Removals) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Redact. +func (in *Redact) DeepCopy() *Redact { + if in == nil { + return nil + } + out := new(Redact) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Redactor) DeepCopyInto(out *Redactor) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Redactor. +func (in *Redactor) DeepCopy() *Redactor { + if in == nil { + return nil + } + out := new(Redactor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Redactor) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RedactorList) DeepCopyInto(out *RedactorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Redactor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedactorList. +func (in *RedactorList) DeepCopy() *RedactorList { + if in == nil { + return nil + } + out := new(RedactorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RedactorList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RedactorSpec) DeepCopyInto(out *RedactorSpec) { + *out = *in + if in.Redactors != nil { + in, out := &in.Redactors, &out.Redactors + *out = make([]*Redact, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Redact) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedactorSpec. +func (in *RedactorSpec) DeepCopy() *RedactorSpec { + if in == nil { + return nil + } + out := new(RedactorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RedactorStatus) DeepCopyInto(out *RedactorStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedactorStatus. +func (in *RedactorStatus) DeepCopy() *RedactorStatus { + if in == nil { + return nil + } + out := new(RedactorStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Regex) DeepCopyInto(out *Regex) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Regex. +func (in *Regex) DeepCopy() *Regex { + if in == nil { + return nil + } + out := new(Regex) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Removals) DeepCopyInto(out *Removals) { + *out = *in + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Regex != nil { + in, out := &in.Regex, &out.Regex + *out = make([]Regex, len(*in)) + copy(*out, *in) + } + if in.YamlPath != nil { + in, out := &in.YamlPath, &out.YamlPath + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Removals. +func (in *Removals) DeepCopy() *Removals { + if in == nil { + return nil + } + out := new(Removals) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResultRequest) DeepCopyInto(out *ResultRequest) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResultRequest. +func (in *ResultRequest) DeepCopy() *ResultRequest { + if in == nil { + return nil + } + out := new(ResultRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Run) DeepCopyInto(out *Run) { + *out = *in + out.CollectorMeta = in.CollectorMeta + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Run. +func (in *Run) DeepCopy() *Run { + if in == nil { + return nil + } + out := new(Run) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Secret) DeepCopyInto(out *Secret) { + *out = *in + out.CollectorMeta = in.CollectorMeta +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Secret. +func (in *Secret) DeepCopy() *Secret { + if in == nil { + return nil + } + out := new(Secret) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SingleOutcome) DeepCopyInto(out *SingleOutcome) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SingleOutcome. +func (in *SingleOutcome) DeepCopy() *SingleOutcome { + if in == nil { + return nil + } + out := new(SingleOutcome) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StatefulsetStatus) DeepCopyInto(out *StatefulsetStatus) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 StatefulsetStatus. +func (in *StatefulsetStatus) DeepCopy() *StatefulsetStatus { + if in == nil { + return nil + } + out := new(StatefulsetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageClass) DeepCopyInto(out *StorageClass) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 StorageClass. +func (in *StorageClass) DeepCopy() *StorageClass { + if in == nil { + return nil + } + out := new(StorageClass) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportBundle) DeepCopyInto(out *SupportBundle) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundle. +func (in *SupportBundle) DeepCopy() *SupportBundle { + if in == nil { + return nil + } + out := new(SupportBundle) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SupportBundle) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportBundleList) DeepCopyInto(out *SupportBundleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SupportBundle, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundleList. +func (in *SupportBundleList) DeepCopy() *SupportBundleList { + if in == nil { + return nil + } + out := new(SupportBundleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SupportBundleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportBundleSpec) DeepCopyInto(out *SupportBundleSpec) { + *out = *in + if in.AfterCollection != nil { + in, out := &in.AfterCollection, &out.AfterCollection + *out = make([]*AfterCollection, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(AfterCollection) + (*in).DeepCopyInto(*out) + } + } + } + if in.Collectors != nil { + in, out := &in.Collectors, &out.Collectors + *out = make([]*Collect, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Collect) + (*in).DeepCopyInto(*out) + } + } + } + if in.Analyzers != nil { + in, out := &in.Analyzers, &out.Analyzers + *out = make([]*Analyze, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Analyze) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundleSpec. +func (in *SupportBundleSpec) DeepCopy() *SupportBundleSpec { + if in == nil { + return nil + } + out := new(SupportBundleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportBundleStatus) DeepCopyInto(out *SupportBundleStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundleStatus. +func (in *SupportBundleStatus) DeepCopy() *SupportBundleStatus { + if in == nil { + return nil + } + out := new(SupportBundleStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportBundleVersion) DeepCopyInto(out *SupportBundleVersion) { + *out = *in + out.Spec = in.Spec +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundleVersion. +func (in *SupportBundleVersion) DeepCopy() *SupportBundleVersion { + if in == nil { + return nil + } + out := new(SupportBundleVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportBundleVersionSpec) DeepCopyInto(out *SupportBundleVersionSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundleVersionSpec. +func (in *SupportBundleVersionSpec) DeepCopy() *SupportBundleVersionSpec { + if in == nil { + return nil + } + out := new(SupportBundleVersionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TextAnalyze) DeepCopyInto(out *TextAnalyze) { + *out = *in + out.AnalyzeMeta = in.AnalyzeMeta + 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 TextAnalyze. +func (in *TextAnalyze) DeepCopy() *TextAnalyze { + if in == nil { + return nil + } + out := new(TextAnalyze) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/client/troubleshootclientset/clientset.go b/pkg/client/troubleshootclientset/clientset.go index d841b6065..cc5a29168 100644 --- a/pkg/client/troubleshootclientset/clientset.go +++ b/pkg/client/troubleshootclientset/clientset.go @@ -21,6 +21,7 @@ import ( "fmt" troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -29,6 +30,7 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface TroubleshootV1beta1() troubleshootv1beta1.TroubleshootV1beta1Interface + TroubleshootV1beta2() troubleshootv1beta2.TroubleshootV1beta2Interface } // Clientset contains the clients for groups. Each group has exactly one @@ -36,6 +38,7 @@ type Interface interface { type Clientset struct { *discovery.DiscoveryClient troubleshootV1beta1 *troubleshootv1beta1.TroubleshootV1beta1Client + troubleshootV1beta2 *troubleshootv1beta2.TroubleshootV1beta2Client } // TroubleshootV1beta1 retrieves the TroubleshootV1beta1Client @@ -43,6 +46,11 @@ func (c *Clientset) TroubleshootV1beta1() troubleshootv1beta1.TroubleshootV1beta return c.troubleshootV1beta1 } +// TroubleshootV1beta2 retrieves the TroubleshootV1beta2Client +func (c *Clientset) TroubleshootV1beta2() troubleshootv1beta2.TroubleshootV1beta2Interface { + return c.troubleshootV1beta2 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -68,6 +76,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.troubleshootV1beta2, err = troubleshootv1beta2.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -81,6 +93,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.troubleshootV1beta1 = troubleshootv1beta1.NewForConfigOrDie(c) + cs.troubleshootV1beta2 = troubleshootv1beta2.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -90,6 +103,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.troubleshootV1beta1 = troubleshootv1beta1.New(c) + cs.troubleshootV1beta2 = troubleshootv1beta2.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/troubleshootclientset/fake/clientset_generated.go b/pkg/client/troubleshootclientset/fake/clientset_generated.go index bb01082c8..a6ef3f96c 100644 --- a/pkg/client/troubleshootclientset/fake/clientset_generated.go +++ b/pkg/client/troubleshootclientset/fake/clientset_generated.go @@ -21,6 +21,8 @@ import ( clientset "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset" troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1" faketroubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta1/fake" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2" + faketroubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -79,3 +81,8 @@ var _ clientset.Interface = &Clientset{} func (c *Clientset) TroubleshootV1beta1() troubleshootv1beta1.TroubleshootV1beta1Interface { return &faketroubleshootv1beta1.FakeTroubleshootV1beta1{Fake: &c.Fake} } + +// TroubleshootV1beta2 retrieves the TroubleshootV1beta2Client +func (c *Clientset) TroubleshootV1beta2() troubleshootv1beta2.TroubleshootV1beta2Interface { + return &faketroubleshootv1beta2.FakeTroubleshootV1beta2{Fake: &c.Fake} +} diff --git a/pkg/client/troubleshootclientset/fake/register.go b/pkg/client/troubleshootclientset/fake/register.go index 71731ac9b..8010c8843 100644 --- a/pkg/client/troubleshootclientset/fake/register.go +++ b/pkg/client/troubleshootclientset/fake/register.go @@ -19,6 +19,7 @@ package fake import ( troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,6 +32,7 @@ var codecs = serializer.NewCodecFactory(scheme) var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ troubleshootv1beta1.AddToScheme, + troubleshootv1beta2.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/troubleshootclientset/scheme/register.go b/pkg/client/troubleshootclientset/scheme/register.go index 55051e56a..6ff4d4891 100644 --- a/pkg/client/troubleshootclientset/scheme/register.go +++ b/pkg/client/troubleshootclientset/scheme/register.go @@ -19,6 +19,7 @@ package scheme import ( troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,6 +32,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ troubleshootv1beta1.AddToScheme, + troubleshootv1beta2.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/analyzer.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/analyzer.go new file mode 100644 index 000000000..10c092afd --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/analyzer.go @@ -0,0 +1,194 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + "time" + + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" + scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// AnalyzersGetter has a method to return a AnalyzerInterface. +// A group's client should implement this interface. +type AnalyzersGetter interface { + Analyzers(namespace string) AnalyzerInterface +} + +// AnalyzerInterface has methods to work with Analyzer resources. +type AnalyzerInterface interface { + Create(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.CreateOptions) (*v1beta2.Analyzer, error) + Update(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (*v1beta2.Analyzer, error) + UpdateStatus(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (*v1beta2.Analyzer, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.Analyzer, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta2.AnalyzerList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Analyzer, err error) + AnalyzerExpansion +} + +// analyzers implements AnalyzerInterface +type analyzers struct { + client rest.Interface + ns string +} + +// newAnalyzers returns a Analyzers +func newAnalyzers(c *TroubleshootV1beta2Client, namespace string) *analyzers { + return &analyzers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the analyzer, and returns the corresponding analyzer object, and an error if there is any. +func (c *analyzers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Analyzer, err error) { + result = &v1beta2.Analyzer{} + err = c.client.Get(). + Namespace(c.ns). + Resource("analyzers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Analyzers that match those selectors. +func (c *analyzers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.AnalyzerList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta2.AnalyzerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("analyzers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested analyzers. +func (c *analyzers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("analyzers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a analyzer and creates it. Returns the server's representation of the analyzer, and an error, if there is any. +func (c *analyzers) Create(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.CreateOptions) (result *v1beta2.Analyzer, err error) { + result = &v1beta2.Analyzer{} + err = c.client.Post(). + Namespace(c.ns). + Resource("analyzers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(analyzer). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a analyzer and updates it. Returns the server's representation of the analyzer, and an error, if there is any. +func (c *analyzers) Update(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (result *v1beta2.Analyzer, err error) { + result = &v1beta2.Analyzer{} + err = c.client.Put(). + Namespace(c.ns). + Resource("analyzers"). + Name(analyzer.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(analyzer). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *analyzers) UpdateStatus(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (result *v1beta2.Analyzer, err error) { + result = &v1beta2.Analyzer{} + err = c.client.Put(). + Namespace(c.ns). + Resource("analyzers"). + Name(analyzer.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(analyzer). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the analyzer and deletes it. Returns an error if one occurs. +func (c *analyzers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("analyzers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *analyzers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("analyzers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched analyzer. +func (c *analyzers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Analyzer, err error) { + result = &v1beta2.Analyzer{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("analyzers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/collector.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/collector.go new file mode 100644 index 000000000..96f95c482 --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/collector.go @@ -0,0 +1,194 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + "time" + + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" + scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CollectorsGetter has a method to return a CollectorInterface. +// A group's client should implement this interface. +type CollectorsGetter interface { + Collectors(namespace string) CollectorInterface +} + +// CollectorInterface has methods to work with Collector resources. +type CollectorInterface interface { + Create(ctx context.Context, collector *v1beta2.Collector, opts v1.CreateOptions) (*v1beta2.Collector, error) + Update(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (*v1beta2.Collector, error) + UpdateStatus(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (*v1beta2.Collector, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.Collector, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta2.CollectorList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Collector, err error) + CollectorExpansion +} + +// collectors implements CollectorInterface +type collectors struct { + client rest.Interface + ns string +} + +// newCollectors returns a Collectors +func newCollectors(c *TroubleshootV1beta2Client, namespace string) *collectors { + return &collectors{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the collector, and returns the corresponding collector object, and an error if there is any. +func (c *collectors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Collector, err error) { + result = &v1beta2.Collector{} + err = c.client.Get(). + Namespace(c.ns). + Resource("collectors"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Collectors that match those selectors. +func (c *collectors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.CollectorList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta2.CollectorList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("collectors"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested collectors. +func (c *collectors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("collectors"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a collector and creates it. Returns the server's representation of the collector, and an error, if there is any. +func (c *collectors) Create(ctx context.Context, collector *v1beta2.Collector, opts v1.CreateOptions) (result *v1beta2.Collector, err error) { + result = &v1beta2.Collector{} + err = c.client.Post(). + Namespace(c.ns). + Resource("collectors"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(collector). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a collector and updates it. Returns the server's representation of the collector, and an error, if there is any. +func (c *collectors) Update(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (result *v1beta2.Collector, err error) { + result = &v1beta2.Collector{} + err = c.client.Put(). + Namespace(c.ns). + Resource("collectors"). + Name(collector.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(collector). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *collectors) UpdateStatus(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (result *v1beta2.Collector, err error) { + result = &v1beta2.Collector{} + err = c.client.Put(). + Namespace(c.ns). + Resource("collectors"). + Name(collector.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(collector). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the collector and deletes it. Returns an error if one occurs. +func (c *collectors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("collectors"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *collectors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("collectors"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched collector. +func (c *collectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Collector, err error) { + result = &v1beta2.Collector{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("collectors"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/doc.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/doc.go new file mode 100644 index 000000000..828ed2560 --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/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 v1beta2 diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/doc.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/doc.go new file mode 100644 index 000000000..0767328a9 --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/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/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_analyzer.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_analyzer.go new file mode 100644 index 000000000..b17f45840 --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_analyzer.go @@ -0,0 +1,141 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeAnalyzers implements AnalyzerInterface +type FakeAnalyzers struct { + Fake *FakeTroubleshootV1beta2 + ns string +} + +var analyzersResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "analyzers"} + +var analyzersKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "Analyzer"} + +// Get takes name of the analyzer, and returns the corresponding analyzer object, and an error if there is any. +func (c *FakeAnalyzers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Analyzer, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(analyzersResource, c.ns, name), &v1beta2.Analyzer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Analyzer), err +} + +// List takes label and field selectors, and returns the list of Analyzers that match those selectors. +func (c *FakeAnalyzers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.AnalyzerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(analyzersResource, analyzersKind, c.ns, opts), &v1beta2.AnalyzerList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta2.AnalyzerList{ListMeta: obj.(*v1beta2.AnalyzerList).ListMeta} + for _, item := range obj.(*v1beta2.AnalyzerList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested analyzers. +func (c *FakeAnalyzers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(analyzersResource, c.ns, opts)) + +} + +// Create takes the representation of a analyzer and creates it. Returns the server's representation of the analyzer, and an error, if there is any. +func (c *FakeAnalyzers) Create(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.CreateOptions) (result *v1beta2.Analyzer, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(analyzersResource, c.ns, analyzer), &v1beta2.Analyzer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Analyzer), err +} + +// Update takes the representation of a analyzer and updates it. Returns the server's representation of the analyzer, and an error, if there is any. +func (c *FakeAnalyzers) Update(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (result *v1beta2.Analyzer, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(analyzersResource, c.ns, analyzer), &v1beta2.Analyzer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Analyzer), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeAnalyzers) UpdateStatus(ctx context.Context, analyzer *v1beta2.Analyzer, opts v1.UpdateOptions) (*v1beta2.Analyzer, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(analyzersResource, "status", c.ns, analyzer), &v1beta2.Analyzer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Analyzer), err +} + +// Delete takes name of the analyzer and deletes it. Returns an error if one occurs. +func (c *FakeAnalyzers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(analyzersResource, c.ns, name), &v1beta2.Analyzer{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeAnalyzers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(analyzersResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1beta2.AnalyzerList{}) + return err +} + +// Patch applies the patch and returns the patched analyzer. +func (c *FakeAnalyzers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Analyzer, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(analyzersResource, c.ns, name, pt, data, subresources...), &v1beta2.Analyzer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Analyzer), err +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_collector.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_collector.go new file mode 100644 index 000000000..d352dd092 --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_collector.go @@ -0,0 +1,141 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCollectors implements CollectorInterface +type FakeCollectors struct { + Fake *FakeTroubleshootV1beta2 + ns string +} + +var collectorsResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "collectors"} + +var collectorsKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "Collector"} + +// Get takes name of the collector, and returns the corresponding collector object, and an error if there is any. +func (c *FakeCollectors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Collector, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(collectorsResource, c.ns, name), &v1beta2.Collector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Collector), err +} + +// List takes label and field selectors, and returns the list of Collectors that match those selectors. +func (c *FakeCollectors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.CollectorList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(collectorsResource, collectorsKind, c.ns, opts), &v1beta2.CollectorList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta2.CollectorList{ListMeta: obj.(*v1beta2.CollectorList).ListMeta} + for _, item := range obj.(*v1beta2.CollectorList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested collectors. +func (c *FakeCollectors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(collectorsResource, c.ns, opts)) + +} + +// Create takes the representation of a collector and creates it. Returns the server's representation of the collector, and an error, if there is any. +func (c *FakeCollectors) Create(ctx context.Context, collector *v1beta2.Collector, opts v1.CreateOptions) (result *v1beta2.Collector, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(collectorsResource, c.ns, collector), &v1beta2.Collector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Collector), err +} + +// Update takes the representation of a collector and updates it. Returns the server's representation of the collector, and an error, if there is any. +func (c *FakeCollectors) Update(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (result *v1beta2.Collector, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(collectorsResource, c.ns, collector), &v1beta2.Collector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Collector), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCollectors) UpdateStatus(ctx context.Context, collector *v1beta2.Collector, opts v1.UpdateOptions) (*v1beta2.Collector, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(collectorsResource, "status", c.ns, collector), &v1beta2.Collector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Collector), err +} + +// Delete takes name of the collector and deletes it. Returns an error if one occurs. +func (c *FakeCollectors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(collectorsResource, c.ns, name), &v1beta2.Collector{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCollectors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(collectorsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1beta2.CollectorList{}) + return err +} + +// Patch applies the patch and returns the patched collector. +func (c *FakeCollectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Collector, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(collectorsResource, c.ns, name, pt, data, subresources...), &v1beta2.Collector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Collector), err +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_preflight.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_preflight.go new file mode 100644 index 000000000..67ee46668 --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_preflight.go @@ -0,0 +1,141 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePreflights implements PreflightInterface +type FakePreflights struct { + Fake *FakeTroubleshootV1beta2 + ns string +} + +var preflightsResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "preflights"} + +var preflightsKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "Preflight"} + +// Get takes name of the preflight, and returns the corresponding preflight object, and an error if there is any. +func (c *FakePreflights) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Preflight, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(preflightsResource, c.ns, name), &v1beta2.Preflight{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Preflight), err +} + +// List takes label and field selectors, and returns the list of Preflights that match those selectors. +func (c *FakePreflights) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.PreflightList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(preflightsResource, preflightsKind, c.ns, opts), &v1beta2.PreflightList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta2.PreflightList{ListMeta: obj.(*v1beta2.PreflightList).ListMeta} + for _, item := range obj.(*v1beta2.PreflightList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested preflights. +func (c *FakePreflights) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(preflightsResource, c.ns, opts)) + +} + +// Create takes the representation of a preflight and creates it. Returns the server's representation of the preflight, and an error, if there is any. +func (c *FakePreflights) Create(ctx context.Context, preflight *v1beta2.Preflight, opts v1.CreateOptions) (result *v1beta2.Preflight, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(preflightsResource, c.ns, preflight), &v1beta2.Preflight{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Preflight), err +} + +// Update takes the representation of a preflight and updates it. Returns the server's representation of the preflight, and an error, if there is any. +func (c *FakePreflights) Update(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (result *v1beta2.Preflight, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(preflightsResource, c.ns, preflight), &v1beta2.Preflight{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Preflight), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePreflights) UpdateStatus(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (*v1beta2.Preflight, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(preflightsResource, "status", c.ns, preflight), &v1beta2.Preflight{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Preflight), err +} + +// Delete takes name of the preflight and deletes it. Returns an error if one occurs. +func (c *FakePreflights) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(preflightsResource, c.ns, name), &v1beta2.Preflight{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePreflights) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(preflightsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1beta2.PreflightList{}) + return err +} + +// Patch applies the patch and returns the patched preflight. +func (c *FakePreflights) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Preflight, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(preflightsResource, c.ns, name, pt, data, subresources...), &v1beta2.Preflight{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Preflight), err +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_redactor.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_redactor.go new file mode 100644 index 000000000..433496600 --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_redactor.go @@ -0,0 +1,141 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeRedactors implements RedactorInterface +type FakeRedactors struct { + Fake *FakeTroubleshootV1beta2 + ns string +} + +var redactorsResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "redactors"} + +var redactorsKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "Redactor"} + +// Get takes name of the redactor, and returns the corresponding redactor object, and an error if there is any. +func (c *FakeRedactors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Redactor, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(redactorsResource, c.ns, name), &v1beta2.Redactor{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Redactor), err +} + +// List takes label and field selectors, and returns the list of Redactors that match those selectors. +func (c *FakeRedactors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.RedactorList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(redactorsResource, redactorsKind, c.ns, opts), &v1beta2.RedactorList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta2.RedactorList{ListMeta: obj.(*v1beta2.RedactorList).ListMeta} + for _, item := range obj.(*v1beta2.RedactorList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested redactors. +func (c *FakeRedactors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(redactorsResource, c.ns, opts)) + +} + +// Create takes the representation of a redactor and creates it. Returns the server's representation of the redactor, and an error, if there is any. +func (c *FakeRedactors) Create(ctx context.Context, redactor *v1beta2.Redactor, opts v1.CreateOptions) (result *v1beta2.Redactor, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(redactorsResource, c.ns, redactor), &v1beta2.Redactor{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Redactor), err +} + +// Update takes the representation of a redactor and updates it. Returns the server's representation of the redactor, and an error, if there is any. +func (c *FakeRedactors) Update(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (result *v1beta2.Redactor, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(redactorsResource, c.ns, redactor), &v1beta2.Redactor{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Redactor), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeRedactors) UpdateStatus(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (*v1beta2.Redactor, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(redactorsResource, "status", c.ns, redactor), &v1beta2.Redactor{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Redactor), err +} + +// Delete takes name of the redactor and deletes it. Returns an error if one occurs. +func (c *FakeRedactors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(redactorsResource, c.ns, name), &v1beta2.Redactor{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRedactors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(redactorsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1beta2.RedactorList{}) + return err +} + +// Patch applies the patch and returns the patched redactor. +func (c *FakeRedactors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Redactor, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(redactorsResource, c.ns, name, pt, data, subresources...), &v1beta2.Redactor{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Redactor), err +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_supportbundle.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_supportbundle.go new file mode 100644 index 000000000..e5cb8ad8f --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_supportbundle.go @@ -0,0 +1,141 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSupportBundles implements SupportBundleInterface +type FakeSupportBundles struct { + Fake *FakeTroubleshootV1beta2 + ns string +} + +var supportbundlesResource = schema.GroupVersionResource{Group: "troubleshoot.sh", Version: "v1beta2", Resource: "supportbundles"} + +var supportbundlesKind = schema.GroupVersionKind{Group: "troubleshoot.sh", Version: "v1beta2", Kind: "SupportBundle"} + +// Get takes name of the supportBundle, and returns the corresponding supportBundle object, and an error if there is any. +func (c *FakeSupportBundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.SupportBundle, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(supportbundlesResource, c.ns, name), &v1beta2.SupportBundle{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.SupportBundle), err +} + +// List takes label and field selectors, and returns the list of SupportBundles that match those selectors. +func (c *FakeSupportBundles) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.SupportBundleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(supportbundlesResource, supportbundlesKind, c.ns, opts), &v1beta2.SupportBundleList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta2.SupportBundleList{ListMeta: obj.(*v1beta2.SupportBundleList).ListMeta} + for _, item := range obj.(*v1beta2.SupportBundleList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested supportBundles. +func (c *FakeSupportBundles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(supportbundlesResource, c.ns, opts)) + +} + +// Create takes the representation of a supportBundle and creates it. Returns the server's representation of the supportBundle, and an error, if there is any. +func (c *FakeSupportBundles) Create(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.CreateOptions) (result *v1beta2.SupportBundle, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(supportbundlesResource, c.ns, supportBundle), &v1beta2.SupportBundle{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.SupportBundle), err +} + +// Update takes the representation of a supportBundle and updates it. Returns the server's representation of the supportBundle, and an error, if there is any. +func (c *FakeSupportBundles) Update(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (result *v1beta2.SupportBundle, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(supportbundlesResource, c.ns, supportBundle), &v1beta2.SupportBundle{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.SupportBundle), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeSupportBundles) UpdateStatus(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (*v1beta2.SupportBundle, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(supportbundlesResource, "status", c.ns, supportBundle), &v1beta2.SupportBundle{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.SupportBundle), err +} + +// Delete takes name of the supportBundle and deletes it. Returns an error if one occurs. +func (c *FakeSupportBundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(supportbundlesResource, c.ns, name), &v1beta2.SupportBundle{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSupportBundles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(supportbundlesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1beta2.SupportBundleList{}) + return err +} + +// Patch applies the patch and returns the patched supportBundle. +func (c *FakeSupportBundles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.SupportBundle, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(supportbundlesResource, c.ns, name, pt, data, subresources...), &v1beta2.SupportBundle{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.SupportBundle), err +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_troubleshoot_client.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_troubleshoot_client.go new file mode 100644 index 000000000..7e7e28dae --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/fake/fake_troubleshoot_client.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 ( + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeTroubleshootV1beta2 struct { + *testing.Fake +} + +func (c *FakeTroubleshootV1beta2) Analyzers(namespace string) v1beta2.AnalyzerInterface { + return &FakeAnalyzers{c, namespace} +} + +func (c *FakeTroubleshootV1beta2) Collectors(namespace string) v1beta2.CollectorInterface { + return &FakeCollectors{c, namespace} +} + +func (c *FakeTroubleshootV1beta2) Preflights(namespace string) v1beta2.PreflightInterface { + return &FakePreflights{c, namespace} +} + +func (c *FakeTroubleshootV1beta2) Redactors(namespace string) v1beta2.RedactorInterface { + return &FakeRedactors{c, namespace} +} + +func (c *FakeTroubleshootV1beta2) SupportBundles(namespace string) v1beta2.SupportBundleInterface { + return &FakeSupportBundles{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeTroubleshootV1beta2) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/generated_expansion.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/generated_expansion.go new file mode 100644 index 000000000..b2023742e --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/generated_expansion.go @@ -0,0 +1,28 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1beta2 + +type AnalyzerExpansion interface{} + +type CollectorExpansion interface{} + +type PreflightExpansion interface{} + +type RedactorExpansion interface{} + +type SupportBundleExpansion interface{} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/preflight.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/preflight.go new file mode 100644 index 000000000..a519896ef --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/preflight.go @@ -0,0 +1,194 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + "time" + + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" + scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PreflightsGetter has a method to return a PreflightInterface. +// A group's client should implement this interface. +type PreflightsGetter interface { + Preflights(namespace string) PreflightInterface +} + +// PreflightInterface has methods to work with Preflight resources. +type PreflightInterface interface { + Create(ctx context.Context, preflight *v1beta2.Preflight, opts v1.CreateOptions) (*v1beta2.Preflight, error) + Update(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (*v1beta2.Preflight, error) + UpdateStatus(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (*v1beta2.Preflight, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.Preflight, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta2.PreflightList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Preflight, err error) + PreflightExpansion +} + +// preflights implements PreflightInterface +type preflights struct { + client rest.Interface + ns string +} + +// newPreflights returns a Preflights +func newPreflights(c *TroubleshootV1beta2Client, namespace string) *preflights { + return &preflights{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the preflight, and returns the corresponding preflight object, and an error if there is any. +func (c *preflights) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Preflight, err error) { + result = &v1beta2.Preflight{} + err = c.client.Get(). + Namespace(c.ns). + Resource("preflights"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Preflights that match those selectors. +func (c *preflights) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.PreflightList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta2.PreflightList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("preflights"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested preflights. +func (c *preflights) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("preflights"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a preflight and creates it. Returns the server's representation of the preflight, and an error, if there is any. +func (c *preflights) Create(ctx context.Context, preflight *v1beta2.Preflight, opts v1.CreateOptions) (result *v1beta2.Preflight, err error) { + result = &v1beta2.Preflight{} + err = c.client.Post(). + Namespace(c.ns). + Resource("preflights"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(preflight). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a preflight and updates it. Returns the server's representation of the preflight, and an error, if there is any. +func (c *preflights) Update(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (result *v1beta2.Preflight, err error) { + result = &v1beta2.Preflight{} + err = c.client.Put(). + Namespace(c.ns). + Resource("preflights"). + Name(preflight.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(preflight). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *preflights) UpdateStatus(ctx context.Context, preflight *v1beta2.Preflight, opts v1.UpdateOptions) (result *v1beta2.Preflight, err error) { + result = &v1beta2.Preflight{} + err = c.client.Put(). + Namespace(c.ns). + Resource("preflights"). + Name(preflight.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(preflight). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the preflight and deletes it. Returns an error if one occurs. +func (c *preflights) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("preflights"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *preflights) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("preflights"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched preflight. +func (c *preflights) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Preflight, err error) { + result = &v1beta2.Preflight{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("preflights"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/redactor.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/redactor.go new file mode 100644 index 000000000..a82d200e3 --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/redactor.go @@ -0,0 +1,194 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + "time" + + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" + scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// RedactorsGetter has a method to return a RedactorInterface. +// A group's client should implement this interface. +type RedactorsGetter interface { + Redactors(namespace string) RedactorInterface +} + +// RedactorInterface has methods to work with Redactor resources. +type RedactorInterface interface { + Create(ctx context.Context, redactor *v1beta2.Redactor, opts v1.CreateOptions) (*v1beta2.Redactor, error) + Update(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (*v1beta2.Redactor, error) + UpdateStatus(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (*v1beta2.Redactor, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.Redactor, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta2.RedactorList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Redactor, err error) + RedactorExpansion +} + +// redactors implements RedactorInterface +type redactors struct { + client rest.Interface + ns string +} + +// newRedactors returns a Redactors +func newRedactors(c *TroubleshootV1beta2Client, namespace string) *redactors { + return &redactors{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the redactor, and returns the corresponding redactor object, and an error if there is any. +func (c *redactors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Redactor, err error) { + result = &v1beta2.Redactor{} + err = c.client.Get(). + Namespace(c.ns). + Resource("redactors"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Redactors that match those selectors. +func (c *redactors) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.RedactorList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta2.RedactorList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("redactors"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested redactors. +func (c *redactors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("redactors"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a redactor and creates it. Returns the server's representation of the redactor, and an error, if there is any. +func (c *redactors) Create(ctx context.Context, redactor *v1beta2.Redactor, opts v1.CreateOptions) (result *v1beta2.Redactor, err error) { + result = &v1beta2.Redactor{} + err = c.client.Post(). + Namespace(c.ns). + Resource("redactors"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(redactor). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a redactor and updates it. Returns the server's representation of the redactor, and an error, if there is any. +func (c *redactors) Update(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (result *v1beta2.Redactor, err error) { + result = &v1beta2.Redactor{} + err = c.client.Put(). + Namespace(c.ns). + Resource("redactors"). + Name(redactor.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(redactor). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *redactors) UpdateStatus(ctx context.Context, redactor *v1beta2.Redactor, opts v1.UpdateOptions) (result *v1beta2.Redactor, err error) { + result = &v1beta2.Redactor{} + err = c.client.Put(). + Namespace(c.ns). + Resource("redactors"). + Name(redactor.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(redactor). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the redactor and deletes it. Returns an error if one occurs. +func (c *redactors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("redactors"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *redactors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("redactors"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched redactor. +func (c *redactors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Redactor, err error) { + result = &v1beta2.Redactor{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("redactors"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/supportbundle.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/supportbundle.go new file mode 100644 index 000000000..49399e767 --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/supportbundle.go @@ -0,0 +1,194 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + "time" + + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" + scheme "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// SupportBundlesGetter has a method to return a SupportBundleInterface. +// A group's client should implement this interface. +type SupportBundlesGetter interface { + SupportBundles(namespace string) SupportBundleInterface +} + +// SupportBundleInterface has methods to work with SupportBundle resources. +type SupportBundleInterface interface { + Create(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.CreateOptions) (*v1beta2.SupportBundle, error) + Update(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (*v1beta2.SupportBundle, error) + UpdateStatus(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (*v1beta2.SupportBundle, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.SupportBundle, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta2.SupportBundleList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.SupportBundle, err error) + SupportBundleExpansion +} + +// supportBundles implements SupportBundleInterface +type supportBundles struct { + client rest.Interface + ns string +} + +// newSupportBundles returns a SupportBundles +func newSupportBundles(c *TroubleshootV1beta2Client, namespace string) *supportBundles { + return &supportBundles{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the supportBundle, and returns the corresponding supportBundle object, and an error if there is any. +func (c *supportBundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.SupportBundle, err error) { + result = &v1beta2.SupportBundle{} + err = c.client.Get(). + Namespace(c.ns). + Resource("supportbundles"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SupportBundles that match those selectors. +func (c *supportBundles) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.SupportBundleList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta2.SupportBundleList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("supportbundles"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested supportBundles. +func (c *supportBundles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("supportbundles"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a supportBundle and creates it. Returns the server's representation of the supportBundle, and an error, if there is any. +func (c *supportBundles) Create(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.CreateOptions) (result *v1beta2.SupportBundle, err error) { + result = &v1beta2.SupportBundle{} + err = c.client.Post(). + Namespace(c.ns). + Resource("supportbundles"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(supportBundle). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a supportBundle and updates it. Returns the server's representation of the supportBundle, and an error, if there is any. +func (c *supportBundles) Update(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (result *v1beta2.SupportBundle, err error) { + result = &v1beta2.SupportBundle{} + err = c.client.Put(). + Namespace(c.ns). + Resource("supportbundles"). + Name(supportBundle.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(supportBundle). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *supportBundles) UpdateStatus(ctx context.Context, supportBundle *v1beta2.SupportBundle, opts v1.UpdateOptions) (result *v1beta2.SupportBundle, err error) { + result = &v1beta2.SupportBundle{} + err = c.client.Put(). + Namespace(c.ns). + Resource("supportbundles"). + Name(supportBundle.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(supportBundle). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the supportBundle and deletes it. Returns an error if one occurs. +func (c *supportBundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("supportbundles"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *supportBundles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("supportbundles"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched supportBundle. +func (c *supportBundles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.SupportBundle, err error) { + result = &v1beta2.SupportBundle{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("supportbundles"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/troubleshoot_client.go b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/troubleshoot_client.go new file mode 100644 index 000000000..383b93cc5 --- /dev/null +++ b/pkg/client/troubleshootclientset/typed/troubleshoot/v1beta2/troubleshoot_client.go @@ -0,0 +1,108 @@ +/* +Copyright 2019 Replicated, Inc.. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" + "github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset/scheme" + rest "k8s.io/client-go/rest" +) + +type TroubleshootV1beta2Interface interface { + RESTClient() rest.Interface + AnalyzersGetter + CollectorsGetter + PreflightsGetter + RedactorsGetter + SupportBundlesGetter +} + +// TroubleshootV1beta2Client is used to interact with features provided by the troubleshoot.sh group. +type TroubleshootV1beta2Client struct { + restClient rest.Interface +} + +func (c *TroubleshootV1beta2Client) Analyzers(namespace string) AnalyzerInterface { + return newAnalyzers(c, namespace) +} + +func (c *TroubleshootV1beta2Client) Collectors(namespace string) CollectorInterface { + return newCollectors(c, namespace) +} + +func (c *TroubleshootV1beta2Client) Preflights(namespace string) PreflightInterface { + return newPreflights(c, namespace) +} + +func (c *TroubleshootV1beta2Client) Redactors(namespace string) RedactorInterface { + return newRedactors(c, namespace) +} + +func (c *TroubleshootV1beta2Client) SupportBundles(namespace string) SupportBundleInterface { + return newSupportBundles(c, namespace) +} + +// NewForConfig creates a new TroubleshootV1beta2Client for the given config. +func NewForConfig(c *rest.Config) (*TroubleshootV1beta2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &TroubleshootV1beta2Client{client}, nil +} + +// NewForConfigOrDie creates a new TroubleshootV1beta2Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *TroubleshootV1beta2Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new TroubleshootV1beta2Client for the given RESTClient. +func New(c rest.Interface) *TroubleshootV1beta2Client { + return &TroubleshootV1beta2Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1beta2.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *TroubleshootV1beta2Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/collect/collector.go b/pkg/collect/collector.go index ce588aef6..93402833a 100644 --- a/pkg/collect/collector.go +++ b/pkg/collect/collector.go @@ -5,7 +5,7 @@ import ( "strconv" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/multitype" authorizationv1 "k8s.io/api/authorization/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -14,7 +14,7 @@ import ( ) type Collector struct { - Collect *troubleshootv1beta1.Collect + Collect *troubleshootv1beta2.Collect Redact bool RBACErrors []error ClientConfig *rest.Config @@ -40,7 +40,7 @@ func isExcluded(excludeVal multitype.BoolOrString) (bool, error) { return parsed, nil } -func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta1.Redact) (map[string][]byte, error) { +func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta2.Redact) (map[string][]byte, error) { var unRedacted map[string][]byte var isExcludedResult bool var err error diff --git a/pkg/collect/collector_test.go b/pkg/collect/collector_test.go index 71d8f5926..9a771c941 100644 --- a/pkg/collect/collector_test.go +++ b/pkg/collect/collector_test.go @@ -3,7 +3,7 @@ package collect import ( "testing" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/multitype" "github.com/stretchr/testify/require" "go.undefinedlabs.com/scopeagent" @@ -12,15 +12,15 @@ import ( func TestCollector_RunCollectorSyncNoRedact(t *testing.T) { tests := []struct { name string - Collect *troubleshootv1beta1.Collect - Redactors []*troubleshootv1beta1.Redact + Collect *troubleshootv1beta2.Collect + Redactors []*troubleshootv1beta2.Redact want map[string]string }{ { name: "data with custom redactor", - Collect: &troubleshootv1beta1.Collect{ - Data: &troubleshootv1beta1.Data{ - CollectorMeta: troubleshootv1beta1.CollectorMeta{ + Collect: &troubleshootv1beta2.Collect{ + Data: &troubleshootv1beta2.Data{ + CollectorMeta: troubleshootv1beta2.CollectorMeta{ CollectorName: "datacollectorname", Exclude: multitype.BoolOrString{}, }, @@ -30,12 +30,12 @@ another line here pwd=somethinggoeshere;`, }, }, - Redactors: []*troubleshootv1beta1.Redact{ + Redactors: []*troubleshootv1beta2.Redact{ { Name: "", - Removals: troubleshootv1beta1.Removals{ + Removals: troubleshootv1beta2.Removals{ Values: nil, - Regex: []troubleshootv1beta1.Regex{ + Regex: []troubleshootv1beta2.Regex{ {Redactor: `abc`}, {Redactor: `(another)(?P.*)(here)`}, }, @@ -51,9 +51,9 @@ pwd=***HIDDEN***; }, { name: "data with custom redactor at a restricted path", - Collect: &troubleshootv1beta1.Collect{ - Data: &troubleshootv1beta1.Data{ - CollectorMeta: troubleshootv1beta1.CollectorMeta{ + Collect: &troubleshootv1beta2.Collect{ + Data: &troubleshootv1beta2.Data{ + CollectorMeta: troubleshootv1beta2.CollectorMeta{ CollectorName: "datacollectorname", Exclude: multitype.BoolOrString{}, }, @@ -63,15 +63,15 @@ another line here pwd=somethinggoeshere;`, }, }, - Redactors: []*troubleshootv1beta1.Redact{ + Redactors: []*troubleshootv1beta2.Redact{ { Name: "", - FileSelector: troubleshootv1beta1.FileSelector{ + FileSelector: troubleshootv1beta2.FileSelector{ File: "data/*", }, - Removals: troubleshootv1beta1.Removals{ + Removals: troubleshootv1beta2.Removals{ Values: nil, - Regex: []troubleshootv1beta1.Regex{ + Regex: []troubleshootv1beta2.Regex{ {Redactor: `(another)(?P.*)(here)`}, }, }, @@ -86,9 +86,9 @@ pwd=***HIDDEN***; }, { name: "data with custom redactor at other path", - Collect: &troubleshootv1beta1.Collect{ - Data: &troubleshootv1beta1.Data{ - CollectorMeta: troubleshootv1beta1.CollectorMeta{ + Collect: &troubleshootv1beta2.Collect{ + Data: &troubleshootv1beta2.Data{ + CollectorMeta: troubleshootv1beta2.CollectorMeta{ CollectorName: "datacollectorname", Exclude: multitype.BoolOrString{}, }, @@ -98,15 +98,15 @@ another line here pwd=somethinggoeshere;`, }, }, - Redactors: []*troubleshootv1beta1.Redact{ + Redactors: []*troubleshootv1beta2.Redact{ { Name: "", - FileSelector: troubleshootv1beta1.FileSelector{ + FileSelector: troubleshootv1beta2.FileSelector{ File: "notdata/*", }, - Removals: troubleshootv1beta1.Removals{ + Removals: troubleshootv1beta2.Removals{ Values: nil, - Regex: []troubleshootv1beta1.Regex{ + Regex: []troubleshootv1beta2.Regex{ {Redactor: `(another)(?P.*)(here)`}, }, }, @@ -121,9 +121,9 @@ pwd=***HIDDEN***; }, { name: "data with custom redactor at second path", - Collect: &troubleshootv1beta1.Collect{ - Data: &troubleshootv1beta1.Data{ - CollectorMeta: troubleshootv1beta1.CollectorMeta{ + Collect: &troubleshootv1beta2.Collect{ + Data: &troubleshootv1beta2.Data{ + CollectorMeta: troubleshootv1beta2.CollectorMeta{ CollectorName: "datacollectorname", Exclude: multitype.BoolOrString{}, }, @@ -133,18 +133,18 @@ another line here pwd=somethinggoeshere;`, }, }, - Redactors: []*troubleshootv1beta1.Redact{ + Redactors: []*troubleshootv1beta2.Redact{ { Name: "", - FileSelector: troubleshootv1beta1.FileSelector{ + FileSelector: troubleshootv1beta2.FileSelector{ Files: []string{ "notData/*", "data/*", }, }, - Removals: troubleshootv1beta1.Removals{ + Removals: troubleshootv1beta2.Removals{ Values: nil, - Regex: []troubleshootv1beta1.Regex{ + Regex: []troubleshootv1beta2.Regex{ {Redactor: `(another)(?P.*)(here)`}, }, }, @@ -159,9 +159,9 @@ pwd=***HIDDEN***; }, { name: "data with literal string replacer", - Collect: &troubleshootv1beta1.Collect{ - Data: &troubleshootv1beta1.Data{ - CollectorMeta: troubleshootv1beta1.CollectorMeta{ + Collect: &troubleshootv1beta2.Collect{ + Data: &troubleshootv1beta2.Data{ + CollectorMeta: troubleshootv1beta2.CollectorMeta{ CollectorName: "data/collectorname", Exclude: multitype.BoolOrString{}, }, @@ -171,15 +171,15 @@ another line here pwd=somethinggoeshere;`, }, }, - Redactors: []*troubleshootv1beta1.Redact{ + Redactors: []*troubleshootv1beta2.Redact{ { Name: "", - FileSelector: troubleshootv1beta1.FileSelector{ + FileSelector: troubleshootv1beta2.FileSelector{ Files: []string{ "data/*/*", }, }, - Removals: troubleshootv1beta1.Removals{ + Removals: troubleshootv1beta2.Removals{ Values: []string{ `abc`, `123`, @@ -197,9 +197,9 @@ pwd=***HIDDEN***; }, { name: "data with custom yaml redactor", - Collect: &troubleshootv1beta1.Collect{ - Data: &troubleshootv1beta1.Data{ - CollectorMeta: troubleshootv1beta1.CollectorMeta{ + Collect: &troubleshootv1beta2.Collect{ + Data: &troubleshootv1beta2.Data{ + CollectorMeta: troubleshootv1beta2.CollectorMeta{ CollectorName: "datacollectorname", Exclude: multitype.BoolOrString{}, }, @@ -208,9 +208,9 @@ pwd=***HIDDEN***; another line here`, }, }, - Redactors: []*troubleshootv1beta1.Redact{ + Redactors: []*troubleshootv1beta2.Redact{ { - Removals: troubleshootv1beta1.Removals{ + Removals: troubleshootv1beta2.Removals{ YamlPath: []string{ `abc`, }, @@ -225,9 +225,9 @@ another line here }, { name: "custom multiline redactor", - Collect: &troubleshootv1beta1.Collect{ - Data: &troubleshootv1beta1.Data{ - CollectorMeta: troubleshootv1beta1.CollectorMeta{ + Collect: &troubleshootv1beta2.Collect{ + Data: &troubleshootv1beta2.Data{ + CollectorMeta: troubleshootv1beta2.CollectorMeta{ CollectorName: "datacollectorname", Exclude: multitype.BoolOrString{}, }, @@ -239,10 +239,10 @@ xyz123 abc`, }, }, - Redactors: []*troubleshootv1beta1.Redact{ + Redactors: []*troubleshootv1beta2.Redact{ { - Removals: troubleshootv1beta1.Removals{ - Regex: []troubleshootv1beta1.Regex{ + Removals: troubleshootv1beta2.Removals{ + Regex: []troubleshootv1beta2.Regex{ { Selector: "abc", Redactor: "xyz(123)", @@ -287,15 +287,15 @@ abc func TestCollector_RunCollectorSync(t *testing.T) { tests := []struct { name string - Collect *troubleshootv1beta1.Collect - Redactors []*troubleshootv1beta1.Redact + Collect *troubleshootv1beta2.Collect + Redactors []*troubleshootv1beta2.Redact want map[string]string }{ { name: "data with custom redactor - but redaction disabled", - Collect: &troubleshootv1beta1.Collect{ - Data: &troubleshootv1beta1.Data{ - CollectorMeta: troubleshootv1beta1.CollectorMeta{ + Collect: &troubleshootv1beta2.Collect{ + Data: &troubleshootv1beta2.Data{ + CollectorMeta: troubleshootv1beta2.CollectorMeta{ CollectorName: "datacollectorname", Exclude: multitype.BoolOrString{}, }, @@ -305,12 +305,12 @@ another line here pwd=somethinggoeshere;`, }, }, - Redactors: []*troubleshootv1beta1.Redact{ + Redactors: []*troubleshootv1beta2.Redact{ { Name: "", - Removals: troubleshootv1beta1.Removals{ + Removals: troubleshootv1beta2.Removals{ Values: nil, - Regex: []troubleshootv1beta1.Regex{ + Regex: []troubleshootv1beta2.Regex{ {Redactor: `abc`}, {Redactor: `(another)(?P.*)(here)`}, }, diff --git a/pkg/collect/copy.go b/pkg/collect/copy.go index 6562143a3..b4461f221 100644 --- a/pkg/collect/copy.go +++ b/pkg/collect/copy.go @@ -6,7 +6,7 @@ import ( "fmt" "path/filepath" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes" @@ -14,7 +14,7 @@ import ( ) //Copy function gets a file or folder from a container specified in the specs. -func Copy(c *Collector, copyCollector *troubleshootv1beta1.Copy) (map[string][]byte, error) { +func Copy(c *Collector, copyCollector *troubleshootv1beta2.Copy) (map[string][]byte, error) { client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, err @@ -56,7 +56,7 @@ func Copy(c *Collector, copyCollector *troubleshootv1beta1.Copy) (map[string][]b return copyOutput, nil } -func copyFiles(c *Collector, client *kubernetes.Clientset, pod corev1.Pod, copyCollector *troubleshootv1beta1.Copy) (map[string][]byte, map[string]string) { +func copyFiles(c *Collector, client *kubernetes.Clientset, pod corev1.Pod, copyCollector *troubleshootv1beta2.Copy) (map[string][]byte, map[string]string) { container := pod.Spec.Containers[0].Name if copyCollector.ContainerName != "" { container = copyCollector.ContainerName @@ -113,7 +113,7 @@ func copyFiles(c *Collector, client *kubernetes.Clientset, pod corev1.Pod, copyC }, nil } -func getCopyErrosFileName(copyCollector *troubleshootv1beta1.Copy) string { +func getCopyErrosFileName(copyCollector *troubleshootv1beta2.Copy) string { if len(copyCollector.Name) > 0 { return fmt.Sprintf("%s-errors.json", copyCollector.Name) } diff --git a/pkg/collect/data.go b/pkg/collect/data.go index 3f52d4fa8..35b1f1584 100644 --- a/pkg/collect/data.go +++ b/pkg/collect/data.go @@ -3,10 +3,10 @@ package collect import ( "path/filepath" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" ) -func Data(c *Collector, dataCollector *troubleshootv1beta1.Data) (map[string][]byte, error) { +func Data(c *Collector, dataCollector *troubleshootv1beta2.Data) (map[string][]byte, error) { bundlePath := filepath.Join(dataCollector.Name, dataCollector.CollectorName) dataOutput := map[string][]byte{ bundlePath: []byte(dataCollector.Data), diff --git a/pkg/collect/exec.go b/pkg/collect/exec.go index 0eb81e5ca..f4b13f065 100644 --- a/pkg/collect/exec.go +++ b/pkg/collect/exec.go @@ -8,14 +8,14 @@ import ( "path/filepath" "time" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/remotecommand" ) -func Exec(c *Collector, execCollector *troubleshootv1beta1.Exec) (map[string][]byte, error) { +func Exec(c *Collector, execCollector *troubleshootv1beta2.Exec) (map[string][]byte, error) { if execCollector.Timeout == "" { return execWithoutTimeout(c, execCollector) } @@ -47,7 +47,7 @@ func Exec(c *Collector, execCollector *troubleshootv1beta1.Exec) (map[string][]b } } -func execWithoutTimeout(c *Collector, execCollector *troubleshootv1beta1.Exec) (map[string][]byte, error) { +func execWithoutTimeout(c *Collector, execCollector *troubleshootv1beta2.Exec) (map[string][]byte, error) { client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, err @@ -92,7 +92,7 @@ func execWithoutTimeout(c *Collector, execCollector *troubleshootv1beta1.Exec) ( return execOutput, nil } -func getExecOutputs(c *Collector, client *kubernetes.Clientset, pod corev1.Pod, execCollector *troubleshootv1beta1.Exec) ([]byte, []byte, []string) { +func getExecOutputs(c *Collector, client *kubernetes.Clientset, pod corev1.Pod, execCollector *troubleshootv1beta2.Exec) ([]byte, []byte, []string) { container := pod.Spec.Containers[0].Name if execCollector.ContainerName != "" { container = execCollector.ContainerName @@ -136,7 +136,7 @@ func getExecOutputs(c *Collector, client *kubernetes.Clientset, pod corev1.Pod, return stdout.Bytes(), stderr.Bytes(), nil } -func getExecErrosFileName(execCollector *troubleshootv1beta1.Exec) string { +func getExecErrosFileName(execCollector *troubleshootv1beta2.Exec) string { if len(execCollector.Name) > 0 { return fmt.Sprintf("%s-errors.json", execCollector.Name) } diff --git a/pkg/collect/http.go b/pkg/collect/http.go index 258ae34c4..22f7a7765 100644 --- a/pkg/collect/http.go +++ b/pkg/collect/http.go @@ -9,7 +9,7 @@ import ( "path/filepath" "strings" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" ) type httpResponse struct { @@ -22,7 +22,7 @@ type httpError struct { Message string `json:"message"` } -func HTTP(c *Collector, httpCollector *troubleshootv1beta1.HTTP) (map[string][]byte, error) { +func HTTP(c *Collector, httpCollector *troubleshootv1beta2.HTTP) (map[string][]byte, error) { var response *http.Response var err error @@ -52,7 +52,7 @@ func HTTP(c *Collector, httpCollector *troubleshootv1beta1.HTTP) (map[string][]b return httpOutput, nil } -func doGet(get *troubleshootv1beta1.Get) (*http.Response, error) { +func doGet(get *troubleshootv1beta2.Get) (*http.Response, error) { http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{ InsecureSkipVerify: get.InsecureSkipVerify, } @@ -69,7 +69,7 @@ func doGet(get *troubleshootv1beta1.Get) (*http.Response, error) { return http.DefaultClient.Do(req) } -func doPost(post *troubleshootv1beta1.Post) (*http.Response, error) { +func doPost(post *troubleshootv1beta2.Post) (*http.Response, error) { http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{ InsecureSkipVerify: post.InsecureSkipVerify, } @@ -86,7 +86,7 @@ func doPost(post *troubleshootv1beta1.Post) (*http.Response, error) { return http.DefaultClient.Do(req) } -func doPut(put *troubleshootv1beta1.Put) (*http.Response, error) { +func doPut(put *troubleshootv1beta2.Put) (*http.Response, error) { http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{ InsecureSkipVerify: put.InsecureSkipVerify, } diff --git a/pkg/collect/logs.go b/pkg/collect/logs.go index 0ceb0110e..027a16c93 100644 --- a/pkg/collect/logs.go +++ b/pkg/collect/logs.go @@ -9,14 +9,14 @@ import ( "time" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/logger" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" ) -func Logs(c *Collector, logsCollector *troubleshootv1beta1.Logs) (map[string][]byte, error) { +func Logs(c *Collector, logsCollector *troubleshootv1beta2.Logs) (map[string][]byte, error) { client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, err @@ -104,7 +104,7 @@ func listPodsInSelectors(ctx context.Context, client *kubernetes.Clientset, name return pods.Items, nil } -func getPodLogs(ctx context.Context, client *kubernetes.Clientset, pod corev1.Pod, name, container string, limits *troubleshootv1beta1.LogLimits, follow bool) (map[string][]byte, error) { +func getPodLogs(ctx context.Context, client *kubernetes.Clientset, pod corev1.Pod, name, container string, limits *troubleshootv1beta2.LogLimits, follow bool) (map[string][]byte, error) { podLogOpts := corev1.PodLogOptions{ Follow: follow, Container: container, @@ -170,7 +170,7 @@ func getPodLogs(ctx context.Context, client *kubernetes.Clientset, pod corev1.Po return result, nil } -func getLogsErrorsFileName(logsCollector *troubleshootv1beta1.Logs) string { +func getLogsErrorsFileName(logsCollector *troubleshootv1beta2.Logs) string { if len(logsCollector.Name) > 0 { return fmt.Sprintf("%s/errors.json", logsCollector.Name) } else if len(logsCollector.CollectorName) > 0 { diff --git a/pkg/collect/mysql.go b/pkg/collect/mysql.go index 5bba0cced..7751ab8d1 100644 --- a/pkg/collect/mysql.go +++ b/pkg/collect/mysql.go @@ -7,10 +7,10 @@ import ( _ "github.com/go-sql-driver/mysql" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" ) -func Mysql(c *Collector, databaseCollector *troubleshootv1beta1.Database) (map[string][]byte, error) { +func Mysql(c *Collector, databaseCollector *troubleshootv1beta2.Database) (map[string][]byte, error) { databaseConnection := DatabaseConnection{} db, err := sql.Open("mysql", databaseCollector.URI) diff --git a/pkg/collect/postgres.go b/pkg/collect/postgres.go index 677182ab7..f97777977 100644 --- a/pkg/collect/postgres.go +++ b/pkg/collect/postgres.go @@ -8,10 +8,10 @@ import ( _ "github.com/lib/pq" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" ) -func Postgres(c *Collector, databaseCollector *troubleshootv1beta1.Database) (map[string][]byte, error) { +func Postgres(c *Collector, databaseCollector *troubleshootv1beta2.Database) (map[string][]byte, error) { databaseConnection := DatabaseConnection{} db, err := sql.Open("postgres", databaseCollector.URI) diff --git a/pkg/collect/redact.go b/pkg/collect/redact.go index 2f6b450cb..025182015 100644 --- a/pkg/collect/redact.go +++ b/pkg/collect/redact.go @@ -9,11 +9,11 @@ import ( "path/filepath" "strings" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/redact" ) -func redactMap(input map[string][]byte, additionalRedactors []*troubleshootv1beta1.Redact) (map[string][]byte, error) { +func redactMap(input map[string][]byte, additionalRedactors []*troubleshootv1beta2.Redact) (map[string][]byte, error) { result := make(map[string][]byte) for k, v := range input { if v == nil { diff --git a/pkg/collect/redis.go b/pkg/collect/redis.go index c422161fe..31134377c 100644 --- a/pkg/collect/redis.go +++ b/pkg/collect/redis.go @@ -7,10 +7,10 @@ import ( "github.com/go-redis/redis/v7" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" ) -func Redis(c *Collector, databaseCollector *troubleshootv1beta1.Database) (map[string][]byte, error) { +func Redis(c *Collector, databaseCollector *troubleshootv1beta2.Database) (map[string][]byte, error) { databaseConnection := DatabaseConnection{} opt, err := redis.ParseURL(databaseCollector.URI) diff --git a/pkg/collect/run.go b/pkg/collect/run.go index 841d19f38..a54bf7e3d 100644 --- a/pkg/collect/run.go +++ b/pkg/collect/run.go @@ -5,14 +5,14 @@ import ( "time" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/logger" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" ) -func Run(c *Collector, runCollector *troubleshootv1beta1.Run) (map[string][]byte, error) { +func Run(c *Collector, runCollector *troubleshootv1beta2.Run) (map[string][]byte, error) { ctx := context.Background() client, err := kubernetes.NewForConfig(c.ClientConfig) @@ -61,7 +61,7 @@ func Run(c *Collector, runCollector *troubleshootv1beta1.Run) (map[string][]byte } } -func runWithoutTimeout(ctx context.Context, c *Collector, pod *corev1.Pod, runCollector *troubleshootv1beta1.Run) (map[string][]byte, error) { +func runWithoutTimeout(ctx context.Context, c *Collector, pod *corev1.Pod, runCollector *troubleshootv1beta2.Run) (map[string][]byte, error) { client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, errors.Wrap(err, "failed create client from config") @@ -82,7 +82,7 @@ func runWithoutTimeout(ctx context.Context, c *Collector, pod *corev1.Pod, runCo runOutput := map[string][]byte{} - limits := troubleshootv1beta1.LogLimits{ + limits := troubleshootv1beta2.LogLimits{ MaxLines: 10000, } podLogs, err := getPodLogs(ctx, client, *pod, runCollector.Name, "", &limits, true) @@ -97,7 +97,7 @@ func runWithoutTimeout(ctx context.Context, c *Collector, pod *corev1.Pod, runCo return runOutput, nil } -func runPod(ctx context.Context, client *kubernetes.Clientset, runCollector *troubleshootv1beta1.Run, namespace string) (*corev1.Pod, error) { +func runPod(ctx context.Context, client *kubernetes.Clientset, runCollector *troubleshootv1beta2.Run, namespace string) (*corev1.Pod, error) { podLabels := make(map[string]string) podLabels["troubleshoot-role"] = "run-collector" diff --git a/pkg/collect/runner.go b/pkg/collect/runner.go index 6c162ed00..9b0e543d0 100644 --- a/pkg/collect/runner.go +++ b/pkg/collect/runner.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "gopkg.in/yaml.v2" corev1 "k8s.io/api/core/v1" kuberneteserrors "k8s.io/apimachinery/pkg/api/errors" @@ -15,7 +15,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" ) -func CreateCollector(client client.Client, scheme *runtime.Scheme, ownerRef metav1.Object, jobName string, jobNamespace string, serviceAccountName string, jobType string, collect *troubleshootv1beta1.Collect, image string, pullPolicy string) (*corev1.ConfigMap, *corev1.Pod, error) { +func CreateCollector(client client.Client, scheme *runtime.Scheme, ownerRef metav1.Object, jobName string, jobNamespace string, serviceAccountName string, jobType string, collect *troubleshootv1beta2.Collect, image string, pullPolicy string) (*corev1.ConfigMap, *corev1.Pod, error) { configMap, err := createCollectorSpecConfigMap(client, scheme, ownerRef, jobName, jobNamespace, collect) if err != nil { return nil, nil, err @@ -29,7 +29,7 @@ func CreateCollector(client client.Client, scheme *runtime.Scheme, ownerRef meta return configMap, pod, nil } -func createCollectorSpecConfigMap(client client.Client, scheme *runtime.Scheme, ownerRef metav1.Object, jobName string, jobNamespace string, collect *troubleshootv1beta1.Collect) (*corev1.ConfigMap, error) { +func createCollectorSpecConfigMap(client client.Client, scheme *runtime.Scheme, ownerRef metav1.Object, jobName string, jobNamespace string, collect *troubleshootv1beta2.Collect) (*corev1.ConfigMap, error) { name := fmt.Sprintf("%s-%s", jobName, DeterministicIDForCollector(collect)) namespacedName := types.NamespacedName{ Name: name, @@ -75,7 +75,7 @@ func createCollectorSpecConfigMap(client client.Client, scheme *runtime.Scheme, return &configMap, nil } -func createCollectorPod(client client.Client, scheme *runtime.Scheme, ownerRef metav1.Object, jobName string, jobNamespace string, serviceAccountName string, jobType string, collect *troubleshootv1beta1.Collect, configMap *corev1.ConfigMap, image string, pullPolicy string) (*corev1.Pod, error) { +func createCollectorPod(client client.Client, scheme *runtime.Scheme, ownerRef metav1.Object, jobName string, jobNamespace string, serviceAccountName string, jobType string, collect *troubleshootv1beta2.Collect, configMap *corev1.ConfigMap, image string, pullPolicy string) (*corev1.Pod, error) { name := fmt.Sprintf("%s-%s", jobName, DeterministicIDForCollector(collect)) if serviceAccountName == "" { diff --git a/pkg/collect/secret.go b/pkg/collect/secret.go index 0304db354..06d926787 100644 --- a/pkg/collect/secret.go +++ b/pkg/collect/secret.go @@ -7,7 +7,7 @@ import ( "path" "path/filepath" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" ) @@ -21,7 +21,7 @@ type FoundSecret struct { Value string `json:"value,omitempty"` } -func Secret(c *Collector, secretCollector *troubleshootv1beta1.Secret) (map[string][]byte, error) { +func Secret(c *Collector, secretCollector *troubleshootv1beta2.Secret) (map[string][]byte, error) { client, err := kubernetes.NewForConfig(c.ClientConfig) if err != nil { return nil, err @@ -46,7 +46,7 @@ func Secret(c *Collector, secretCollector *troubleshootv1beta1.Secret) (map[stri return secretOutput, nil } -func secret(ctx context.Context, client *kubernetes.Clientset, secretCollector *troubleshootv1beta1.Secret) (string, []byte, error) { +func secret(ctx context.Context, client *kubernetes.Clientset, secretCollector *troubleshootv1beta2.Secret) (string, []byte, error) { ns := secretCollector.Namespace path := fmt.Sprintf("%s.json", filepath.Join(ns, secretCollector.SecretName)) diff --git a/pkg/collect/util.go b/pkg/collect/util.go index 6702aa75f..ef5a7518b 100644 --- a/pkg/collect/util.go +++ b/pkg/collect/util.go @@ -7,10 +7,10 @@ import ( "regexp" "strings" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" ) -func DeterministicIDForCollector(collector *troubleshootv1beta1.Collect) string { +func DeterministicIDForCollector(collector *troubleshootv1beta2.Collect) string { unsafeID := "" if collector.ClusterInfo != nil { diff --git a/pkg/collect/util_test.go b/pkg/collect/util_test.go index a56e6793d..3a11e4440 100644 --- a/pkg/collect/util_test.go +++ b/pkg/collect/util_test.go @@ -3,7 +3,7 @@ package collect import ( "testing" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/stretchr/testify/assert" "go.undefinedlabs.com/scopeagent" ) @@ -34,27 +34,27 @@ func Test_selectorToString(t *testing.T) { func Test_DeterministicIDForCollector(t *testing.T) { tests := []struct { name string - collector *troubleshootv1beta1.Collect + collector *troubleshootv1beta2.Collect expect string }{ { name: "cluster-info", - collector: &troubleshootv1beta1.Collect{ - ClusterInfo: &troubleshootv1beta1.ClusterInfo{}, + collector: &troubleshootv1beta2.Collect{ + ClusterInfo: &troubleshootv1beta2.ClusterInfo{}, }, expect: "cluster-info", }, { name: "cluster-resources", - collector: &troubleshootv1beta1.Collect{ - ClusterResources: &troubleshootv1beta1.ClusterResources{}, + collector: &troubleshootv1beta2.Collect{ + ClusterResources: &troubleshootv1beta2.ClusterResources{}, }, expect: "cluster-resources", }, { name: "secret", - collector: &troubleshootv1beta1.Collect{ - Secret: &troubleshootv1beta1.Secret{ + collector: &troubleshootv1beta2.Collect{ + Secret: &troubleshootv1beta2.Secret{ SecretName: "secret-agent-woman", Namespace: "top-secret", }, @@ -63,8 +63,8 @@ func Test_DeterministicIDForCollector(t *testing.T) { }, { name: "logs", - collector: &troubleshootv1beta1.Collect{ - Logs: &troubleshootv1beta1.Logs{ + collector: &troubleshootv1beta2.Collect{ + Logs: &troubleshootv1beta2.Logs{ Namespace: "top-secret", Selector: []string{"this=is", "rather=long", "for=testing", "more=words", "too=many", "abcdef!=123456"}, }, diff --git a/pkg/docrewrite/v1beta2.go b/pkg/docrewrite/v1beta2.go new file mode 100644 index 000000000..4554e3d2d --- /dev/null +++ b/pkg/docrewrite/v1beta2.go @@ -0,0 +1,35 @@ +package docrewrite + +import ( + "github.com/pkg/errors" + "gopkg.in/yaml.v2" +) + +func ConvertToV1Beta2(doc []byte) ([]byte, error) { + var parsed map[string]interface{} + err := yaml.Unmarshal(doc, &parsed) + if err != nil { + return nil, errors.Wrap(err, "failed to unmarshal yaml") + } + + v, ok := parsed["apiVersion"] + if !ok { + return nil, errors.New("no apiVersion in document") + } + + if v == "troubleshoot.sh/v1beta2" { + return doc, nil + } + + if v != "troubleshoot.replicated.com/v1beta1" { + return nil, errors.Errorf("cannot convert %s", v) + } + + parsed["apiVersion"] = "troubleshoot.sh/v1beta2" + newDoc, err := yaml.Marshal(parsed) + if err != nil { + return nil, errors.Wrap(err, "failed to marshal new spec") + } + + return newDoc, nil +} diff --git a/pkg/docrewrite/v1beta2_test.go b/pkg/docrewrite/v1beta2_test.go new file mode 100644 index 000000000..581c36af3 --- /dev/null +++ b/pkg/docrewrite/v1beta2_test.go @@ -0,0 +1,88 @@ +package docrewrite + +import ( + "testing" + + "github.com/stretchr/testify/require" + "gopkg.in/yaml.v2" +) + +func TestConvertToV1Beta2(t *testing.T) { + tests := []struct { + name string + input string + want string + isError bool + }{ + { + name: "rewrite v1beta1", + input: `kind: Collector +apiVersion: troubleshoot.replicated.com/v1beta1 +metadata: + name: collector-sample +spec: + collectors: + - clusterInfo: {} +`, + want: `kind: Collector +apiVersion: troubleshoot.sh/v1beta2 +metadata: + name: collector-sample +spec: + collectors: + - clusterInfo: {}`, + isError: false, + }, + { + name: "do not rewrite v1beta2", + input: `kind: Collector +apiVersion: troubleshoot.sh/v1beta2 +metadata: + name: collector-sample +spec: + collectors: + - clusterInfo: {} +`, + want: `kind: Collector +apiVersion: troubleshoot.sh/v1beta2 +metadata: + name: collector-sample +spec: + collectors: + - clusterInfo: {}`, + isError: false, + }, + { + name: "fail rewrite", + input: `kind: Collector +apiVersion: not.troubleshoot.replicated.com/v1beta1 +metadata: + name: collector-sample +spec: + collectors: + - clusterInfo: {} +`, + want: ``, + isError: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + req := require.New(t) + + got, err := ConvertToV1Beta2([]byte(tt.input)) + if tt.isError { + req.Error(err) + return + } + + var wantParsed, gotParsed interface{} + + _ = yaml.Unmarshal([]byte(tt.want), &wantParsed) + _ = yaml.Unmarshal(got, &gotParsed) + + req.NoError(err) + req.Equal(wantParsed, gotParsed) + }) + } +} diff --git a/pkg/preflight/collect.go b/pkg/preflight/collect.go index e8b3da6bd..74943a4cc 100644 --- a/pkg/preflight/collect.go +++ b/pkg/preflight/collect.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/replicatedhq/troubleshoot/pkg/collect" "k8s.io/client-go/rest" ) @@ -21,15 +21,15 @@ type CollectResult struct { AllCollectedData map[string][]byte Collectors collect.Collectors IsRBACAllowed bool - Spec *troubleshootv1beta1.Preflight + Spec *troubleshootv1beta2.Preflight } // Collect runs the collection phase of preflight checks -func Collect(opts CollectOpts, p *troubleshootv1beta1.Preflight) (CollectResult, error) { - collectSpecs := make([]*troubleshootv1beta1.Collect, 0, 0) +func Collect(opts CollectOpts, p *troubleshootv1beta2.Preflight) (CollectResult, error) { + collectSpecs := make([]*troubleshootv1beta2.Collect, 0, 0) collectSpecs = append(collectSpecs, p.Spec.Collectors...) - collectSpecs = ensureCollectorInList(collectSpecs, troubleshootv1beta1.Collect{ClusterInfo: &troubleshootv1beta1.ClusterInfo{}}) - collectSpecs = ensureCollectorInList(collectSpecs, troubleshootv1beta1.Collect{ClusterResources: &troubleshootv1beta1.ClusterResources{}}) + collectSpecs = ensureCollectorInList(collectSpecs, troubleshootv1beta2.Collect{ClusterInfo: &troubleshootv1beta2.ClusterInfo{}}) + collectSpecs = ensureCollectorInList(collectSpecs, troubleshootv1beta2.Collect{ClusterResources: &troubleshootv1beta2.ClusterResources{}}) allCollectedData := make(map[string][]byte) @@ -94,7 +94,7 @@ func Collect(opts CollectOpts, p *troubleshootv1beta1.Preflight) (CollectResult, return collectResult, nil } -func ensureCollectorInList(list []*troubleshootv1beta1.Collect, collector troubleshootv1beta1.Collect) []*troubleshootv1beta1.Collect { +func ensureCollectorInList(list []*troubleshootv1beta2.Collect, collector troubleshootv1beta2.Collect) []*troubleshootv1beta2.Collect { for _, inList := range list { if collector.ClusterResources != nil && inList.ClusterResources != nil { return list diff --git a/pkg/redact/redact.go b/pkg/redact/redact.go index e3b9106a3..2dae58431 100644 --- a/pkg/redact/redact.go +++ b/pkg/redact/redact.go @@ -11,7 +11,7 @@ import ( "github.com/gobwas/glob" "github.com/pkg/errors" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" ) const ( @@ -47,7 +47,7 @@ type Redaction struct { IsDefaultRedactor bool `json:"isDefaultRedactor" yaml:"isDefaultRedactor"` } -func Redact(input []byte, path string, additionalRedactors []*troubleshootv1beta1.Redact) ([]byte, error) { +func Redact(input []byte, path string, additionalRedactors []*troubleshootv1beta2.Redact) ([]byte, error) { redactors, err := getRedactors(path) if err != nil { return nil, err @@ -88,7 +88,7 @@ func ResetRedactionList() { } } -func buildAdditionalRedactors(path string, redacts []*troubleshootv1beta1.Redact) ([]Redactor, error) { +func buildAdditionalRedactors(path string, redacts []*troubleshootv1beta2.Redact) ([]Redactor, error) { additionalRedactors := []Redactor{} for i, redact := range redacts { if redact == nil { @@ -132,7 +132,7 @@ func buildAdditionalRedactors(path string, redacts []*troubleshootv1beta1.Redact return additionalRedactors, nil } -func redactMatchesPath(path string, redact *troubleshootv1beta1.Redact) (bool, error) { +func redactMatchesPath(path string, redact *troubleshootv1beta2.Redact) (bool, error) { if redact.FileSelector.File == "" && len(redact.FileSelector.Files) == 0 { return true, nil } diff --git a/pkg/redact/redact_test.go b/pkg/redact/redact_test.go index 415926c33..593b1c5a9 100644 --- a/pkg/redact/redact_test.go +++ b/pkg/redact/redact_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" + troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" "github.com/stretchr/testify/require" "go.undefinedlabs.com/scopeagent" ) @@ -1650,7 +1650,7 @@ func Test_Redactors(t *testing.T) { func Test_redactMatchesPath(t *testing.T) { type args struct { path string - redact *troubleshootv1beta1.Redact + redact *troubleshootv1beta2.Redact } tests := []struct { name string @@ -1661,8 +1661,8 @@ func Test_redactMatchesPath(t *testing.T) { name: "literal path", args: args{ path: "/my/test/path", - redact: &troubleshootv1beta1.Redact{ - FileSelector: troubleshootv1beta1.FileSelector{ + redact: &troubleshootv1beta2.Redact{ + FileSelector: troubleshootv1beta2.FileSelector{ File: "/my/test/path", Files: nil, }, @@ -1674,8 +1674,8 @@ func Test_redactMatchesPath(t *testing.T) { name: "no path", args: args{ path: "/my/test/path", - redact: &troubleshootv1beta1.Redact{ - FileSelector: troubleshootv1beta1.FileSelector{ + redact: &troubleshootv1beta2.Redact{ + FileSelector: troubleshootv1beta2.FileSelector{ File: "", Files: nil, }, @@ -1687,8 +1687,8 @@ func Test_redactMatchesPath(t *testing.T) { name: "wrong literal path", args: args{ path: "/my/test/path", - redact: &troubleshootv1beta1.Redact{ - FileSelector: troubleshootv1beta1.FileSelector{ + redact: &troubleshootv1beta2.Redact{ + FileSelector: troubleshootv1beta2.FileSelector{ File: "/my/test/path/two", Files: nil, }, @@ -1700,8 +1700,8 @@ func Test_redactMatchesPath(t *testing.T) { name: "path with glob", args: args{ path: "/my/test/path/two", - redact: &troubleshootv1beta1.Redact{ - FileSelector: troubleshootv1beta1.FileSelector{ + redact: &troubleshootv1beta2.Redact{ + FileSelector: troubleshootv1beta2.FileSelector{ File: "/my/test/path/*", Files: nil, }, @@ -1713,8 +1713,8 @@ func Test_redactMatchesPath(t *testing.T) { name: "path with glob in middle", args: args{ path: "/my/test/path/two", - redact: &troubleshootv1beta1.Redact{ - FileSelector: troubleshootv1beta1.FileSelector{ + redact: &troubleshootv1beta2.Redact{ + FileSelector: troubleshootv1beta2.FileSelector{ File: "/my/test/*/*", Files: nil, }, @@ -1726,8 +1726,8 @@ func Test_redactMatchesPath(t *testing.T) { name: "multiple paths", args: args{ path: "/my/test/path/two", - redact: &troubleshootv1beta1.Redact{ - FileSelector: troubleshootv1beta1.FileSelector{ + redact: &troubleshootv1beta2.Redact{ + FileSelector: troubleshootv1beta2.FileSelector{ File: "", Files: []string{ "/not/the/path", @@ -1742,8 +1742,8 @@ func Test_redactMatchesPath(t *testing.T) { name: "double glob matching separator", args: args{ path: "/my/test/path/two", - redact: &troubleshootv1beta1.Redact{ - FileSelector: troubleshootv1beta1.FileSelector{ + redact: &troubleshootv1beta2.Redact{ + FileSelector: troubleshootv1beta2.FileSelector{ File: "/my/test/**", Files: nil, }, @@ -1755,8 +1755,8 @@ func Test_redactMatchesPath(t *testing.T) { name: "single glob does NOT match separator", args: args{ path: "/my/test/path/two", - redact: &troubleshootv1beta1.Redact{ - FileSelector: troubleshootv1beta1.FileSelector{ + redact: &troubleshootv1beta2.Redact{ + FileSelector: troubleshootv1beta2.FileSelector{ File: "/my/test/*", Files: nil, }, diff --git a/sample-troubleshoot.yaml b/sample-troubleshoot.yaml index 7724050dd..248a6cf85 100644 --- a/sample-troubleshoot.yaml +++ b/sample-troubleshoot.yaml @@ -1,4 +1,4 @@ -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Collector metadata: name: my-application-name @@ -32,7 +32,7 @@ spec: - these - remain --- -apiVersion: troubleshoot.replicated.com/v1beta1 +apiVersion: troubleshoot.sh/v1beta2 kind: Redactor metadata: name: my-application-name diff --git a/schemas/analyzer-troubleshoot-v1beta1.json b/schemas/analyzer-troubleshoot-v1beta1.json index cdd5f40c7..84c310902 100644 --- a/schemas/analyzer-troubleshoot-v1beta1.json +++ b/schemas/analyzer-troubleshoot-v1beta1.json @@ -612,6 +612,17 @@ }, "podCapacity": { "type": "string" + }, + "selector": { + "type": "object", + "properties": { + "matchLabel": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } } } }, diff --git a/schemas/analyzer-troubleshoot-v1beta2.json b/schemas/analyzer-troubleshoot-v1beta2.json new file mode 100644 index 000000000..84c310902 --- /dev/null +++ b/schemas/analyzer-troubleshoot-v1beta2.json @@ -0,0 +1,1130 @@ +{ + "description": "Analyzer is the Schema for the analyzers API", + "type": "object", + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "type": "object" + }, + "spec": { + "description": "AnalyzerSpec defines the desired state of Analyzer", + "type": "object", + "properties": { + "analyzers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "clusterVersion": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "containerRuntime": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "customResourceDefinition": { + "type": "object", + "required": [ + "customResourceDefinitionName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "customResourceDefinitionName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "deploymentStatus": { + "type": "object", + "required": [ + "name", + "namespace", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "distribution": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "imagePullSecret": { + "type": "object", + "required": [ + "outcomes", + "registryName" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "registryName": { + "type": "string" + } + } + }, + "ingress": { + "type": "object", + "required": [ + "ingressName", + "namespace", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "ingressName": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "mysql": { + "type": "object", + "required": [ + "collectorName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "nodeResources": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "filters": { + "type": "object", + "properties": { + "cpuAllocatable": { + "type": "string" + }, + "cpuCapacity": { + "type": "string" + }, + "ephemeralStorageAllocatable": { + "type": "string" + }, + "ephemeralStorageCapacity": { + "type": "string" + }, + "memoryAllocatable": { + "type": "string" + }, + "memoryCapacity": { + "type": "string" + }, + "podAllocatable": { + "type": "string" + }, + "podCapacity": { + "type": "string" + }, + "selector": { + "type": "object", + "properties": { + "matchLabel": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "postgres": { + "type": "object", + "required": [ + "collectorName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "redis": { + "type": "object", + "required": [ + "collectorName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "secret": { + "type": "object", + "required": [ + "namespace", + "outcomes", + "secretName" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "key": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "secretName": { + "type": "string" + } + } + }, + "statefulsetStatus": { + "type": "object", + "required": [ + "name", + "namespace", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "storageClass": { + "type": "object", + "required": [ + "outcomes", + "storageClassName" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "storageClassName": { + "type": "string" + } + } + }, + "textAnalyze": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "regex": { + "type": "string" + }, + "regexGroups": { + "type": "string" + } + } + } + } + } + } + } + }, + "status": { + "description": "AnalyzerStatus defines the observed state of Analyzer", + "type": "object" + } + } +} \ No newline at end of file diff --git a/schemas/collector-troubleshoot-v1beta2.json b/schemas/collector-troubleshoot-v1beta2.json new file mode 100644 index 000000000..12f99f278 --- /dev/null +++ b/schemas/collector-troubleshoot-v1beta2.json @@ -0,0 +1,457 @@ +{ + "description": "Collector is the Schema for the collectors API", + "type": "object", + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "type": "object" + }, + "spec": { + "description": "CollectorSpec defines the desired state of Collector", + "type": "object", + "properties": { + "afterCollection": { + "type": "array", + "items": { + "type": "object", + "properties": { + "callback": { + "type": "object", + "required": [ + "method", + "redactUri", + "uri" + ], + "properties": { + "method": { + "type": "string" + }, + "redactUri": { + "type": "string" + }, + "uri": { + "type": "string" + } + } + }, + "uploadResultsTo": { + "type": "object", + "required": [ + "method", + "redactUri", + "uri" + ], + "properties": { + "method": { + "type": "string" + }, + "redactUri": { + "type": "string" + }, + "uri": { + "type": "string" + } + } + } + } + } + }, + "collectors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "clusterInfo": { + "type": "object", + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + } + } + }, + "clusterResources": { + "type": "object", + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + } + } + }, + "copy": { + "type": "object", + "required": [ + "containerPath", + "namespace", + "selector" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "containerName": { + "type": "string" + }, + "containerPath": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "selector": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "data": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "data": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + } + } + }, + "exec": { + "type": "object", + "required": [ + "namespace", + "selector" + ], + "properties": { + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "collectorName": { + "type": "string" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "containerName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "selector": { + "type": "array", + "items": { + "type": "string" + } + }, + "timeout": { + "type": "string" + } + } + }, + "http": { + "type": "object", + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "get": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "insecureSkipVerify": { + "type": "boolean" + }, + "url": { + "type": "string" + } + } + }, + "name": { + "type": "string" + }, + "post": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "body": { + "type": "string" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "insecureSkipVerify": { + "type": "boolean" + }, + "url": { + "type": "string" + } + } + }, + "put": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "body": { + "type": "string" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "insecureSkipVerify": { + "type": "boolean" + }, + "url": { + "type": "string" + } + } + } + } + }, + "logs": { + "type": "object", + "required": [ + "selector" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "containerNames": { + "type": "array", + "items": { + "type": "string" + } + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "limits": { + "type": "object", + "properties": { + "maxAge": { + "type": "string" + }, + "maxLines": { + "type": "integer", + "format": "int64" + } + } + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "selector": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "mysql": { + "type": "object", + "required": [ + "uri" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "uri": { + "type": "string" + } + } + }, + "postgres": { + "type": "object", + "required": [ + "uri" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "uri": { + "type": "string" + } + } + }, + "redis": { + "type": "object", + "required": [ + "uri" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "uri": { + "type": "string" + } + } + }, + "run": { + "type": "object", + "required": [ + "image", + "namespace" + ], + "properties": { + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "collectorName": { + "type": "string" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "image": { + "type": "string" + }, + "imagePullPolicy": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "timeout": { + "type": "string" + } + } + }, + "secret": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "includeValue": { + "type": "boolean" + }, + "key": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + } + } + } + } + } + } + } + }, + "status": { + "description": "CollectorStatus defines the observed state of Collector", + "type": "object" + } + } +} \ No newline at end of file diff --git a/schemas/preflight-troubleshoot-v1beta1.json b/schemas/preflight-troubleshoot-v1beta1.json index 8a435d99b..f9230ead4 100644 --- a/schemas/preflight-troubleshoot-v1beta1.json +++ b/schemas/preflight-troubleshoot-v1beta1.json @@ -612,6 +612,17 @@ }, "podCapacity": { "type": "string" + }, + "selector": { + "type": "object", + "properties": { + "matchLabel": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } } } }, diff --git a/schemas/preflight-troubleshoot-v1beta2.json b/schemas/preflight-troubleshoot-v1beta2.json new file mode 100644 index 000000000..f9230ead4 --- /dev/null +++ b/schemas/preflight-troubleshoot-v1beta2.json @@ -0,0 +1,1517 @@ +{ + "description": "Preflight is the Schema for the preflights API", + "type": "object", + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "type": "object" + }, + "spec": { + "description": "PreflightSpec defines the desired state of Preflight", + "type": "object", + "properties": { + "analyzers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "clusterVersion": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "containerRuntime": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "customResourceDefinition": { + "type": "object", + "required": [ + "customResourceDefinitionName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "customResourceDefinitionName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "deploymentStatus": { + "type": "object", + "required": [ + "name", + "namespace", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "distribution": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "imagePullSecret": { + "type": "object", + "required": [ + "outcomes", + "registryName" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "registryName": { + "type": "string" + } + } + }, + "ingress": { + "type": "object", + "required": [ + "ingressName", + "namespace", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "ingressName": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "mysql": { + "type": "object", + "required": [ + "collectorName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "nodeResources": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "filters": { + "type": "object", + "properties": { + "cpuAllocatable": { + "type": "string" + }, + "cpuCapacity": { + "type": "string" + }, + "ephemeralStorageAllocatable": { + "type": "string" + }, + "ephemeralStorageCapacity": { + "type": "string" + }, + "memoryAllocatable": { + "type": "string" + }, + "memoryCapacity": { + "type": "string" + }, + "podAllocatable": { + "type": "string" + }, + "podCapacity": { + "type": "string" + }, + "selector": { + "type": "object", + "properties": { + "matchLabel": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "postgres": { + "type": "object", + "required": [ + "collectorName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "redis": { + "type": "object", + "required": [ + "collectorName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "secret": { + "type": "object", + "required": [ + "namespace", + "outcomes", + "secretName" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "key": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "secretName": { + "type": "string" + } + } + }, + "statefulsetStatus": { + "type": "object", + "required": [ + "name", + "namespace", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "storageClass": { + "type": "object", + "required": [ + "outcomes", + "storageClassName" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "storageClassName": { + "type": "string" + } + } + }, + "textAnalyze": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "regex": { + "type": "string" + }, + "regexGroups": { + "type": "string" + } + } + } + } + } + }, + "collectors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "clusterInfo": { + "type": "object", + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + } + } + }, + "clusterResources": { + "type": "object", + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + } + } + }, + "copy": { + "type": "object", + "required": [ + "containerPath", + "namespace", + "selector" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "containerName": { + "type": "string" + }, + "containerPath": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "selector": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "data": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "data": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + } + } + }, + "exec": { + "type": "object", + "required": [ + "namespace", + "selector" + ], + "properties": { + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "collectorName": { + "type": "string" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "containerName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "selector": { + "type": "array", + "items": { + "type": "string" + } + }, + "timeout": { + "type": "string" + } + } + }, + "http": { + "type": "object", + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "get": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "insecureSkipVerify": { + "type": "boolean" + }, + "url": { + "type": "string" + } + } + }, + "name": { + "type": "string" + }, + "post": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "body": { + "type": "string" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "insecureSkipVerify": { + "type": "boolean" + }, + "url": { + "type": "string" + } + } + }, + "put": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "body": { + "type": "string" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "insecureSkipVerify": { + "type": "boolean" + }, + "url": { + "type": "string" + } + } + } + } + }, + "logs": { + "type": "object", + "required": [ + "selector" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "containerNames": { + "type": "array", + "items": { + "type": "string" + } + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "limits": { + "type": "object", + "properties": { + "maxAge": { + "type": "string" + }, + "maxLines": { + "type": "integer", + "format": "int64" + } + } + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "selector": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "mysql": { + "type": "object", + "required": [ + "uri" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "uri": { + "type": "string" + } + } + }, + "postgres": { + "type": "object", + "required": [ + "uri" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "uri": { + "type": "string" + } + } + }, + "redis": { + "type": "object", + "required": [ + "uri" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "uri": { + "type": "string" + } + } + }, + "run": { + "type": "object", + "required": [ + "image", + "namespace" + ], + "properties": { + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "collectorName": { + "type": "string" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "image": { + "type": "string" + }, + "imagePullPolicy": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "timeout": { + "type": "string" + } + } + }, + "secret": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "includeValue": { + "type": "boolean" + }, + "key": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + } + } + } + } + } + }, + "uploadResultsTo": { + "type": "string" + } + } + }, + "status": { + "description": "PreflightStatus defines the observed state of Preflight", + "type": "object" + } + } +} \ No newline at end of file diff --git a/schemas/redactor-troubleshoot-v1beta2.json b/schemas/redactor-troubleshoot-v1beta2.json new file mode 100644 index 000000000..b49a37fc3 --- /dev/null +++ b/schemas/redactor-troubleshoot-v1beta2.json @@ -0,0 +1,83 @@ +{ + "description": "Redactor is the Schema for the redaction API", + "type": "object", + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "type": "object" + }, + "spec": { + "description": "RedactorSpec defines the desired state of Redactor", + "type": "object", + "properties": { + "redactors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fileSelector": { + "type": "object", + "properties": { + "file": { + "type": "string" + }, + "files": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "name": { + "type": "string" + }, + "removals": { + "type": "object", + "properties": { + "regex": { + "type": "array", + "items": { + "type": "object", + "properties": { + "redactor": { + "type": "string" + }, + "selector": { + "type": "string" + } + } + } + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + }, + "yamlPath": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "status": { + "description": "RedactorStatus defines the observed state of Redactor", + "type": "object" + } + } +} \ No newline at end of file diff --git a/schemas/supportbundle-troubleshoot-v1beta1.json b/schemas/supportbundle-troubleshoot-v1beta1.json index b15e76c5f..36a9f0f0f 100644 --- a/schemas/supportbundle-troubleshoot-v1beta1.json +++ b/schemas/supportbundle-troubleshoot-v1beta1.json @@ -658,6 +658,17 @@ }, "podCapacity": { "type": "string" + }, + "selector": { + "type": "object", + "properties": { + "matchLabel": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } } } }, diff --git a/schemas/supportbundle-troubleshoot-v1beta2.json b/schemas/supportbundle-troubleshoot-v1beta2.json new file mode 100644 index 000000000..36a9f0f0f --- /dev/null +++ b/schemas/supportbundle-troubleshoot-v1beta2.json @@ -0,0 +1,1560 @@ +{ + "description": "SupportBundle is the Schema for the SupportBundles API", + "type": "object", + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "type": "object" + }, + "spec": { + "description": "SupportBundleSpec defines the desired state of SupportBundle", + "type": "object", + "properties": { + "afterCollection": { + "type": "array", + "items": { + "type": "object", + "properties": { + "callback": { + "type": "object", + "required": [ + "method", + "redactUri", + "uri" + ], + "properties": { + "method": { + "type": "string" + }, + "redactUri": { + "type": "string" + }, + "uri": { + "type": "string" + } + } + }, + "uploadResultsTo": { + "type": "object", + "required": [ + "method", + "redactUri", + "uri" + ], + "properties": { + "method": { + "type": "string" + }, + "redactUri": { + "type": "string" + }, + "uri": { + "type": "string" + } + } + } + } + } + }, + "analyzers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "clusterVersion": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "containerRuntime": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "customResourceDefinition": { + "type": "object", + "required": [ + "customResourceDefinitionName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "customResourceDefinitionName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "deploymentStatus": { + "type": "object", + "required": [ + "name", + "namespace", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "distribution": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "imagePullSecret": { + "type": "object", + "required": [ + "outcomes", + "registryName" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "registryName": { + "type": "string" + } + } + }, + "ingress": { + "type": "object", + "required": [ + "ingressName", + "namespace", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "ingressName": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "mysql": { + "type": "object", + "required": [ + "collectorName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "nodeResources": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "filters": { + "type": "object", + "properties": { + "cpuAllocatable": { + "type": "string" + }, + "cpuCapacity": { + "type": "string" + }, + "ephemeralStorageAllocatable": { + "type": "string" + }, + "ephemeralStorageCapacity": { + "type": "string" + }, + "memoryAllocatable": { + "type": "string" + }, + "memoryCapacity": { + "type": "string" + }, + "podAllocatable": { + "type": "string" + }, + "podCapacity": { + "type": "string" + }, + "selector": { + "type": "object", + "properties": { + "matchLabel": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "postgres": { + "type": "object", + "required": [ + "collectorName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "redis": { + "type": "object", + "required": [ + "collectorName", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "secret": { + "type": "object", + "required": [ + "namespace", + "outcomes", + "secretName" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "key": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "secretName": { + "type": "string" + } + } + }, + "statefulsetStatus": { + "type": "object", + "required": [ + "name", + "namespace", + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + } + } + }, + "storageClass": { + "type": "object", + "required": [ + "outcomes", + "storageClassName" + ], + "properties": { + "checkName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "storageClassName": { + "type": "string" + } + } + }, + "textAnalyze": { + "type": "object", + "required": [ + "outcomes" + ], + "properties": { + "checkName": { + "type": "string" + }, + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "fileName": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fail": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "pass": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + }, + "warn": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "when": { + "type": "string" + } + } + } + } + } + }, + "regex": { + "type": "string" + }, + "regexGroups": { + "type": "string" + } + } + } + } + } + }, + "collectors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "clusterInfo": { + "type": "object", + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + } + } + }, + "clusterResources": { + "type": "object", + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + } + } + }, + "copy": { + "type": "object", + "required": [ + "containerPath", + "namespace", + "selector" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "containerName": { + "type": "string" + }, + "containerPath": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "selector": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "data": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "data": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + } + } + }, + "exec": { + "type": "object", + "required": [ + "namespace", + "selector" + ], + "properties": { + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "collectorName": { + "type": "string" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "containerName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "selector": { + "type": "array", + "items": { + "type": "string" + } + }, + "timeout": { + "type": "string" + } + } + }, + "http": { + "type": "object", + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "get": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "insecureSkipVerify": { + "type": "boolean" + }, + "url": { + "type": "string" + } + } + }, + "name": { + "type": "string" + }, + "post": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "body": { + "type": "string" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "insecureSkipVerify": { + "type": "boolean" + }, + "url": { + "type": "string" + } + } + }, + "put": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "body": { + "type": "string" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "insecureSkipVerify": { + "type": "boolean" + }, + "url": { + "type": "string" + } + } + } + } + }, + "logs": { + "type": "object", + "required": [ + "selector" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "containerNames": { + "type": "array", + "items": { + "type": "string" + } + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "limits": { + "type": "object", + "properties": { + "maxAge": { + "type": "string" + }, + "maxLines": { + "type": "integer", + "format": "int64" + } + } + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "selector": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "mysql": { + "type": "object", + "required": [ + "uri" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "uri": { + "type": "string" + } + } + }, + "postgres": { + "type": "object", + "required": [ + "uri" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "uri": { + "type": "string" + } + } + }, + "redis": { + "type": "object", + "required": [ + "uri" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "uri": { + "type": "string" + } + } + }, + "run": { + "type": "object", + "required": [ + "image", + "namespace" + ], + "properties": { + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "collectorName": { + "type": "string" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "image": { + "type": "string" + }, + "imagePullPolicy": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "timeout": { + "type": "string" + } + } + }, + "secret": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "collectorName": { + "type": "string" + }, + "exclude": { + "description": "BoolOrString is a type that can hold an bool or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a booolean string or raw bool.", + "oneOf": [{"type": "string"},{"type": "boolean"}] + }, + "includeValue": { + "type": "boolean" + }, + "key": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + } + } + } + } + } + } + } + }, + "status": { + "description": "SupportBundleStatus defines the observed state of SupportBundle", + "type": "object" + } + } +} \ No newline at end of file