Skip to content

Commit

Permalink
- add watch verb to permissions
Browse files Browse the repository at this point in the history
- log message for uploading pod records

Signed-off-by: Alexei Ledenev <alexei.led@gmail.com>
  • Loading branch information
alexei-led committed May 14, 2023
1 parent b8572fd commit dacc27f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion deploy/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ metadata:
rules:
- apiGroups: [""]
resources: ["pods", "nodes"]
verbs: ["get", "list"]
verbs: ["get", "list" , "watch"]

---

Expand Down
4 changes: 3 additions & 1 deletion internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
}
Expand Down
16 changes: 16 additions & 0 deletions test/check_role.yaml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit dacc27f

Please sign in to comment.