Skip to content

Commit

Permalink
removing hardcoded path
Browse files Browse the repository at this point in the history
  • Loading branch information
framsouza committed Jul 27, 2022
1 parent 3c4dd56 commit 502131b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
12 changes: 7 additions & 5 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ func main() {

func summary() {
fmt.Print("\n\nBASED ON THE OUTPUT ABOVE, MAKE SURE THAT:\n")
fmt.Print("- All the Elasticsearch services has an endpoint attached to it\n")
fmt.Print("- The Elasticsearch services has an endpoint attached to it, if there's no endpoint the services won't be able to connect to the pods\n")
fmt.Print("- All the PVC has a Bound status\n")
fmt.Print("- All the Elasticsearch Resources are Green and the Phase is \"READY\"\n")
fmt.Print("- All the Kibana Resources are Green and the Phase is \"READY\" or \"ESTABLISHED\"\n")
fmt.Print("- Every pod is RUNNING\n")
fmt.Print("- Every pod has the same MEM REQUEST & MEM LIMIT\n\n")
fmt.Print("- All the Elasticsearch Resources are Green and the Phase is \"READY\", if the status is \"ApplyingChanges\" check the Operator logs\n")
fmt.Print("- All the Kibana Resources are Green and the Phase is \"READY\" or \"ESTABLISHED\", if the status is \"ApplyingChanges\" check the Operator logs\n")
fmt.Print("- All the Elasticsearch and Kibana pods has the RUNNING status, if not, check the pod logs\n")
fmt.Print("- All the Elasticsearch has the same MEM REQUEST & MEM LIMIT, it's very important to ensure quality of Serivce\n")
fmt.Print("- Starting with Elasticsearch 7.11, unless manually overridden, heap size is automatically calculated based on the available memory, if the HEAP SIZE column is empty for the Elasticsearch statefulsets, make sure Elasticsearch is >7.11\n")
fmt.Print("- If you desire to increase the disk size, make sure you are ran the latest ECK diagnostics and check the if ALLOW EXPANSION is true, if that is the case you can easily change the PVC volume size in the Elasticsearch manifest \n\n")

}
6 changes: 3 additions & 3 deletions pkg/resources/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ func Deployment() {
abspath, _ := handlingfiles.FindFileAbsPathDeploy(extract.Destination, "deployments.json")

for _, f := range abspath {
//if f == extract.Destination+"/kube-system/deployments.json" {
// break
//}
if f == extract.Destination+"/kube-system/deployments.json" {
break
}
if f == extract.Destination+"/istio-system/deployments.json" {
break
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/resources/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func Pods() {

config, _ := load.LoadPods(f)

fmt.Fprintf(w, "\n\n%s\t\t%s\t\t%s\t\t%s\t\t%s\t\t%s\t\t%s\t\t", "PODS NAME", "NAMESPACE", "STATUS", "MEM REQUEST", "MEM LIMIT", "CPU REQUEST", "CPU LIMIT")
fmt.Fprintf(w, "\n\n%s\t\t%s\t\t%s\t\t%s\t\t%s\t\t%s\t\t%s\t\t%s\t\t", "PODS NAME", "NAMESPACE", "STATUS", "MEM REQUEST", "MEM LIMIT", "CPU REQUEST", "CPU LIMIT", "NODE NAME")

for i := range config.Items {
fmt.Fprintf(w, "\n%s\t", config.Items[i].Metadata.Name)
Expand Down Expand Up @@ -54,6 +54,8 @@ func Pods() {
fmt.Fprintf(w, "\t%s\t", config.Items[i].Spec.Containers[0].Resources.Limits.Cpu)

}
fmt.Fprintf(w, "\t%s\t", config.Items[i].Spec.NodeName)

}

//Check initcontainers
Expand Down
17 changes: 9 additions & 8 deletions pkg/resources/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@ import (
"bytes"
"fmt"
"io/ioutil"
"os"
"text/tabwriter"

extract "github.com/framsouza/eck-diagnostics-parser/pkg/extract"
load "github.com/framsouza/eck-diagnostics-parser/pkg/load"
)

func DiagV() {
w := new(tabwriter.Writer)
w.Init(os.Stdout, 8, 8, 0, '\t', 0)
defer w.Flush()
diagv := extract.Destination + "/version.json"

config, _ := load.LoadDiagV("/Users/francismarasouza/finding-file/tmp/version.json")
config, _ := load.LoadDiagV(diagv)
fmt.Println("\nDiagnostic version is", config.DiagnosticsVersion.Version)

}

func ECKV() {
var version string
b, e := ioutil.ReadFile("/Users/francismarasouza/finding-file/tmp/eck-diagnostics.log")
eckv := extract.Destination + "/eck-diagnostics.log"

b, e := ioutil.ReadFile(eckv)
if e != nil {
panic(e)
}
Expand All @@ -34,7 +33,9 @@ func ECKV() {
}

func Collection() {
config, _ := load.LoadManifest("/Users/francismarasouza/unzip-go/manifest.json")
collec := extract.Destination + "/manifest.json"

config, _ := load.LoadManifest(collec)
fmt.Println("Diagnostic Collection date is", config.CollectionDate)

}

0 comments on commit 502131b

Please sign in to comment.