Add strict flag to Analyzers and ResultAnalyzers (#539)

* add strict flag to Analyzer/AnalyzerMeta

and regenerate schemas and controller-gen code

* map analyzer strict to result

* Update stdout for human and json format

* fix review comment

* update interactive result

* update interactive results

* Update types.go

* Update upload_results.go

* print strict when only true
This commit is contained in:
Pavan Sokke Nagaraj
2022-02-23 15:07:51 -05:00
committed by GitHub
parent 0a2ed01a46
commit 942234da80
17 changed files with 576 additions and 20 deletions

View File

@@ -139,6 +139,9 @@ func drawPreflightTable(analyzeResults []*analyzerunner.AnalyzeResult) {
for i, analyzeResult := range analyzeResults {
title := analyzeResult.Title
if analyzeResult.Strict {
title = title + fmt.Sprintf(" (Strict: %t)", analyzeResult.Strict)
}
if analyzeResult.IsPass {
title = fmt.Sprintf("✔ %s", title)
} else if analyzeResult.IsWarn {
@@ -255,6 +258,10 @@ func save(preflightName string, outputPath string, analyzeResults []*analyzerunn
result = result + fmt.Sprintf("URI: %s\n", analyzeResult.URI)
}
if analyzeResult.Strict {
result = result + fmt.Sprintf("Strict: %t\n", analyzeResult.Strict)
}
result = result + "\n------------\n"
results = results + result

View File

@@ -42,6 +42,7 @@ func showStdoutResultsJSON(preflightName string, analyzeResults []*analyzerunner
Title string `json:"title"`
Message string `json:"message"`
URI string `json:"uri,omitempty"`
Strict bool `json:"strict,omitempty"`
}
type Output struct {
Pass []ResultOutput `json:"pass,omitempty"`
@@ -62,6 +63,10 @@ func showStdoutResultsJSON(preflightName string, analyzeResults []*analyzerunner
URI: analyzeResult.URI,
}
if analyzeResult.Strict {
resultOutput.Strict = analyzeResult.Strict
}
if analyzeResult.IsPass {
output.Pass = append(output.Pass, resultOutput)
} else if analyzeResult.IsWarn {
@@ -91,6 +96,13 @@ func outputResult(analyzeResult *analyzerunner.AnalyzeResult) bool {
} else if analyzeResult.IsFail {
fmt.Printf(" --- FAIL: %s\n", analyzeResult.Title)
fmt.Printf(" --- %s\n", analyzeResult.Message)
}
if analyzeResult.Strict {
fmt.Printf(" --- Strict: %t\n", analyzeResult.Strict)
}
if analyzeResult.IsFail {
return true
}
return false

View File

@@ -17,6 +17,7 @@ func uploadResults(uri string, analyzeResults []*analyzerunner.AnalyzeResult) er
}
for _, analyzeResult := range analyzeResults {
uploadPreflightResult := &preflight.UploadPreflightResult{
Strict: analyzeResult.Strict,
IsFail: analyzeResult.IsFail,
IsWarn: analyzeResult.IsWarn,
IsPass: analyzeResult.IsPass,

View File

@@ -81,6 +81,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- namespace
- outcomes
@@ -127,6 +129,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -168,6 +172,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -215,6 +221,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- configMapName
- namespace
@@ -258,6 +266,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -301,6 +311,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- customResourceDefinitionName
- outcomes
@@ -351,6 +363,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -393,6 +407,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -436,6 +452,8 @@ spec:
type: array
registryName:
type: string
strict:
type: BoolString
required:
- outcomes
- registryName
@@ -482,6 +500,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- ingressName
- namespace
@@ -533,6 +553,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -579,6 +601,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- namespace
- outcomes
@@ -625,6 +649,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -693,6 +719,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -738,6 +766,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -784,6 +814,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -828,6 +860,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -882,6 +916,8 @@ spec:
items:
type: string
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -931,6 +967,8 @@ spec:
type: array
secretName:
type: string
strict:
type: BoolString
required:
- namespace
- outcomes
@@ -982,6 +1020,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -1026,6 +1066,8 @@ spec:
type: array
storageClassName:
type: string
strict:
type: BoolString
required:
- outcomes
- storageClassName
@@ -1068,6 +1110,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -1119,6 +1163,8 @@ spec:
type: string
regexGroups:
type: string
strict:
type: BoolString
required:
- outcomes
type: object
@@ -1130,6 +1176,8 @@ spec:
type: BoolString
reportFileGlob:
type: string
strict:
type: BoolString
required:
- reportFileGlob
type: object

View File

@@ -82,6 +82,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- includeUnmountedPartitions
- minimumAcceptableSize
@@ -127,6 +129,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -168,6 +172,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -211,6 +217,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -254,6 +262,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -295,6 +305,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -336,6 +348,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -379,6 +393,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -422,6 +438,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -463,6 +481,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -504,6 +524,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -545,6 +567,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -588,6 +612,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -631,6 +657,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -674,6 +702,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -717,6 +747,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -758,6 +790,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object

View File

@@ -82,6 +82,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- includeUnmountedPartitions
- minimumAcceptableSize
@@ -127,6 +129,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -168,6 +172,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -211,6 +217,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -254,6 +262,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -295,6 +305,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -336,6 +348,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -379,6 +393,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -422,6 +438,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -463,6 +481,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -504,6 +524,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -545,6 +567,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -588,6 +612,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -631,6 +657,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -674,6 +702,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -717,6 +747,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -758,6 +790,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object

View File

@@ -81,6 +81,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- namespace
- outcomes
@@ -127,6 +129,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -168,6 +172,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -215,6 +221,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- configMapName
- namespace
@@ -258,6 +266,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -301,6 +311,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- customResourceDefinitionName
- outcomes
@@ -351,6 +363,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -393,6 +407,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -436,6 +452,8 @@ spec:
type: array
registryName:
type: string
strict:
type: BoolString
required:
- outcomes
- registryName
@@ -482,6 +500,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- ingressName
- namespace
@@ -533,6 +553,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -579,6 +601,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- namespace
- outcomes
@@ -625,6 +649,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -693,6 +719,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -738,6 +766,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -784,6 +814,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -828,6 +860,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -882,6 +916,8 @@ spec:
items:
type: string
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -931,6 +967,8 @@ spec:
type: array
secretName:
type: string
strict:
type: BoolString
required:
- namespace
- outcomes
@@ -982,6 +1020,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -1026,6 +1066,8 @@ spec:
type: array
storageClassName:
type: string
strict:
type: BoolString
required:
- outcomes
- storageClassName
@@ -1068,6 +1110,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -1119,6 +1163,8 @@ spec:
type: string
regexGroups:
type: string
strict:
type: BoolString
required:
- outcomes
type: object
@@ -1130,6 +1176,8 @@ spec:
type: BoolString
reportFileGlob:
type: string
strict:
type: BoolString
required:
- reportFileGlob
type: object

View File

@@ -112,6 +112,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- namespace
- outcomes
@@ -158,6 +160,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -199,6 +203,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -246,6 +252,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- configMapName
- namespace
@@ -289,6 +297,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -332,6 +342,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- customResourceDefinitionName
- outcomes
@@ -382,6 +394,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -424,6 +438,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -467,6 +483,8 @@ spec:
type: array
registryName:
type: string
strict:
type: BoolString
required:
- outcomes
- registryName
@@ -513,6 +531,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- ingressName
- namespace
@@ -564,6 +584,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -610,6 +632,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- namespace
- outcomes
@@ -656,6 +680,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -724,6 +750,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -769,6 +797,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -815,6 +845,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -859,6 +891,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- collectorName
- outcomes
@@ -913,6 +947,8 @@ spec:
items:
type: string
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -962,6 +998,8 @@ spec:
type: array
secretName:
type: string
strict:
type: BoolString
required:
- namespace
- outcomes
@@ -1013,6 +1051,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- name
- outcomes
@@ -1057,6 +1097,8 @@ spec:
type: array
storageClassName:
type: string
strict:
type: BoolString
required:
- outcomes
- storageClassName
@@ -1099,6 +1141,8 @@ spec:
type: object
type: object
type: array
strict:
type: BoolString
required:
- outcomes
type: object
@@ -1150,6 +1194,8 @@ spec:
type: string
regexGroups:
type: string
strict:
type: BoolString
required:
- outcomes
type: object
@@ -1161,6 +1207,8 @@ spec:
type: BoolString
reportFileGlob:
type: string
strict:
type: BoolString
required:
- reportFileGlob
type: object

View File

@@ -75,7 +75,10 @@ func (c *Clientset) Tracker() testing.ObjectTracker {
return c.tracker
}
var _ clientset.Interface = &Clientset{}
var (
_ clientset.Interface = &Clientset{}
_ testing.FakeClient = &Clientset{}
)
// TroubleshootV1beta1 retrieves the TroubleshootV1beta1Client
func (c *Clientset) TroubleshootV1beta1() troubleshootv1beta1.TroubleshootV1beta1Interface {

View File

@@ -29,7 +29,7 @@ import (
var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)
var parameterCodec = runtime.NewParameterCodec(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
troubleshootv1beta1.AddToScheme,
troubleshootv1beta2.AddToScheme,

View File

@@ -14,6 +14,7 @@ type AnalyzeResult struct {
IsPass bool
IsFail bool
IsWarn bool
Strict bool
Title string
Message string
@@ -94,6 +95,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.ClusterVersion.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.StorageClass != nil {
@@ -108,6 +110,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.StorageClass.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.CustomResourceDefinition != nil {
@@ -122,6 +125,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.CustomResourceDefinition.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.Ingress != nil {
@@ -136,6 +140,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.Ingress.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.Secret != nil {
@@ -150,6 +155,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.Secret.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.ConfigMap != nil {
@@ -164,6 +170,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.ConfigMap.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.ImagePullSecret != nil {
@@ -178,6 +185,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.ImagePullSecret.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.DeploymentStatus != nil {
@@ -192,6 +200,9 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
for i := range results {
results[i].Strict = analyzer.DeploymentStatus.Strict.BoolVal
}
return results, nil
}
if analyzer.StatefulsetStatus != nil {
@@ -206,6 +217,9 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
for i := range results {
results[i].Strict = analyzer.StatefulsetStatus.Strict.BoolVal
}
return results, nil
}
if analyzer.JobStatus != nil {
@@ -220,6 +234,9 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
for i := range results {
results[i].Strict = analyzer.JobStatus.Strict.BoolVal
}
return results, nil
}
if analyzer.ReplicaSetStatus != nil {
@@ -234,6 +251,9 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
for i := range results {
results[i].Strict = analyzer.ReplicaSetStatus.Strict.BoolVal
}
return results, nil
}
if analyzer.ClusterPodStatuses != nil {
@@ -248,6 +268,9 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
for i := range results {
results[i].Strict = analyzer.ClusterPodStatuses.Strict.BoolVal
}
return results, nil
}
if analyzer.ContainerRuntime != nil {
@@ -262,6 +285,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.ContainerRuntime.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.Distribution != nil {
@@ -276,6 +300,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.Distribution.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.NodeResources != nil {
@@ -290,6 +315,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.NodeResources.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.TextAnalyze != nil {
@@ -300,11 +326,14 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if isExcluded {
return nil, nil
}
multiResult, err := analyzeTextAnalyze(analyzer.TextAnalyze, findFiles)
results, err := analyzeTextAnalyze(analyzer.TextAnalyze, findFiles)
if err != nil {
return nil, err
}
return multiResult, nil
for i := range results {
results[i].Strict = analyzer.TextAnalyze.Strict.BoolVal
}
return results, nil
}
if analyzer.Postgres != nil {
isExcluded, err := isExcluded(analyzer.Postgres.Exclude)
@@ -318,6 +347,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.Postgres.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.Mysql != nil {
@@ -332,6 +362,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.Mysql.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.Redis != nil {
@@ -346,6 +377,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.Redis.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.CephStatus != nil {
@@ -360,6 +392,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.CephStatus.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
if analyzer.Longhorn != nil {
@@ -370,7 +403,14 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if isExcluded {
return nil, nil
}
return longhorn(analyzer.Longhorn, getFile, findFiles)
results, err := longhorn(analyzer.Longhorn, getFile, findFiles)
if err != nil {
return nil, err
}
for i := range results {
results[i].Strict = analyzer.Longhorn.Strict.BoolVal
}
return results, nil
}
if analyzer.RegistryImages != nil {
@@ -385,6 +425,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
result.Strict = analyzer.RegistryImages.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}
@@ -400,6 +441,9 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if err != nil {
return nil, err
}
for i := range results {
results[i].Strict = analyzer.WeaveReport.Strict.BoolVal
}
return results, nil
}
@@ -418,6 +462,7 @@ func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileCont
if result == nil {
return []*AnalyzeResult{}, nil
}
result.Strict = analyzer.Sysctl.Strict.BoolVal
return []*AnalyzeResult{result}, nil
}

View File

@@ -177,6 +177,7 @@ type SysctlAnalyze struct {
type AnalyzeMeta struct {
CheckName string `json:"checkName,omitempty" yaml:"checkName,omitempty"`
Exclude multitype.BoolOrString `json:"exclude,omitempty" yaml:"exclude,omitempty"`
Strict multitype.BoolOrString `json:"strict,omitempty" yaml:"strict,omitempty"`
}
type Analyze struct {

View File

@@ -216,6 +216,7 @@ func (in *AnalyzeConfigMap) DeepCopy() *AnalyzeConfigMap {
func (in *AnalyzeMeta) DeepCopyInto(out *AnalyzeMeta) {
*out = *in
out.Exclude = in.Exclude
out.Strict = in.Strict
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalyzeMeta.

View File

@@ -1,6 +1,7 @@
package preflight
type UploadPreflightResult struct {
Strict bool `json:"strict,omitempty"`
IsFail bool `json:"isFail,omitempty"`
IsWarn bool `json:"isWarn,omitempty"`
IsPass bool `json:"isPass,omitempty"`

View File

@@ -90,13 +90,15 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
"clusterPodStatuses": {
"type": "object",
"required": [
"namespaces",
"outcomes"
],
"properties": {
@@ -161,6 +163,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -225,6 +230,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -300,6 +308,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -364,6 +375,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -432,6 +446,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -439,7 +456,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes"
],
"properties": {
@@ -455,6 +471,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -504,6 +526,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -568,6 +593,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -636,6 +664,9 @@
},
"registryName": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -708,6 +739,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -715,7 +749,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes"
],
"properties": {
@@ -731,6 +764,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -780,6 +819,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -851,6 +893,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -922,6 +967,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1026,6 +1074,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1097,6 +1148,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1168,6 +1222,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1236,6 +1293,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1243,7 +1303,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes",
"selector"
],
@@ -1260,6 +1319,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -1315,6 +1380,9 @@
"items": {
"type": "string"
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1390,6 +1458,9 @@
},
"secretName": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1397,7 +1468,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes"
],
"properties": {
@@ -1413,6 +1483,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -1462,6 +1538,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1530,6 +1609,9 @@
},
"storageClassName": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1594,6 +1676,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1673,6 +1758,9 @@
},
"regexGroups": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1690,6 +1778,9 @@
},
"reportFileGlob": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
}

View File

@@ -90,13 +90,15 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
"clusterPodStatuses": {
"type": "object",
"required": [
"namespaces",
"outcomes"
],
"properties": {
@@ -161,6 +163,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -225,6 +230,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -300,6 +308,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -364,6 +375,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -432,6 +446,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -439,7 +456,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes"
],
"properties": {
@@ -455,6 +471,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -504,6 +526,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -568,6 +593,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -636,6 +664,9 @@
},
"registryName": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -708,6 +739,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -715,7 +749,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes"
],
"properties": {
@@ -731,6 +764,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -780,6 +819,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -851,6 +893,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -922,6 +967,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1026,6 +1074,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1097,6 +1148,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1168,6 +1222,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1236,6 +1293,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1243,7 +1303,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes",
"selector"
],
@@ -1260,6 +1319,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -1315,6 +1380,9 @@
"items": {
"type": "string"
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1390,6 +1458,9 @@
},
"secretName": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1397,7 +1468,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes"
],
"properties": {
@@ -1413,6 +1483,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -1462,6 +1538,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1530,6 +1609,9 @@
},
"storageClassName": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1594,6 +1676,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1673,6 +1758,9 @@
},
"regexGroups": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1690,6 +1778,9 @@
},
"reportFileGlob": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
}

View File

@@ -136,13 +136,15 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
"clusterPodStatuses": {
"type": "object",
"required": [
"namespaces",
"outcomes"
],
"properties": {
@@ -207,6 +209,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -271,6 +276,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -346,6 +354,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -410,6 +421,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -478,6 +492,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -485,7 +502,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes"
],
"properties": {
@@ -501,6 +517,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -550,6 +572,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -614,6 +639,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -682,6 +710,9 @@
},
"registryName": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -754,6 +785,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -761,7 +795,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes"
],
"properties": {
@@ -777,6 +810,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -826,6 +865,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -897,6 +939,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -968,6 +1013,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1072,6 +1120,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1143,6 +1194,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1214,6 +1268,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1282,6 +1339,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1289,7 +1349,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes",
"selector"
],
@@ -1306,6 +1365,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -1361,6 +1426,9 @@
"items": {
"type": "string"
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1436,6 +1504,9 @@
},
"secretName": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1443,7 +1514,6 @@
"type": "object",
"required": [
"name",
"namespace",
"outcomes"
],
"properties": {
@@ -1459,6 +1529,12 @@
"namespace": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"outcomes": {
"type": "array",
"items": {
@@ -1508,6 +1584,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1576,6 +1655,9 @@
},
"storageClassName": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1640,6 +1722,9 @@
}
}
}
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1719,6 +1804,9 @@
},
"regexGroups": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
},
@@ -1736,6 +1824,9 @@
},
"reportFileGlob": {
"type": "string"
},
"strict": {
"oneOf": [{"type": "string"},{"type": "boolean"}]
}
}
}