Skip to content

Commit

Permalink
feat: wip fixing missing details
Browse files Browse the repository at this point in the history
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
  • Loading branch information
AlexsJones committed Mar 27, 2023
1 parent 1bc839c commit 0852c65
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
33 changes: 29 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,36 @@ K8sGPT uses analyzers to triage and diagnose issues in your cluster. It has a se
## Usage

```
# Ensure KUBECONFIG env is set to an active Kubernetes cluster
Kubernetes debugging powered by AI
Usage:
k8sgpt [command]
Available Commands:
analyze This command will find problems within your Kubernetes cluster
auth Authenticate with your chosen backend
completion Generate the autocompletion script for the specified shell
help Help about any command
```

_Run a scan with the default analyzers_

```
k8sgpt auth
k8sgpt find problems
# for more detail
k8s find problems --explain
k8sgpt analyze --explain
```

_Filter on resource_

```
k8sgpt analyze --explain --resource=Service
```

_Output to JSON_

```
k8sgpt analyze --explain --resource=Service --output=json
```

## Upcoming major milestones
Expand Down
8 changes: 7 additions & 1 deletion cmd/analyze/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ var AnalyzeCmd = &cobra.Command{
if len(*analysisResults) > 0 {
bar = progressbar.Default(int64(len(*analysisResults)))
}

// This variable is used to store the results that will be printed
// It's necessary because the heap memory is lost when the function returns
var printOutput []analyzer.Analysis

for _, analysis := range *analysisResults {

if explain {
Expand All @@ -100,10 +105,11 @@ var AnalyzeCmd = &cobra.Command{
analysis.Details = parsedText
bar.Add(1)
}
printOutput = append(printOutput, analysis)
}

// print results
for n, analysis := range *analysisResults {
for n, analysis := range printOutput {

switch output {
case "json":
Expand Down

0 comments on commit 0852c65

Please sign in to comment.