Skip to content
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

Cherry-pick #2490 Make a copy of MachineInfo in GetMachineInfo() to v0.35 #2672

Merged
merged 3 commits into from
Nov 5, 2020

Conversation

odinuge
Copy link
Contributor

@odinuge odinuge commented Sep 15, 2020

Ref. discussion in k/k here: kubernetes/kubernetes#94176

@google-cla
Copy link

google-cla bot commented Sep 15, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@k8s-ci-robot
Copy link
Collaborator

Hi @odinuge. Thanks for your PR.

I'm waiting for a google member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@odinuge
Copy link
Contributor Author

odinuge commented Sep 15, 2020

Ping @tedyu ^^

/cc @dashpole

@@ -177,6 +177,35 @@ func expectManagerWithContainersV2(containers []string, query *info.ContainerInf
return m, infosMap, handlerMap
}

func TestMachineInfoReturnValue(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this test from some other PR? or new code? In https://github.com/google/cadvisor/pull/2490/files I only see topology tests extended.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, as you see in the commit log, it is is a separate test to avoid regressions. Open on splitting that to a separate PR or something, as it doesn't matter that much to me. All the tests have changed quite a bit, so it was impossible to cherry-pick back the test from the original PR.

We can just do a simple copy := *m.machineInfo instead of cherry-picking the commit, but I think @tedyu deserves the credit for the fix.

@dashpole
Copy link
Collaborator

/ok-to-test

@odinuge
Copy link
Contributor Author

odinuge commented Sep 15, 2020

/retest

2 similar comments
@odinuge
Copy link
Contributor Author

odinuge commented Sep 16, 2020

/retest

@SergeyKanzhelev
Copy link
Collaborator

/retest

@dashpole
Copy link
Collaborator

It looks like the test won't pass without some changes to the test scripts here. I'm OK with that, and will merge even if the e2e test fails. But I can't merge without the original author's consent.

@odinuge
Copy link
Contributor Author

odinuge commented Sep 21, 2020

Ping @tedyu

@odinuge odinuge force-pushed the machine-info-backport-v0.35 branch from 5ecdd66 to c9b0c29 Compare October 4, 2020 10:24
@google-cla google-cla bot added the cla: yes label Oct 4, 2020
@odinuge
Copy link
Contributor Author

odinuge commented Oct 29, 2020

Made a new commit with a shallow copy instead, so all cla stuff should be good to go now!

/assign @bobbypage

@bobbypage
Copy link
Collaborator

/test pull-cadvisor-e2e

@bobbypage bobbypage self-assigned this Nov 4, 2020
@bobbypage
Copy link
Collaborator

hmm, CI is failing with

W1104 23:02:32.262] 2020/11/04 23:02:32 main.go:316: Something went wrong: encountered 1 errors: [error during go run /go/src/k8s.io/kubernetes/test/e2e_node/runner/remote/run_remote.go --cleanup --logtostderr --vmodule=*=4 --ssh-env=gce --results-dir=/workspace/_artifacts --project=cadvisor-e2e --zone=us-central1-f --ssh-user=prow --ssh-key=/workspace/.ssh/google_compute_engine --ginkgo-flags=--nodes=1 --test_args= --test-timeout=10m0s --image-config-file=/workspace/test-infra/jobs/e2e_node/image-config.yaml --test-suite=cadvisor: exit status 1]
W1104 23:02:32.269] Traceback (most recent call last):
W1104 23:02:32.269]   File "/workspace/./test-infra/jenkins/../scenarios/kubernetes_e2e.py", line 720, in <module>
W1104 23:02:32.269]     main(parse_args())
W1104 23:02:32.269]   File "/workspace/./test-infra/jenkins/../scenarios/kubernetes_e2e.py", line 570, in main
W1104 23:02:32.269]     mode.start(runner_args)
W1104 23:02:32.270]   File "/workspace/./test-infra/jenkins/../scenarios/kubernetes_e2e.py", line 228, in start
W1104 23:02:32.270]     check_env(env, self.command, *args)
W1104 23:02:32.270]   File "/workspace/./test-infra/jenkins/../scenarios/kubernetes_e2e.py", line 111, in check_env
W1104 23:02:32.270]     subprocess.check_call(cmd, env=env)
W1104 23:02:32.270]   File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
W1104 23:02:32.271]     raise CalledProcessError(retcode, cmd)
W1104 23:02:32.271] subprocess.CalledProcessError: Command '('kubetest', '--dump=/workspace/_artifacts', '--gcp-service-account=/etc/service-account/service-account.json', '--up', '--down', '--test', '--deployment=node', '--provider=gce', '--cluster=bootstrap-e2e', '--gcp-network=bootstrap-e2e', '--gcp-project=cadvisor-e2e', '--gcp-zone=us-central1-f', '--node-args=--image-config-file=/workspace/test-infra/jobs/e2e_node/image-config.yaml --test-suite=cadvisor', '--node-tests=true', '--test_args=--nodes=1', '--timeout=10m')' returned non-zero exit status 1
E1104 23:02:32.283] Command failed
I1104 23:02:32.284] process 521 exited with code 1 after 2.5m
E1104 23:02:32.284] FAIL: pull-cadvisor-e2e

is this related to change here as mentioned in #2672 (comment)?

This test is fine on testgrid though: https://testgrid.k8s.io/sig-node-cadvisor#cadvisor-e2e

@dashpole
Copy link
Collaborator

dashpole commented Nov 4, 2020

++ git diff --name-only pages
W1104 23:00:54.073] + [[ ! -z pages/static/assets.go
W1104 23:00:54.073] pages/templates.go ]]
W1104 23:00:54.074] + echo 'Found changes to UI assets:'
W1104 23:00:54.074] + git diff --name-only pages
W1104 23:00:54.112] + echo 'Run: '''make assets FORCE=true''''
W1104 23:00:54.112] + exit 1
I1104 23:00:54.212] Found changes to UI assets:
I1104 23:00:54.213] pages/static/assets.go
I1104 23:00:54.213] pages/templates.go
I1104 23:00:54.213] Run: 'make assets FORCE=true'

@bobbypage
Copy link
Collaborator

ah, but this PR didn't update any of assets / pages as I can see... or does it simply need a rebase?

@dashpole
Copy link
Collaborator

dashpole commented Nov 4, 2020

IIRC, the assets include the year they were built in. It might be from that. E.g. #2370

@bobbypage
Copy link
Collaborator

bobbypage commented Nov 4, 2020

thanks for the tip, Created #2708 to update the asset file which I'm guessing should fix the test failure here.

@bobbypage
Copy link
Collaborator

bobbypage commented Nov 4, 2020

actually scratch that, the error looks like from the copyright years as @dashpole mentioned in #2672 (comment).

@odinuge Can you run

FORCE=true build/assets.sh

on your PR? It should update the copyright years and unblock the test:

$ git diff
diff --git a/pages/static/assets.go b/pages/static/assets.go
index 5c6f2070..fd946774 100644
--- a/pages/static/assets.go
+++ b/pages/static/assets.go
@@ -1,4 +1,4 @@
-// Copyright 2019 Google Inc. All Rights Reserved.
+// Copyright 2020 Google Inc. All Rights Reserved.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/pages/templates.go b/pages/templates.go
index 317dff2b..a3dfcaf9 100644
--- a/pages/templates.go
+++ b/pages/templates.go
@@ -1,4 +1,4 @@
-// Copyright 2019 Google Inc. All Rights Reserved.
+// Copyright 2020 Google Inc. All Rights Reserved.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.

@odinuge odinuge force-pushed the machine-info-backport-v0.35 branch from 41f9f4f to 8ddb4e2 Compare November 5, 2020 14:45
@bobbypage
Copy link
Collaborator

Thanks @odinuge, CI is green now.

@bobbypage bobbypage merged commit 92d49a1 into google:release-v0.35 Nov 5, 2020
@bobbypage
Copy link
Collaborator

@odinuge I cut a new cadvisor release to include this cherrypick -- https://github.com/google/cadvisor/releases/tag/v0.35.1

Let me know if you need anything else from my side.

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

Successfully merging this pull request may close these issues.

5 participants