diff --git a/cluster/info.go b/cluster/info.go index 7ef41cd..516bbc0 100644 --- a/cluster/info.go +++ b/cluster/info.go @@ -40,6 +40,7 @@ func (info *Info) Apply(applyable ...Applyable) { // PodInfo is summary details for a pod. type PodInfo struct { + Annotations map[string]string `json:",omitempty"` ChartVersion string Containers []ContainerInfo LinkedConfigMaps []LinkedConfigMap diff --git a/cluster/kubernetes.go b/cluster/kubernetes.go index 3a4698a..6414da8 100644 --- a/cluster/kubernetes.go +++ b/cluster/kubernetes.go @@ -4,9 +4,10 @@ import ( "context" "encoding/json" "fmt" - "k8s.io/apimachinery/pkg/version" "time" + "k8s.io/apimachinery/pkg/version" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" @@ -179,7 +180,9 @@ func (q *KubernetesQuery) AllPods() ([]PodInfo, error) { } for _, pod := range pods.Items { + info := PodInfo{ + Annotations: pod.Annotations, ChartVersion: pod.Labels["app.kubernetes.io/version"], Host: pod.Status.HostIP, IsRunning: pod.Status.Phase == v1.PodRunning, diff --git a/cmd/envcheckctl/exec_inspect.go b/cmd/envcheckctl/exec_inspect.go index 0ea7df9..10bb3da 100644 --- a/cmd/envcheckctl/exec_inspect.go +++ b/cmd/envcheckctl/exec_inspect.go @@ -41,7 +41,7 @@ func ExecInspect(config EnvcheckConfig) { log.Fatalln(err) } log.Printf("podfile=%s", filename) - } else if config.Podfile != "" { + } else { r, err := os.Open(config.Podfile) if err != nil { log.Fatalf("open=failed file=%s err='%v'\n", config.Podfile, err)