kubectl: allow to preselect interesting container in logs - #87809
Conversation
|
/assign @soltysh |
22dfc3a to
439f93c
Compare
|
/retest |
|
[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 DetailsNeeds 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.
Should we exclude init and ephemeral containers or there are some use-cases for them too?
There was a problem hiding this comment.
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
kubectl: allow to preselect interesting container in logs
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-containerannotation that can be placed on aPod. This annotation will causekubectl logsto 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-coption or--all-containers.Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: