Prevent Kubernetes misconfigurations from reaching production (again 😤 )! From code to cloud, Datree provides an E2E policy enforcement solution to run automatic checks for rule violations. See our docs: https://hub.datree.io
Describe the bug
When running a test with JSON output, the "Loading..." spinner runs.
When writing the output to a file like this:
datree test file.yaml -o json > /dir/output.json
the output.json file looks like this:
[K
| Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
/ Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
- Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
\ Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
| Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
/ Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
- Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
\ Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
| Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
/ Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
- Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
\ Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K
| Loading... WWWWWWWWWWWWWW[K[K[K[K[K[K[K[K[K[K[K[K[K[K
[K{"policyValidationResults":[{"fileName":"/Users/hadarco/Desktop/yamls/exampleFile.yaml","ruleResults":[{"identifier":"CONTAINERS_MISSING_READINESSPROBE_KEY","name":"Ensure each container has a configured readiness probe","messageOnFailure":"Missing property object `readinessProbe` - add a properly configured readinessProbe to notify kubelet your Pods are ready for traffic","occurrencesDetails":[{"metadataName":"demo","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false},{"metadataName":"demo2","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false}]},{"identifier":"DEPLOYMENT_INCORRECT_REPLICAS_VALUE","name":"Ensure Deployment has more than one replica configured","messageOnFailure":"Incorrect value for key `replicas` - running 2 or more replicas will increase the availability of the service","occurrencesDetails":[{"metadataName":"demo2","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false}]},{"identifier":"CONTAINERS_MISSING_MEMORY_REQUEST_KEY","name":"Ensure each container has a configured memory request","messageOnFailure":"Missing property object `requests.memory` - value should be within the accepted boundaries recommended by the organization","occurrencesDetails":[{"metadataName":"demo","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false},{"metadataName":"demo2","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false}]},{"identifier":"CONTAINERS_MISSING_CPU_REQUEST_KEY","name":"Ensure each container has a configured CPU request","messageOnFailure":"Missing property object `requests.cpu` - value should be within the accepted boundaries recommended by the organization","occurrencesDetails":[{"metadataName":"demo","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false},{"metadataName":"demo2","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false}]},{"identifier":"CONTAINERS_MISSING_MEMORY_LIMIT_KEY","name":"Ensure each container has a configured memory limit","messageOnFailure":"Missing property object `limits.memory` - value should be within the accepted boundaries recommended by the organization","occurrencesDetails":[{"metadataName":"demo","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false},{"metadataName":"demo2","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false}]},{"identifier":"CONTAINERS_MISSING_CPU_LIMIT_KEY","name":"Ensure each container has a configured CPU limit","messageOnFailure":"Missing property object `limits.cpu` - value should be within the accepted boundaries recommended by the organization","occurrencesDetails":[{"metadataName":"demo","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false},{"metadataName":"demo2","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false}]},{"identifier":"CONTAINERS_MISSING_LIVENESSPROBE_KEY","name":"Ensure each container has a configured liveness probe","messageOnFailure":"Missing property object `livenessProbe` - add a properly configured livenessProbe to catch possible deadlocks","occurrencesDetails":[{"metadataName":"demo","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false},{"metadataName":"demo2","kind":"Deployment","skipMessage":"","occurrences":1,"isSkipped":false}]}]}],"policySummary":{"policyName":"Default","totalRulesInPolicy":23,"totalSkippedRules":0,"totalRulesFailed":7,"totalPassedCount":16},"evaluationSummary":{"configsCount":2,"filesCount":1,"passedYamlValidationCount":1,"k8sValidation":"1/1","passedPolicyValidationCount":0},"yamlValidationResults":null,"k8sValidationResults":null}
To Reproduce
Run the command listed above.
Expected behavior
The output file contains only the json.
Datree version (run datree version):
Version: 1.6.0
Suggested solution:
Disable the spinner when using the -o flag.
Describe the bug When running a test with JSON output, the "Loading..." spinner runs. When writing the output to a file like this:
datree test file.yaml -o json > /dir/output.json
the output.json file looks like this:
To Reproduce Run the command listed above.
Expected behavior The output file contains only the json.
Datree version (run
datree version
):Suggested solution: Disable the spinner when using the -o flag.