-
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-features |
17bd439
to
944ae12
Compare
/test metal3-ubuntu-e2e-feature-test-main-pivoting After running this test there should be a k8_target_cluster directory in the logs. If it looks as it should (same as before except for a few minor changes) this PR's code is working correctly. |
Signed-off-by: peppi-lotta <peppi-lotta.saari@est.tech>
944ae12
to
af9d0a8
Compare
/test metal3-ubuntu-e2e-feature-test-main-pivoting |
@peppi-lotta: The following test failed, say
Full PR test history. Your PR dashboard. 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. |
/test metal3-centos-e2e-integration-test-main |
In the logs-jenkins-metal3-ubuntu-e2e-feature-test-main-pivoting-4-pivoting-based.tgz the logs in directory Please take a look @adilGhaffarDev @mboukhalfa @Sunnatillo. This needs a lgtm and approve. Thank you! |
/test metal3-e2e-clusterctl-upgrade-test-main |
It looks good. I want to see how this will work when we have multiple management clusters, like how we have in clusterctl tests. |
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.