mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
Merge pull request #140 from GraysonNull/grayson/icon-uri
add IconURI to insights
This commit is contained in:
@@ -14,6 +14,7 @@ type AnalyzeResult struct {
|
||||
Message string
|
||||
URI string
|
||||
IconKey string
|
||||
IconURI string
|
||||
}
|
||||
|
||||
type getCollectedFileContents func(string) ([]byte, error)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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{}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user