Skip to content

Separate Linux and Windows node log collection - #165

Merged
openshift-merge-robot merged 1 commit into
openshift:masterfrom
sebsoto:add_windows_log_collection
Aug 3, 2020
Merged

Separate Linux and Windows node log collection#165
openshift-merge-robot merged 1 commit into
openshift:masterfrom
sebsoto:add_windows_log_collection

Conversation

@sebsoto

@sebsoto sebsoto commented Jul 30, 2020

Copy link
Copy Markdown
Contributor

The '-u' flag for 'oc adm node-logs' cannot be used against Windows
nodes. This commit ensures that the '-u' method of collection is only
used for services running on Linux nodes, and the '--path' option is
used for collecting Windows node log files.

@sebsoto
sebsoto force-pushed the add_windows_log_collection branch from 7b47dd9 to 8d46d12 Compare July 30, 2020 17:18

@sferich888 sferich888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@davemulford can you review this too.
I think we could simplify this (reduce the number of scripts needed here), if we leverage the -l flag better.

for service in ${NODE_SERVICES[@]}; do
echo "INFO: Collecting host service logs for $service"
/usr/bin/oc adm node-logs --role=$1 -u $service > ${DIR_PATH}/${service}_service.log &
/usr/bin/oc adm node-logs --role=$1 -l kubernetes.io/os=linux -u $service > ${DIR_PATH}/${service}_service.log &

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use one or more labels here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes a comma separated list can be used

@@ -0,0 +1,22 @@
#!/bin/bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of this; would it be better to just merge this into one bash script and select the things we want using labels?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Most of the Linux log collection relies on the fact that the service logs being collected are from journald. This is not the case for Windows, and why I felt it made sense to seperate them

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We are missing container runtime, logs (docker), as well as kublet how do we get those added?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I saw that we were only collecting Kubelet logs for master nodes for Linux, and as Windows nodes can only be workers, I removed the kubelet logs from the collected log list.
I can add it back if that would be desirable.

As for Docker logs, that actually is logged to a directory that isn't reachable by oc adm node-logs and changing that logging directory isn't currently within scope of the Windows Machine Config Operator.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We want to collect everything required to debug what is happening on the node (service logs wise); as it pertains to OpenShift. So I think we want to collect at the very least the container runtime and the kublet process logs (thinks that are installed outside of OpenShift that are pre-requisites for OpenShift to run or be connected to the cluster). .

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@sferich888 collecting kubelet logs is doable. But as @sebsoto mentioned, collecting the Docker logs will be difficult. Please open an issue on our board so that we can track this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've added the kubelet log.

The issue with the Docker logs is that the logging location for that is not under our control. Our product asks that our users bring their own Windows VM image, with docker pre-installed. We'd either have to increase the customer requirements, or investigate reconfiguring Docker.

PIDS+=($!)

oc adm node-logs --role="worker" -u crio | \
oc adm node-logs --role="worker" -l kubernetes.io/os=linux -u crio | \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we want this here, as we want to get logs in this situation from any place where OVN is installed, not just on linux.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For OVN onn Windows, there is a Windows service named hybrid-overlay.exe instead. the -u option does not work on windows as well, as that is specific to journald, which windows does not have

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't oc adm node-logs account for this? Is this a bug / issue we should address in that command?

@sebsoto sebsoto Jul 30, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would not consider it a bug, as there really isn't a way to get it to work on Windows. The closest parallel to journald would be the Windows Event Viewer, but none of the Windows Kubernetes components are logging to that.

@sebsoto
sebsoto force-pushed the add_windows_log_collection branch from 8d46d12 to 8d8f26f Compare July 30, 2020 18:29
@sdodson

sdodson commented Jul 30, 2020

Copy link
Copy Markdown
Member

/lgtm
This looks like a step in the right direction and given the constraints we're working under with respect to Docker installation and configuration this may be the best we can do right now.

@sferich888 @davemulford I'd appreciate if you approved this.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 30, 2020
@@ -0,0 +1,22 @@
#!/bin/bash
BASE_COLLECTION_PATH="/must-gather"
WINDOWS_NODE_LOGS=$BASE_COLLECTION_PATH/windows

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we want to update https://github.com/openshift/must-gather/blob/master/collection-scripts/gather_service_logs#L13 to say ${BASE_COLLECTION_PATH}/host_service_logs/linux, and then the referenced line can read ${BASE_COLLECTION_PATH}/host_service_logs/windows Thus helping with the find-ability and placement consistency of the logs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, having uniformly named directories would benefit both customers and support. We should definitely have this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have made this change

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think given we have both tests and users expecting to find linux logs in one location today we should leave that unchanged but write out windows logs, which are net new, to a new location. So lets revert the relocation of linux logs.

@sferich888

Copy link
Copy Markdown
Contributor

/lgtm
This looks like a step in the right direction and given the constraints we're working under with respect to Docker installation and configuration this may be the best we can do right now.

@sferich888 @davemulford I'd appreciate if you approved this.

So after looking into this more, I don't think this PR will work? But I could be wrong.

The way we get logs from nodes is done with a
carry patch on the kubelet.

As I understand it, the window nodes will use an upstream kubelet, and as such the method or approach to getting node logs will not be available on windows.

Does anyone know, how / what API oc adm node-logs is connecting to on a window node?

@sebsoto

sebsoto commented Jul 31, 2020

Copy link
Copy Markdown
Contributor Author

@sferich888 I have confirmed that it does work, to answer your question for why it works I am looking into that

@sebsoto

sebsoto commented Jul 31, 2020

Copy link
Copy Markdown
Contributor Author

@sferich888 That carry patch seems to be specific to the -u node-logs option, we are using --path.

@aravindhp

Copy link
Copy Markdown

@sferich888 the carry patch is for Provide an administrator a streaming view of journal logs without them having to implement a client side reader. Only available to cluster admins.. There is no concept of a journal log in Windows. We are using oc adm node-logs --path to work around it.

@sferich888

Copy link
Copy Markdown
Contributor

@aravindhp yes, but I think oc adm node-logs --path still uses the shim (carry patch) to get at the hosts logs (correct)? @smarterclayton

@aravindhp

Copy link
Copy Markdown

@sferich888 oc adm node-logs --path is something we can confirm is working with an upstream kubelet running on a Windows node. And for the product due to another carry patch openshift/kubernetes#301 and release requirements we will be switching to a downstream kubelet for Windows also.

@sebsoto
sebsoto force-pushed the add_windows_log_collection branch from 8d8f26f to 13edb19 Compare July 31, 2020 16:42
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 31, 2020
@davemulford

Copy link
Copy Markdown
Contributor

Thanks for the quick changes @sebsoto.

This looks fine to me, @sferich888 what do you think?

/LGTM

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 31, 2020
@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@sferich888

Copy link
Copy Markdown
Contributor

/lgtm

I am reluctantly approving this (only because I feel its not enough), outside of that the PR looks fine provided the shims work on windows.
To make sure we don't loose sight of the minimum requirements for a positive customer experience we need to tread https://bugzilla.redhat.com/show_bug.cgi?id=1862643 and a release/feature blocker bug, and look at adding the missing log collection quickly.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

4 similar comments
@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

14 similar comments
@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@sdodson

sdodson commented Aug 3, 2020

Copy link
Copy Markdown
Member

@sebsoto Test failure looks legitimate so we're losing crio logs for some reason.

STEP: Destroying namespace "e2e-test-oc-adm-must-gather-8jkq2" for this suite.
Aug  3 11:14:19.516: INFO: Running AfterSuite actions on all nodes
Aug  3 11:14:19.516: INFO: Running AfterSuite actions on node 1
fail [github.com/openshift/origin@/test/extended/cli/mustgather.go:95]: Expected
    <string>: /tmp/test.oc-adm-must-gather.195409629/registry-svc-ci-openshift-org-ci-op-myszpvy0-stable-sha256-b2b88645ed01f2028b807015ad7eefc06b48e3a9f58cb884e01ee19c8ead9f27/host_service_logs/masters/crio_service.log
to exist

@sdodson

sdodson commented Aug 3, 2020

Copy link
Copy Markdown
Member

/lgtm cancel

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2020
@sebsoto

sebsoto commented Aug 3, 2020

Copy link
Copy Markdown
Contributor Author

@sdodson There seems to be a repo race condition here. I was asked to change the directory structure, which moved the linux logs into an unexpected place for this test: https://github.com/openshift/origin/blob/master/test/extended/cli/mustgather.go#L75.

I cant change this repo unless that repo's test is changed, and I cant change that repo's test until this repo is changed.

@sebsoto

sebsoto commented Aug 3, 2020

Copy link
Copy Markdown
Contributor Author

The test expects log files in: {pluginOutputDir, "host_service_logs", "masters", "crio_service.log"}, my changes moved them to {pluginOutputDir, "host_service_logs", "linux", "masters", "crio_service.log"}

@sebsoto
sebsoto force-pushed the add_windows_log_collection branch 2 times, most recently from 44d0e87 to c1706b6 Compare August 3, 2020 16:33
The '-u' flag for 'oc adm node-logs' cannot be used against Windows
nodes. This commit ensures that the '-u' method of collection is only
used for services running on Linux nodes, and the '--path' option is
used for collecting Windows node log files.
@sebsoto
sebsoto force-pushed the add_windows_log_collection branch from c1706b6 to f7973c8 Compare August 3, 2020 16:33
@sdodson

sdodson commented Aug 3, 2020

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2020
@openshift-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: davemulford, sdodson, sebsoto, sferich888

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants