Skip to content

Commit

Permalink
Add annotations to PodInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Fisher authored and Nathan Fisher committed Nov 2, 2023
1 parent c64cce6 commit 431c533
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions cluster/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion cluster/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion cmd/envcheckctl/exec_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 431c533

Please sign in to comment.