Skip to content

Log init containers and remove previous flag #393

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

Merged
merged 3 commits into from
Aug 29, 2019

Conversation

vishalbollu
Copy link
Contributor

Closes #324

Checklist:

  • Run make test and make lint
  • Test end to end manually (e.g. build/push all images, restart operator, and run cx refresh)
  • Update examples
  • Update documentation (add any new files to summary.md)
  • Merge to master
  • Cherry-pick into release branches if it's a bugfix
  • Check gitbook that docs look good and links function properly
  • Alert team if dev environment changed
  • Delete the branch once it's merged

@vishalbollu vishalbollu requested a review from deliahu August 28, 2019 17:36
processToKill.Kill()
func GetContainerLogs(pod kcore.Pod) strset.Set {
containerStatuses := pod.Status.InitContainerStatuses
containerStatuses = append(containerStatuses, pod.Status.ContainerStatuses...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This can be containerStatuses = append(pod.Status.InitContainerStatuses, pod.Status.ContainerStatuses...)

if status.State.Terminated != nil && (status.State.Terminated.ExitCode != 0 || status.State.Terminated.StartedAt.After(time.Now().Add(-newPodCheckInterval))) {
set.Add(GetLogKey(pod, status).String())
}
if status.State.Running != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: might as well make this an else if? not a big deal, whatever you think is best/clearest

if err != nil {
for _, processToKill := range processList {
processToKill.Kill()
func GetContainerLogs(pod kcore.Pod) strset.Set {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you think of a better name for this function?

func GetContainerLogs(pod kcore.Pod) strset.Set {
containerStatuses := pod.Status.InitContainerStatuses
containerStatuses = append(containerStatuses, pod.Status.ContainerStatuses...)
set := strset.New()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "set" -> "logKeys"?

@vishalbollu vishalbollu merged commit ee4ec61 into master Aug 29, 2019
@vishalbollu vishalbollu deleted the log-all-containers-in-pod branch August 29, 2019 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve container logging
2 participants