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

connectivity test: avoid segfault if no agent pods are found #2470

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

multi-io
Copy link
Contributor

@multi-io multi-io commented Apr 4, 2024

If the --cilium-namespace and --agent-pod-selector (default kube-system and k8s-app=cilium) don't match anything, cilium connectivity test segfaults.

# (cluster where the agent pods are labeled `app=cilium)
# ./cilium connectivity test
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x102fbe948]

goroutine 24 [running]:
github.com/cilium/cilium-cli/connectivity/check.(*ConnectivityTest).detectCiliumVersion(0x140004ace08, {0x104e88238?, 0x140002f9f40?})
        /Users/oklischat/src/cilium-cli/connectivity/check/features.go:266 +0x168
github.com/cilium/cilium-cli/connectivity/check.(*ConnectivityTest).SetupAndValidate(0x140004ace08, {0x104e88238, 0x140002f9f40}, {0x12e860658, 0x10736f180})
        /Users/oklischat/src/cilium-cli/connectivity/check/context.go:290 +0xa4
github.com/cilium/cilium-cli/connectivity.Run({0x104e88238, 0x140002f9f40}, 0x140004ace08, {0x12e860628, 0x10736f180})
        /Users/oklischat/src/cilium-cli/connectivity/suite.go:24 +0x64
github.com/cilium/cilium-cli/cli.newCmdConnectivityTest.RunE.func1.2()
        /Users/oklischat/src/cilium-cli/cli/connectivity.go:99 +0x98
created by github.com/cilium/cilium-cli/cli.newCmdConnectivityTest.RunE.func1 in goroutine 1
        /Users/oklischat/src/cilium-cli/cli/connectivity.go:97 +0x5a4

This fixes that to a proper error.

# ./cilium connectivity test
connectivity test failed: no cilium agent pods found in -n kube-system -l k8s-app=cilium

@multi-io multi-io requested a review from a team as a code owner April 4, 2024 23:10
@multi-io multi-io requested a review from christarazi April 4, 2024 23:10
@maintainer-s-little-helper
Copy link

Commit 4f63005 does not match "Signed-off-by".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

Copy link
Contributor

@derailed derailed left a comment

Choose a reason for hiding this comment

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

@multi-io Great catch! Thank you for this pr.

@tklauser tklauser merged commit 4605cb3 into cilium:main Apr 18, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants