-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e922dc7
commit ed0ad7e
Showing
13 changed files
with
213 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,50 @@ | ||
apiVersion: troubleshoot.replicated.com/v1beta1 | ||
kind: Preflight | ||
metadata: | ||
name: shiny-new-ai | ||
name: support-io | ||
spec: | ||
uploadResultsTo: https://hookb.in/Z26mz8R9VpC7q7eYrWob | ||
analyzers: | ||
- clusterVersion: | ||
- imagePullSecret: | ||
checkName: "blarg" | ||
registryName: quay.io | ||
outcomes: | ||
- fail: | ||
when: "< 1.13.0" | ||
message: Sorry, ShinyNew.ai requires at least Kubernetes 1.14.0. Please update your Kubernetes cluster before installing. | ||
uri: https://enterprise.shinynew.ai/install/requirements/kubernetes | ||
- warn: | ||
when: "< 1.15.0" | ||
message: The version of Kubernetes you are running meets the minimum requirements to run ShineyNew.ai. It's recommended to run Kubernetes 1.15.0 or later. | ||
uri: https://enterprise.shinynew.ai/install/requirements/kubernetes | ||
message: Cannot pull from quay.io | ||
- pass: | ||
message: The version of Kubernetes you have installed meets the required and recommended versions. | ||
- storageClass: | ||
checkName: Required storage classes | ||
storageClassName: "microk8s-hostpath" | ||
outcomes: | ||
- fail: | ||
message: The required storage class was not found in the cluster. | ||
- pass: | ||
message: The required storage class was found in the cluster. | ||
- ingress: | ||
namespace: default | ||
ingressName: my-app-ingress | ||
outcomes: | ||
- fail: | ||
message: Expected to find an ingress named "my-app-ingress". | ||
- pass: | ||
message: Expected ingress was found. | ||
customResourceDefinitionName: rook | ||
outcomes: | ||
- fail: | ||
message: Rook is required for ShinyNew.ai. Rook was not found in the cluster. | ||
- pass: | ||
message: Found a supported version of Rook installed and running in the cluster. | ||
message: Found credentials to pull from quay.io | ||
# - clusterVersion: | ||
# outcomes: | ||
# - fail: | ||
# when: "< 1.13.0" | ||
# message: Sorry, support.io requires at least Kubernetes 1.14.0. Please update your Kubernetes cluster before installing. | ||
# uri: https://enterprise.support.io/install/requirements/kubernetes | ||
# - warn: | ||
# when: "< 1.15.0" | ||
# message: The version of Kubernetes you are running meets the minimum requirements to run support.io. It's recommended to run Kubernetes 1.15.0 or later. | ||
# uri: https://enterprise.support.io/install/requirements/kubernetes | ||
# - pass: | ||
# message: The version of Kubernetes you have installed meets the required and recommended versions. | ||
# - storageClass: | ||
# checkName: Required storage classes | ||
# storageClassName: "microk8s-hostpath" | ||
# outcomes: | ||
# - fail: | ||
# message: The required storage class was not found in the cluster. | ||
# - pass: | ||
# message: The required storage class was found in the cluster. | ||
# - ingress: | ||
# namespace: default | ||
# ingressName: my-app-ingress | ||
# outcomes: | ||
# - fail: | ||
# message: Expected to find an ingress named "my-app-ingress". | ||
# - pass: | ||
# message: Expected ingress was found. | ||
# - customResourceDefinitionName: | ||
# customResourceDefinitionName: rook | ||
# outcomes: | ||
# - fail: | ||
# message: Rook is required for Support.io. Rook was not found in the cluster. | ||
# - pass: | ||
# message: Found a supported version of Rook installed and running in the cluster. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package analyzer | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" | ||
) | ||
|
||
func analyzeImagePullSecret(analyzer *troubleshootv1beta1.ImagePullSecret, getChildCollectedFileContents func(string) (map[string][]byte, error)) (*AnalyzeResult, error) { | ||
imagePullSecrets, err := getChildCollectedFileContents("cluster-resources/image-pull-secrets") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var failOutcome *troubleshootv1beta1.Outcome | ||
var passOutcome *troubleshootv1beta1.Outcome | ||
for _, outcome := range analyzer.Outcomes { | ||
if outcome.Fail != nil { | ||
failOutcome = outcome | ||
} else if outcome.Pass != nil { | ||
passOutcome = outcome | ||
} | ||
} | ||
|
||
result := AnalyzeResult{ | ||
Title: analyzer.CheckName, | ||
IsFail: true, | ||
Message: failOutcome.Fail.Message, | ||
URI: failOutcome.Fail.URI, | ||
} | ||
|
||
for _, v := range imagePullSecrets { | ||
registryAndUsername := make(map[string]string) | ||
if err := json.Unmarshal(v, ®istryAndUsername); err != nil { | ||
return nil, err | ||
} | ||
|
||
for registry, _ := range registryAndUsername { | ||
if registry == analyzer.RegistryName { | ||
result.IsPass = true | ||
result.IsFail = false | ||
result.Message = passOutcome.Pass.Message | ||
result.URI = passOutcome.Pass.URI | ||
} | ||
} | ||
} | ||
|
||
return &result, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.