New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kubectl: allow to preselect interesting container in logs #87809
Conversation
/assign @soltysh |
22dfc3a
to
439f93c
Compare
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mfojtik, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/priority backlog |
/retest |
2 similar comments
/retest |
/retest |
/retest |
// container. This gives users ability to preselect the most interesting container in pod. | ||
if annotations := t.GetAnnotations(); annotations != nil && len(opts.Container) == 0 && len(annotations[defaultLogsContainerAnnotationName]) > 0 { | ||
containerName := annotations[defaultLogsContainerAnnotationName] | ||
if exists, _ := findContainerByName(t, containerName); exists != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we exclude init and ephemeral containers or there are some use-cases for them too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, i would leave it to pod creator to define what he think is the most important container logs he want to see.
/test pull-kubernetes-kubemark-e2e-gce-big |
/retest |
kubectl: allow to preselect interesting container in logs Kubernetes-commit: 7e8f31b
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR introduces the
kubectl.kubernetes.io/default-logs-container
annotation that can be placed on aPod
. This annotation will causekubectl logs
to preselect the container specified as value for this annotation. This helps in case the Pod has multiple containers, but only one container is interesting for logs. In that case, users don't have to pick the container name manually, by using the-c
option or--all-containers
.Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: