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

pkg/k8s: use node name from pkg/node instead of env variable #11834

Merged
merged 1 commit into from Jun 3, 2020

Conversation

aanm
Copy link
Member

@aanm aanm commented Jun 2, 2020

The node name in the pkg/node is set at init() time so there is not
point on setting this package variable all over the code.

Fixes: 3533fd3 ("pkg/node: give priority to nodeName from K8S_NODE_NAME env variable")
Signed-off-by: André Martins andre@cilium.io

EDIT: Actually I think it's another occurrence caused by #11836

Fixes:

2020-06-02T16:10:15.813451601Z WARNING: DATA RACE
2020-06-02T16:10:15.813457516Z Read at 0x000004e9b100 by goroutine 165:
2020-06-02T16:10:15.813461237Z   github.com/cilium/cilium/pkg/node/types.(*Node).IsLocal()
2020-06-02T16:10:15.813464571Z       /go/src/github.com/cilium/cilium/pkg/node/types/node.go:360 +0x1ae
2020-06-02T16:10:15.81346792Z   github.com/cilium/cilium/pkg/k8s/watchers.(*K8sWatcher).ciliumNodeInit.func2()
2020-06-02T16:10:15.813471331Z       /go/src/github.com/cilium/cilium/pkg/k8s/watchers/cilium_node.go:70 +0x20b
2020-06-02T16:10:15.813487405Z   k8s.io/client-go/tools/cache.ResourceEventHandlerFuncs.OnUpdate()
2020-06-02T16:10:15.813500515Z       /go/src/github.com/cilium/cilium/vendor/k8s.io/client-go/tools/cache/controller.go:225 +0xa5
2020-06-02T16:10:15.81350407Z   k8s.io/client-go/tools/cache.(*ResourceEventHandlerFuncs).OnUpdate()
2020-06-02T16:10:15.813524008Z       <autogenerated>:1 +0x2e
2020-06-02T16:10:15.813527837Z   github.com/cilium/cilium/pkg/k8s/informer.NewInformerWithStore.func1()
2020-06-02T16:10:15.813531055Z       /go/src/github.com/cilium/cilium/pkg/k8s/informer/informer.go:113 +0x372
2020-06-02T16:10:15.813534135Z   k8s.io/client-go/tools/cache.(*DeltaFIFO).Pop()
2020-06-02T16:10:15.813537208Z       /go/src/github.com/cilium/cilium/vendor/k8s.io/client-go/tools/cache/delta_fifo.go:492 +0x396
2020-06-02T16:10:15.813540559Z   k8s.io/client-go/tools/cache.(*controller).processLoop()
2020-06-02T16:10:15.813543639Z       /go/src/github.com/cilium/cilium/vendor/k8s.io/client-go/tools/cache/controller.go:173 +0x83
2020-06-02T16:10:15.813546932Z   k8s.io/client-go/tools/cache.(*controller).processLoop-fm()
2020-06-02T16:10:15.813550216Z       /go/src/github.com/cilium/cilium/vendor/k8s.io/client-go/tools/cache/controller.go:171 +0x41
2020-06-02T16:10:15.813553842Z   k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1()
2020-06-02T16:10:15.813556947Z       /go/src/github.com/cilium/cilium/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:155 +0x75
2020-06-02T16:10:15.813560246Z   k8s.io/apimachinery/pkg/util/wait.BackoffUntil()
2020-06-02T16:10:15.813563444Z       /go/src/github.com/cilium/cilium/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:156 +0xb3
2020-06-02T16:10:15.813566656Z   k8s.io/apimachinery/pkg/util/wait.JitterUntil()
2020-06-02T16:10:15.813569765Z       /go/src/github.com/cilium/cilium/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133 +0x10d
2020-06-02T16:10:15.81357308Z   k8s.io/apimachinery/pkg/util/wait.Until()
2020-06-02T16:10:15.813576346Z       /go/src/github.com/cilium/cilium/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:90 +0x4a1
2020-06-02T16:10:15.813579629Z   k8s.io/client-go/tools/cache.(*controller).Run()
2020-06-02T16:10:15.813582834Z       /go/src/github.com/cilium/cilium/vendor/k8s.io/client-go/tools/cache/controller.go:145 +0x443
2020-06-02T16:10:15.813586265Z 
2020-06-02T16:10:15.813590406Z Previous write at 0x000004e9b100 by main goroutine:
2020-06-02T16:10:15.813609438Z   github.com/cilium/cilium/pkg/node/types.SetName()
2020-06-02T16:10:15.81361309Z       /go/src/github.com/cilium/cilium/pkg/node/types/nodename.go:35 +0x1c6
2020-06-02T16:10:15.813616464Z   github.com/cilium/cilium/pkg/k8s.GetNodeSpec()
2020-06-02T16:10:15.813619663Z       /go/src/github.com/cilium/cilium/pkg/k8s/init.go:201 +0x1b6
2020-06-02T16:10:15.813622905Z   github.com/cilium/cilium/daemon/cmd.NewDaemon()
2020-06-02T16:10:15.813630836Z       /go/src/github.com/cilium/cilium/daemon/cmd/daemon.go:403 +0x446d
2020-06-02T16:10:15.813634623Z   github.com/cilium/cilium/daemon/cmd.runDaemon()
2020-06-02T16:10:15.81363783Z       /go/src/github.com/cilium/cilium/daemon/cmd/daemon_main.go:1281 +0x354
2020-06-02T16:10:15.813641171Z   github.com/cilium/cilium/daemon/cmd.glob..func1()
2020-06-02T16:10:15.813644397Z       /go/src/github.com/cilium/cilium/daemon/cmd/daemon_main.go:116 +0xab
2020-06-02T16:10:15.813736725Z   github.com/cilium/cilium/daemon/cmd.glob..func1()
2020-06-02T16:10:15.813744571Z       /go/src/github.com/cilium/cilium/daemon/cmd/daemon_main.go:114 +0x91
2020-06-02T16:10:15.813748239Z   github.com/spf13/cobra.(*Command).execute()
2020-06-02T16:10:15.81375152Z       /go/src/github.com/cilium/cilium/vendor/github.com/spf13/cobra/command.go:846 +0x8e0
2020-06-02T16:10:15.813754971Z   github.com/spf13/cobra.(*Command).ExecuteC()
2020-06-02T16:10:15.813758158Z       /go/src/github.com/cilium/cilium/vendor/github.com/spf13/cobra/command.go:950 +0x499
2020-06-02T16:10:15.81376151Z   github.com/spf13/cobra.(*Command).Execute()
2020-06-02T16:10:15.813764727Z       /go/src/github.com/cilium/cilium/vendor/github.com/spf13/cobra/command.go:887 +0x1eb
2020-06-02T16:10:15.813768122Z   github.com/cilium/cilium/daemon/cmd.Execute()
2020-06-02T16:10:15.813771486Z       /go/src/github.com/cilium/cilium/daemon/cmd/daemon_main.go:147 +0x1cc
2020-06-02T16:10:15.813774756Z   main.main()
2020-06-02T16:10:15.813777984Z       /go/src/github.com/cilium/cilium/daemon/main.go:22 +0x2f
2020-06-02T16:10:15.813868057Z 
2020-06-02T16:10:15.813875324Z Goroutine 165 (running) created at:
2020-06-02T16:10:15.813878847Z   github.com/cilium/cilium/pkg/k8s/watchers.(*K8sWatcher).ciliumNodeInit()
2020-06-02T16:10:15.813882164Z       /go/src/github.com/cilium/cilium/pkg/k8s/watchers/cilium_node.go:103 +0x24e

@aanm aanm requested a review from a team June 2, 2020 16:59
@aanm aanm requested a review from a team as a code owner June 2, 2020 16:59
@aanm aanm requested a review from a team June 2, 2020 16:59
@maintainer-s-little-helper
Copy link

Please set the appropriate release note label.

2 similar comments
@maintainer-s-little-helper
Copy link

Please set the appropriate release note label.

@maintainer-s-little-helper
Copy link

Please set the appropriate release note label.

@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.8.0 Jun 2, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.8.0 Jun 2, 2020
@aanm aanm added the release-note/misc This PR makes changes that have no direct user impact. label Jun 2, 2020
@aanm
Copy link
Member Author

aanm commented Jun 2, 2020

test-me-please

The node name in the pkg/node is set at `init()` time so there is not
point on setting this package variable all over the code.

Fixes: 3533fd3 ("pkg/node: give priority to nodeName from K8S_NODE_NAME env variable")
Signed-off-by: André Martins <andre@cilium.io>
@aanm
Copy link
Member Author

aanm commented Jun 2, 2020

test-me-please

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 36.894% when pulling 81fc4f5 on pr/fix-datarace-node into a20dcd1 on master.

@aanm
Copy link
Member Author

aanm commented Jun 3, 2020

hit #11849 and #11848

@aanm aanm merged commit 40b6f58 into master Jun 3, 2020
1.8.0 automation moved this from In progress to Merged Jun 3, 2020
@aanm aanm deleted the pr/fix-datarace-node branch June 3, 2020 08:04
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.8 in 1.8.0 Jun 3, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.8 to Backport done to v1.8 in 1.8.0 Jun 4, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.8 to Backport done to v1.8 in 1.8.0 Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
1.8.0
  
Merged
1.8.0
Backport done to v1.8
Development

Successfully merging this pull request may close these issues.

None yet

5 participants