-
Notifications
You must be signed in to change notification settings - Fork 149
Closed
Labels
kind/bugSomething isn't workingSomething isn't working
Description
What happened:
Stern shows the same logs multiple times when a container is terminated.
$ stern --container-state running --container-state terminated myjob
+ myjob-xz9vh › myjob
myjob-xz9vh myjob done
- myjob-xz9vh › myjob
+ myjob-xz9vh › myjob
myjob-xz9vh myjob done
- myjob-xz9vh › myjob
+ myjob-xz9vh › myjob
myjob-xz9vh myjob done
What you expected to happen:
Logs should be shown only once.
How to reproduce it (as minimally and precisely as possible):
- Run stern with
--container-state
flags.
stern --container-state running --container-state terminated myjob
- Create a job that will immediately complete with a log "done".
kubectl create job myjob --image busybox -- echo "done"
- The same logs are shown multiple times.
$ stern --container-state running --container-state terminated myjob
+ myjob-xz9vh › myjob
myjob-xz9vh myjob done
- myjob-xz9vh › myjob
+ myjob-xz9vh › myjob
myjob-xz9vh myjob done
- myjob-xz9vh › myjob
+ myjob-xz9vh › myjob
myjob-xz9vh myjob done
Anything else we need to know?:
The tails of terminated containers will be inactive immediately, so they will be added back again when stern handles modified events. I think that is why the same logs are shown multiple times.
Maybe stern should ignore terminated
containers on modified events.
Environment:
- stern version (use
stern --version
): 1.22.0 - OS (e.g:
cat /etc/os-release
): macOS 12.2 - Install tools (e.g: Homebrew) Homebrew
- Others:
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingSomething isn't working