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
Fix Panic in network policy deletion #3034
Conversation
When a network policy creation fails before it is added to the `nsInfo.networkPolicies[policy.Name] = np` cache, attempting to delete it or update it causes panic since we end up passing nil pointer into destroyNetworkPolicy. Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
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.
@trozet and @JacobTanenbaum PTAL
56449d2
to
ac74d3a
Compare
I will work on the
AND
in a new PR. Don't want to mix up creation bugs with deletion bugs. |
/retest-failed |
test failure due to #2988 hence retesting. |
/retest |
Oops, something went wrong:
|
ac74d3a
to
93d4889
Compare
93d4889
to
c6eea75
Compare
c6eea75
to
7024e2c
Compare
Fixes panic observed during NP deletion: 2022-05-27T15:48:27.957882179Z I0527 15:48:27.957839 1 policy.go:1251] Deleting network policy XXXXX in namespace XXXXX 2022-05-27T15:48:27.957950868Z E0527 15:48:27.957928 1 runtime.go:78] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference) 2022-05-27T15:48:27.957950868Z goroutine 132 [running]: 2022-05-27T15:48:27.957950868Z k8s.io/apimachinery/pkg/util/runtime.logPanic(0x1930dc0, 0x2907f50) 2022-05-27T15:48:27.957950868Z /go/src/github.com/openshift/ovn-kubernetes/go-controller/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:74 +0x95 2022-05-27T15:48:27.957950868Z k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0) 2022-05-27T15:48:27.957950868Z /go/src/github.com/openshift/ovn-kubernetes/go-controller/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:48 +0x86 2022-05-27T15:48:27.957950868Z panic(0x1930dc0, 0x2907f50) 2022-05-27T15:48:27.957950868Z /usr/lib/golang/src/runtime/panic.go:965 +0x1b9 2022-05-27T15:48:27.957950868Z github.com/ovn-org/ovn-kubernetes/go-controller/pkg/ovn.(*Controller).destroyNetworkPolicy(0xc002fcc6c0, 0x0, 0xc000fc9901, 0x0, 0x0) 2022-05-27T15:48:27.957950868Z /go/src/github.com/openshift/ovn-kubernetes/go-controller/pkg/ovn/policy.go:1287 +0x55 2022-05-27T15:48:27.957950868Z github.com/ovn-org/ovn-kubernetes/go-controller/pkg/ovn.(*Controller).deleteNetworkPolicy(0xc002fcc6c0, 0xc0006cc580, 0x0, 0x0, 0x0) 2022-05-27T15:48:27.957950868Z /go/src/github.com/openshift/ovn-kubernetes/go-controller/pkg/ovn/policy.go:1275 +0x451 Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
7024e2c
to
a679b63
Compare
/retest-failed |
Again retry EIP flake. : https://github.com/ovn-org/ovn-kubernetes/runs/7032634790?check_suite_focus=true#step:6:23363 |
/retest-failed |
/retest-failed |
Fix panic in NP deletion
NOTE to reviewers: First commit adds a unit test that shows the panic, the second commit adds the fix and updates the test case to pass.
Fixes panic observed during NP deletion:
Signed-off-by: Surya Seetharaman suryaseetharaman.9@gmail.com