daemon: Only attempt to resolve CIDR from k8s API if client is available #608
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes the following panic:
anic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x4105b4]
goroutine 1 [running]:
panic(0x1998a80, 0xc420012050)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
main.(*Daemon).useK8sNodeCIDR(0xc4200c8b40, 0xc42000e08e, 0x8, 0x8, 0xc421d895f0)
/tmp/cilium-net-build/src/github.com/cilium/cilium/daemon/daemon.go:268 +0x54
main.NewDaemon(0xc420322000, 0x0, 0x0, 0x0)
/tmp/cilium-net-build/src/github.com/cilium/cilium/daemon/daemon.go:512 +0xf68
main.runDaemon()
/tmp/cilium-net-build/src/github.com/cilium/cilium/daemon/main.go:449 +0x88
main.glob..func1(0x2986f80, 0xc42008e050, 0x2, 0x5)
/tmp/cilium-net-build/src/github.com/cilium/cilium/daemon/main.go:91 +0x19
github.com/cilium/cilium/vendor/github.com/spf13/cobra.(*Command).execute(0x2986f80, 0xc42000c130, 0x5, 0x5, 0x2986f80, 0xc42000c130)
/tmp/cilium-net-build/src/github.com/cilium/cilium/vendor/github.com/spf13/cobra/command.go:648 +0x443
github.com/cilium/cilium/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x2986f80, 0x0, 0x1bc4d3c, 0x9)
/tmp/cilium-net-build/src/github.com/cilium/cilium/vendor/github.com/spf13/cobra/command.go:735 +0x367
github.com/cilium/cilium/vendor/github.com/spf13/cobra.(*Command).Execute(0x2986f80, 0x0, 0x0)
/tmp/cilium-net-build/src/github.com/cilium/cilium/vendor/github.com/spf13/cobra/command.go:693 +0x2b
main.main()
/tmp/cilium-net-build/src/github.com/cilium/cilium/daemon/main.go:96 +0x31
Signed-off-by: Thomas Graf thomas@cilium.io