From 12110f20d2d85c984839780102dae46444570dbc Mon Sep 17 00:00:00 2001 From: Archit Sharma Date: Fri, 3 Nov 2023 18:31:42 +0530 Subject: [PATCH] cleanup; generate schemas Signed-off-by: Archit Sharma --- config/crds/troubleshoot.sh_analyzers.yaml | 39 ------------ config/crds/troubleshoot.sh_preflights.yaml | 39 ------------ .../crds/troubleshoot.sh_supportbundles.yaml | 39 ------------ go.mod | 2 +- pkg/analyze/velero.go | 6 -- .../troubleshoot/v1beta2/analyzer_shared.go | 5 +- .../v1beta2/zz_generated.deepcopy.go | 11 ---- schemas/analyzer-troubleshoot-v1beta2.json | 60 ------------------- schemas/preflight-troubleshoot-v1beta2.json | 60 ------------------- .../supportbundle-troubleshoot-v1beta2.json | 60 ------------------- 10 files changed, 2 insertions(+), 319 deletions(-) diff --git a/config/crds/troubleshoot.sh_analyzers.yaml b/config/crds/troubleshoot.sh_analyzers.yaml index 4d506d1d9..982aaf093 100644 --- a/config/crds/troubleshoot.sh_analyzers.yaml +++ b/config/crds/troubleshoot.sh_analyzers.yaml @@ -1497,49 +1497,10 @@ spec: type: object checkName: type: string - collectorName: - type: string exclude: type: BoolString - 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 strict: type: BoolString - required: - - namespace - - outcomes type: object weaveReport: properties: diff --git a/config/crds/troubleshoot.sh_preflights.yaml b/config/crds/troubleshoot.sh_preflights.yaml index 7b020c4c0..949711ae7 100644 --- a/config/crds/troubleshoot.sh_preflights.yaml +++ b/config/crds/troubleshoot.sh_preflights.yaml @@ -1497,49 +1497,10 @@ spec: type: object checkName: type: string - collectorName: - type: string exclude: type: BoolString - 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 strict: type: BoolString - required: - - namespace - - outcomes type: object weaveReport: properties: diff --git a/config/crds/troubleshoot.sh_supportbundles.yaml b/config/crds/troubleshoot.sh_supportbundles.yaml index efc6a70e3..405d62cc0 100644 --- a/config/crds/troubleshoot.sh_supportbundles.yaml +++ b/config/crds/troubleshoot.sh_supportbundles.yaml @@ -1528,49 +1528,10 @@ spec: type: object checkName: type: string - collectorName: - type: string exclude: type: BoolString - 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 strict: type: BoolString - required: - - namespace - - outcomes type: object weaveReport: properties: diff --git a/go.mod b/go.mod index 19f4c9d22..15610291b 100644 --- a/go.mod +++ b/go.mod @@ -39,6 +39,7 @@ require ( go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/sdk v1.19.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 + golang.org/x/mod v0.12.0 golang.org/x/sync v0.4.0 gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.28.2 @@ -105,7 +106,6 @@ require ( go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/mod v0.12.0 // indirect golang.org/x/tools v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect diff --git a/pkg/analyze/velero.go b/pkg/analyze/velero.go index ab2493dd5..2512f5dfa 100644 --- a/pkg/analyze/velero.go +++ b/pkg/analyze/velero.go @@ -62,7 +62,6 @@ func (a *AnalyzeVelero) veleroStatus(analyzer *troubleshootv1beta2.VeleroAnalyze // check if veleroVersion is less than 1.10.x compareResult := semver.Compare(veleroVersion, "1.10.0") if compareResult < 0 { - fmt.Printf("Version %s is less than %s\n", veleroVersion, "1.10.0") oldVeleroRepoType = true } @@ -335,11 +334,6 @@ func analyzeResticRepositories(resticRepositories []*restic_types.ResticReposito resticRepositoriesResult.Message = "No restic repositories configured" } else { for _, resticRepository := range resticRepositories { - // phase, _, err := unstructured.NestedString(resticRepository.Object, "status", "phase") - // if err != nil { - // klog.V(2).Infof("Failed to get phase for restic repository %s: %v", resticRepository.GetName(), err) - // } - // if phase != "Ready" { if resticRepository.Status.Phase != restic_types.ResticRepositoryPhaseReady { result := &AnalyzeResult{ Title: fmt.Sprintf("Restic Repository %s", resticRepository.GetName()), diff --git a/pkg/apis/troubleshoot/v1beta2/analyzer_shared.go b/pkg/apis/troubleshoot/v1beta2/analyzer_shared.go index a206ad7bd..62a2a2527 100644 --- a/pkg/apis/troubleshoot/v1beta2/analyzer_shared.go +++ b/pkg/apis/troubleshoot/v1beta2/analyzer_shared.go @@ -187,10 +187,7 @@ type CephStatusAnalyze struct { } type VeleroAnalyze struct { - AnalyzeMeta `json:",inline" yaml:",inline"` - Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"` - CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"` - Namespace string `json:"namespace" yaml:"namespace"` + AnalyzeMeta `json:",inline" yaml:",inline"` } type LonghornAnalyze struct { diff --git a/pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go b/pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go index 9b8219a30..9d388f7d6 100644 --- a/pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go +++ b/pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go @@ -4663,17 +4663,6 @@ func (in *UDPPortStatusAnalyze) DeepCopy() *UDPPortStatusAnalyze { func (in *VeleroAnalyze) DeepCopyInto(out *VeleroAnalyze) { *out = *in in.AnalyzeMeta.DeepCopyInto(&out.AnalyzeMeta) - if in.Outcomes != nil { - in, out := &in.Outcomes, &out.Outcomes - *out = make([]*Outcome, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(Outcome) - (*in).DeepCopyInto(*out) - } - } - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VeleroAnalyze. diff --git a/schemas/analyzer-troubleshoot-v1beta2.json b/schemas/analyzer-troubleshoot-v1beta2.json index c07e25235..592a4c94e 100644 --- a/schemas/analyzer-troubleshoot-v1beta2.json +++ b/schemas/analyzer-troubleshoot-v1beta2.json @@ -2257,10 +2257,6 @@ }, "velero": { "type": "object", - "required": [ - "namespace", - "outcomes" - ], "properties": { "annotations": { "type": "object", @@ -2271,65 +2267,9 @@ "checkName": { "type": "string" }, - "collectorName": { - "type": "string" - }, "exclude": { "oneOf": [{"type": "string"},{"type": "boolean"}] }, - "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" - } - } - } - } - } - }, "strict": { "oneOf": [{"type": "string"},{"type": "boolean"}] } diff --git a/schemas/preflight-troubleshoot-v1beta2.json b/schemas/preflight-troubleshoot-v1beta2.json index fae3371c7..db19376bd 100644 --- a/schemas/preflight-troubleshoot-v1beta2.json +++ b/schemas/preflight-troubleshoot-v1beta2.json @@ -2257,10 +2257,6 @@ }, "velero": { "type": "object", - "required": [ - "namespace", - "outcomes" - ], "properties": { "annotations": { "type": "object", @@ -2271,65 +2267,9 @@ "checkName": { "type": "string" }, - "collectorName": { - "type": "string" - }, "exclude": { "oneOf": [{"type": "string"},{"type": "boolean"}] }, - "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" - } - } - } - } - } - }, "strict": { "oneOf": [{"type": "string"},{"type": "boolean"}] } diff --git a/schemas/supportbundle-troubleshoot-v1beta2.json b/schemas/supportbundle-troubleshoot-v1beta2.json index 14767b014..0fc868784 100644 --- a/schemas/supportbundle-troubleshoot-v1beta2.json +++ b/schemas/supportbundle-troubleshoot-v1beta2.json @@ -2303,10 +2303,6 @@ }, "velero": { "type": "object", - "required": [ - "namespace", - "outcomes" - ], "properties": { "annotations": { "type": "object", @@ -2317,65 +2313,9 @@ "checkName": { "type": "string" }, - "collectorName": { - "type": "string" - }, "exclude": { "oneOf": [{"type": "string"},{"type": "boolean"}] }, - "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" - } - } - } - } - } - }, "strict": { "oneOf": [{"type": "string"},{"type": "boolean"}] }