diff --git a/deploy/rbac.yaml b/deploy/rbac.yaml index 2774806..ac66a09 100644 --- a/deploy/rbac.yaml +++ b/deploy/rbac.yaml @@ -27,7 +27,7 @@ metadata: rules: - apiGroups: [""] resources: ["pods", "nodes"] - verbs: ["get", "list"] + verbs: ["get", "list" , "watch"] --- diff --git a/internal/controller/controller.go b/internal/controller/controller.go index 135f12f..7838ba6 100644 --- a/internal/controller/controller.go +++ b/internal/controller/controller.go @@ -74,6 +74,7 @@ func (s *scanner) Run(ctx context.Context, log *logrus.Entry, nodeInformer Nodes beginTime := endTime.Add(-60 * time.Minute) record := usage.NewPodInfo(pod, beginTime, endTime, node) // upload the record to EKS Lens + log.WithField("pod", record.Name).Debug("uploading one pod record to EKS Lens") err := s.uploader.UploadOne(ctx, record) if err != nil { log.WithError(err).Error("uploading pod") @@ -116,7 +117,8 @@ func (s *scanner) Run(ctx context.Context, log *logrus.Entry, nodeInformer Nodes records = append(records, record) } // upload the records to EKS Lens - err := s.uploader.Upload(ctx, records) + log.WithField("count", len(records)).Debug("uploading pod records to EKS Lens") + err = s.uploader.Upload(ctx, records) if err != nil { log.WithError(err).Error("uploading pods to EKS Lens") } diff --git a/test/check_role.yaml b/test/check_role.yaml new file mode 100644 index 0000000..afe9a5b --- /dev/null +++ b/test/check_role.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Pod +metadata: + name: awscli-pod + namespace: eks-lens +spec: + serviceAccountName: eks-lens-agent + restartPolicy: Never + containers: + - name: awscli + image: amazon/aws-cli + command: + - "/bin/sh" + args: + - "-c" + - "aws sts get-caller-identity"