From 42288a4ff3f2f4779ba4247cd12bc390213f6584 Mon Sep 17 00:00:00 2001 From: GraysonNull Date: Tue, 18 Feb 2020 21:23:44 +0000 Subject: [PATCH] add IconURI to insights --- pkg/analyze/analyzer.go | 1 + pkg/analyze/cluster_version.go | 1 + pkg/analyze/common_status.go | 3 ++- pkg/analyze/container_runtime.go | 1 + pkg/analyze/crd.go | 1 + pkg/analyze/deployment_status.go | 3 ++- pkg/analyze/distribution.go | 1 + pkg/analyze/image_pull_secret.go | 1 + pkg/analyze/ingress.go | 1 + pkg/analyze/node_resources.go | 1 + pkg/analyze/secret.go | 1 + pkg/analyze/statefulset_status.go | 3 ++- pkg/analyze/storage_class.go | 1 + pkg/analyze/text_analyze.go | 3 +++ pkg/convert/supportbundle.go | 2 ++ 15 files changed, 21 insertions(+), 3 deletions(-) diff --git a/pkg/analyze/analyzer.go b/pkg/analyze/analyzer.go index 13719f80..39334981 100644 --- a/pkg/analyze/analyzer.go +++ b/pkg/analyze/analyzer.go @@ -14,6 +14,7 @@ type AnalyzeResult struct { Message string URI string IconKey string + IconURI string } type getCollectedFileContents func(string) ([]byte, error) diff --git a/pkg/analyze/cluster_version.go b/pkg/analyze/cluster_version.go index 98c5f0fc..4c6aa2e5 100644 --- a/pkg/analyze/cluster_version.go +++ b/pkg/analyze/cluster_version.go @@ -43,6 +43,7 @@ func analyzeClusterVersionResult(k8sVersion semver.Version, outcomes []*troubles result := AnalyzeResult{ Title: title, IconKey: "kubernetes_cluster_version", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/kubernetes.svg?w=16&h=16", } if outcome.Fail != nil { diff --git a/pkg/analyze/common_status.go b/pkg/analyze/common_status.go index 950c597d..ac891396 100644 --- a/pkg/analyze/common_status.go +++ b/pkg/analyze/common_status.go @@ -8,10 +8,11 @@ import ( troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" ) -func commonStatus(outcomes []*troubleshootv1beta1.Outcome, title, iconKey string, readyReplicas int) (*AnalyzeResult, error) { +func commonStatus(outcomes []*troubleshootv1beta1.Outcome, title, iconKey string, iconURI string, readyReplicas int) (*AnalyzeResult, error) { result := &AnalyzeResult{ Title: title, IconKey: iconKey, + IconURI: iconURI, } // ordering from the spec is important, the first one that matches returns diff --git a/pkg/analyze/container_runtime.go b/pkg/analyze/container_runtime.go index 8c0413ef..22843811 100644 --- a/pkg/analyze/container_runtime.go +++ b/pkg/analyze/container_runtime.go @@ -29,6 +29,7 @@ func analyzeContainerRuntime(analyzer *troubleshootv1beta1.ContainerRuntime, get result := &AnalyzeResult{ Title: "Container Runtime", IconKey: "kubernetes_container_runtime", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/container-runtime.svg?w=23&h=16", } // ordering is important for passthrough diff --git a/pkg/analyze/crd.go b/pkg/analyze/crd.go index 31737e5f..3cb12b6c 100644 --- a/pkg/analyze/crd.go +++ b/pkg/analyze/crd.go @@ -27,6 +27,7 @@ func analyzeCustomResourceDefinition(analyzer *troubleshootv1beta1.CustomResourc result := AnalyzeResult{ Title: title, IconKey: "kubernetes_custom_resource_definition", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/custom-resource-definition.svg?w=13&h=16", } for _, storageClass := range crds { diff --git a/pkg/analyze/deployment_status.go b/pkg/analyze/deployment_status.go index 87a18fe2..24e5e4c7 100644 --- a/pkg/analyze/deployment_status.go +++ b/pkg/analyze/deployment_status.go @@ -33,10 +33,11 @@ func analyzeDeploymentStatus(analyzer *troubleshootv1beta1.DeploymentStatus, get return &AnalyzeResult{ Title: fmt.Sprintf("%s Deployment Status", analyzer.Name), IconKey: "kubernetes_deployment_status", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/deployment-status.svg?w=17&h=17", IsFail: true, Message: fmt.Sprintf("The deployment %q was not found", analyzer.Name), }, nil } - return commonStatus(analyzer.Outcomes, fmt.Sprintf("%s Status", analyzer.Name), "kubernetes_deployment_status", int(status.ReadyReplicas)) + return commonStatus(analyzer.Outcomes, fmt.Sprintf("%s Status", analyzer.Name), "kubernetes_deployment_status", "https://troubleshoot.sh/images/analyzer-icons/deployment-status.svg?w=17&h=17", int(status.ReadyReplicas)) } diff --git a/pkg/analyze/distribution.go b/pkg/analyze/distribution.go index 2ff8a757..1a3bf90a 100644 --- a/pkg/analyze/distribution.go +++ b/pkg/analyze/distribution.go @@ -102,6 +102,7 @@ func analyzeDistribution(analyzer *troubleshootv1beta1.Distribution, getCollecte result := &AnalyzeResult{ Title: "Kubernetes Distribution", IconKey: "kubernetes_distribution", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/distribution.svg?w=20&h=14", } // ordering is important for passthrough diff --git a/pkg/analyze/image_pull_secret.go b/pkg/analyze/image_pull_secret.go index 9e3217a8..8571f88c 100644 --- a/pkg/analyze/image_pull_secret.go +++ b/pkg/analyze/image_pull_secret.go @@ -26,6 +26,7 @@ func analyzeImagePullSecret(analyzer *troubleshootv1beta1.ImagePullSecret, getCh result := AnalyzeResult{ Title: analyzer.CheckName, IconKey: "kubernetes_image_pull_secret", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/image-pull-secret.svg?w=16&h=14", IsFail: true, Message: failOutcome.Fail.Message, URI: failOutcome.Fail.URI, diff --git a/pkg/analyze/ingress.go b/pkg/analyze/ingress.go index dbe49c94..079aa820 100644 --- a/pkg/analyze/ingress.go +++ b/pkg/analyze/ingress.go @@ -27,6 +27,7 @@ func analyzeIngress(analyzer *troubleshootv1beta1.Ingress, getCollectedFileConte result := AnalyzeResult{ Title: title, IconKey: "kubernetes_ingress", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/ingress-controller.svg?w=20&h=13", } for _, ingress := range ingresses { diff --git a/pkg/analyze/node_resources.go b/pkg/analyze/node_resources.go index 280e6198..c53273a1 100644 --- a/pkg/analyze/node_resources.go +++ b/pkg/analyze/node_resources.go @@ -45,6 +45,7 @@ func analyzeNodeResources(analyzer *troubleshootv1beta1.NodeResources, getCollec result := &AnalyzeResult{ Title: title, IconKey: "kubernetes_node_resources", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/node-resources.svg?w=16&h=18", } for _, outcome := range analyzer.Outcomes { diff --git a/pkg/analyze/secret.go b/pkg/analyze/secret.go index 86cd5502..36751e0c 100644 --- a/pkg/analyze/secret.go +++ b/pkg/analyze/secret.go @@ -27,6 +27,7 @@ func analyzeSecret(analyzer *troubleshootv1beta1.AnalyzeSecret, getCollectedFile result := AnalyzeResult{ Title: title, IconKey: "kubernetes_analyze_secret", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/secret.svg?w=13&h=16", } var failOutcome *troubleshootv1beta1.Outcome diff --git a/pkg/analyze/statefulset_status.go b/pkg/analyze/statefulset_status.go index b9499746..2f061d89 100644 --- a/pkg/analyze/statefulset_status.go +++ b/pkg/analyze/statefulset_status.go @@ -33,10 +33,11 @@ func analyzeStatefulsetStatus(analyzer *troubleshootv1beta1.StatefulsetStatus, g return &AnalyzeResult{ Title: fmt.Sprintf("%s Statefulset Status", analyzer.Name), IconKey: "kubernetes_statefulset_status", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/statefulset-status.svg?w=23&h=14", IsFail: true, Message: fmt.Sprintf("The statefulset %q was not found", analyzer.Name), }, nil } - return commonStatus(analyzer.Outcomes, fmt.Sprintf("%s Status", analyzer.Name), "kubernetes_statefulset_status", int(status.ReadyReplicas)) + return commonStatus(analyzer.Outcomes, fmt.Sprintf("%s Status", analyzer.Name), "kubernetes_statefulset_status", "https://troubleshoot.sh/images/analyzer-icons/statefulset-status.svg?w=23&h=14", int(status.ReadyReplicas)) } diff --git a/pkg/analyze/storage_class.go b/pkg/analyze/storage_class.go index dbe8eda2..1f77a04f 100644 --- a/pkg/analyze/storage_class.go +++ b/pkg/analyze/storage_class.go @@ -27,6 +27,7 @@ func analyzeStorageClass(analyzer *troubleshootv1beta1.StorageClass, getCollecte result := AnalyzeResult{ Title: title, IconKey: "kubernetes_storage_class", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/storage-class.svg?w=12&h=12", } for _, storageClass := range storageClasses { diff --git a/pkg/analyze/text_analyze.go b/pkg/analyze/text_analyze.go index a8760a27..4b9e8346 100644 --- a/pkg/analyze/text_analyze.go +++ b/pkg/analyze/text_analyze.go @@ -33,6 +33,7 @@ func analyzeTextAnalyze(analyzer *troubleshootv1beta1.TextAnalyze, getCollectedF return &AnalyzeResult{ Title: analyzer.CheckName, IconKey: "kubernetes_text_analyze", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg", IsFail: true, Message: "Invalid analyzer", }, nil @@ -66,6 +67,7 @@ func analyzeRegexPattern(pattern string, collected []byte, outcomes []*troublesh return &AnalyzeResult{ Title: checkName, IconKey: "kubernetes_text_analyze", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg", IsFail: true, Message: failOutcome.Fail.Message, URI: failOutcome.Fail.URI, @@ -83,6 +85,7 @@ func analyzeRegexGroups(pattern string, collected []byte, outcomes []*troublesho result := &AnalyzeResult{ Title: checkName, IconKey: "kubernetes_text_analyze", + IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg?w=13&h=16", } foundMatches := map[string]string{} diff --git a/pkg/convert/supportbundle.go b/pkg/convert/supportbundle.go index a850ce74..9de898c5 100644 --- a/pkg/convert/supportbundle.go +++ b/pkg/convert/supportbundle.go @@ -74,6 +74,7 @@ func FromAnalyzerResult(input []*analyze.AnalyzeResult) []*Result { Labels: map[string]string{ "desiredPosition": "1", "iconKey": i.IconKey, + "iconUri": i.IconURI, }, }, Insight: &Insight{ @@ -81,6 +82,7 @@ func FromAnalyzerResult(input []*analyze.AnalyzeResult) []*Result { Name: name, Labels: map[string]string{ "iconKey": i.IconKey, + "iconUri": i.IconURI, }, }, Primary: i.Title,