Skip to content

Commit

Permalink
remove env NODE_NAME
Browse files Browse the repository at this point in the history
Signed-off-by: keyangxie <[email protected]>
  • Loading branch information
xiekeyang committed Jun 3, 2021
1 parent d53f08d commit 3cbc343
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions pkg/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (

"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
Expand Down Expand Up @@ -129,16 +128,9 @@ func (c *CgroupMapper) Process(metrics [][]Metric) error {

func (c *CgroupMapper) getPodInfo() (map[ContainerKey]ContainerInfo, error) {
logrus.Infof("Get Pod and Container Information")
nodeName := os.Getenv("NODE_NAME")
if nodeName == "" {
logrus.Infof("Failed to get node name")
return nil, fmt.Errorf("Failed to get node name")
}
selector := fields.SelectorFromSet(fields.Set{"spec.nodeName": nodeName})

ctx, _ := context.WithCancel(context.Background())
podList, err := c.K8sClient.CoreV1().Pods(v1.NamespaceAll).List(ctx, metav1.ListOptions{
FieldSelector: selector.String(),
LabelSelector: labels.Everything().String(),
ResourceVersion: "0",
})
Expand Down

0 comments on commit 3cbc343

Please sign in to comment.