VOL-2170 add common method the output GRPC status error
Change-Id: Ibc48cb087cd73f981542bcb137bdb4f213fa7e8d
diff --git a/internal/pkg/commands/components.go b/internal/pkg/commands/components.go
index 4501f1f..203b64d 100644
--- a/internal/pkg/commands/components.go
+++ b/internal/pkg/commands/components.go
@@ -61,20 +61,20 @@
// use the current context in kubeconfig
config, err := clientcmd.BuildConfigFromFlags("", GlobalOptions.K8sConfig)
if err != nil {
- panic(err.Error())
+ Error.Fatalf("Unable to resolve Kubernetes configuration options: %s", err.Error())
}
// create the clientset
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
- panic(err.Error())
+ Error.Fatalf("Unable to create client context for Kubernetes API connection: %s", err.Error())
}
pods, err := clientset.CoreV1().Pods("").List(metav1.ListOptions{
LabelSelector: "app.kubernetes.io/part-of=voltha",
})
if err != nil {
- panic(err.Error())
+ Error.Fatalf("Unexpected error while attempting to query PODs from Kubernetes: %s", err.Error())
}
outputFormat := CharReplacer.Replace(options.Format)