-
Notifications
You must be signed in to change notification settings - Fork 87
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
🌱 Rewrite fetch_target_logs.sh in Golang #1763
base: main
Are you sure you want to change the base?
🌱 Rewrite fetch_target_logs.sh in Golang #1763
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Fix the build, and some comments on top.
test/go.mod
Outdated
@@ -18,6 +18,7 @@ require ( | |||
k8s.io/apimachinery v0.29.5 | |||
k8s.io/client-go v0.29.5 | |||
k8s.io/klog/v2 v2.110.1 | |||
k8s.io/kubectl v0.29.3 |
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.
Match the version with other k8s.io deps, ie. v0.29.5
.
test/e2e/fetch_target_logs.go
Outdated
} | ||
defer podLogs.Close() | ||
|
||
// Read the logs into a string |
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.
This only reads stdout
. Original script reads also stderr
.
test/e2e/fetch_target_logs.go
Outdated
// kubectl --kubeconfig="${KUBECONFIG_WORKLOAD}" describe pods -n "${NAMESPACE}" "${POD}" | ||
describerSettings := describe.DescriberSettings{ | ||
ShowEvents: true, | ||
|
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.
empty line
test/e2e/fetch_target_logs.go
Outdated
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
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.
Would you add here also equivalent of kubectl --kubeconfig .... get pods -A
before namespace iteration, we've been missing that.
Follow-up PR is also OK, but since you want to get this merged before vacations, adding it here makes sense.
1f60260
to
bb6e1ab
Compare
/test metal3-centos-e2e-integration-test-main |
/test ? |
@peppi-lotta: The following commands are available to trigger required jobs:
The following commands are available to trigger optional jobs:
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
test/e2e/fetch_target_logs.go
Outdated
"k8s.io/kubectl/pkg/describe" | ||
) | ||
|
||
func FetchTargetLogs() { |
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.
func FetchTargetLogs() { | |
func FetchLogs(clusterProxy framework.ClusterProxy) { |
We can pass clusterProxy and make this function reusable. If in the future we want to collect logs from some other cluster it will be very helpful.
Let's also implement CAPI CollectInfrastructureLogs on our side in this PR. |
bb6e1ab
to
508874b
Compare
b0362fc
to
17bd439
Compare
/test ? |
@peppi-lotta: The following commands are available to trigger required jobs:
The following commands are available to trigger optional jobs:
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/test metal3-ubuntu-e2e-feature-test-main-pivoting |
7979c3a
to
64f1b6d
Compare
/test metal3-ubuntu-e2e-feature-test-main-pivoting |
1 similar comment
/test metal3-ubuntu-e2e-feature-test-main-pivoting |
64f1b6d
to
5ca9936
Compare
/test metal3-ubuntu-e2e-feature-test-main-pivoting |
1 similar comment
/test metal3-ubuntu-e2e-feature-test-main-pivoting |
Periodic pivoting test has not passed in 27 days, not sure if its worth running unless it is specifically triggering and failing to somehting you created in this PR. |
bece774
to
d081c3a
Compare
/test metal3-ubuntu-e2e-integration-test-main |
It's looking good. A few improvements that we made in the log collection:
let's skip infrastructure logs for now. |
53cab2a
to
df6e0bc
Compare
/test metal3-ubuntu-e2e-integration-test-main |
df6e0bc
to
149df7d
Compare
/test metal3-ubuntu-e2e-integration-test-main |
@peppi-lotta: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Signed-off-by: peppi-lotta <[email protected]>
149df7d
to
6d6cb21
Compare
/test metal3-ubuntu-e2e-integration-test-main |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
1 similar comment
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What this PR does / why we need it: Running an sh file from go file will gives warning: G204: Audit use of command execution. In this PR I've rewritten the fetch_target_logs.sh in Go to avoid getting this warning.
Compared to the original: I've added
kubect get pods -A
and removed the split between stdout and stderr in the logs. Some of the logs had warning
and based on further investigation it seems Kubernetes only has one API endpoint for logs and everything is logged into stdout.