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

Fix panic in stats.calculateRuleDiff #2495

Merged
merged 1 commit into from
Jul 29, 2021
Merged

Conversation

tnqn
Copy link
Member

@tnqn tnqn commented Jul 29, 2021

The process would panic when it calculates stats of a rule that is newly
added to an existing NetworkPolicy and the stats is zero.

Signed-off-by: Quan Tian qtian@vmware.com

Fixes #2494

The process would panic when it calculates stats of a rule that is newly
added to an existing NetworkPolicy and the stats is zero.

Signed-off-by: Quan Tian <qtian@vmware.com>
@tnqn tnqn requested review from antoninbas and ceclinux July 29, 2021 12:12
@tnqn
Copy link
Member Author

tnqn commented Jul 29, 2021

This needs to be backported to at least v1.2 as NetworkPolicyStats is enabled by default in it, and can be backported to v1.0 and v1.1.

@tnqn
Copy link
Member Author

tnqn commented Jul 29, 2021

/test-all

@codecov-commenter
Copy link

codecov-commenter commented Jul 29, 2021

Codecov Report

Merging #2495 (23c9a70) into main (cdc8453) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2495      +/-   ##
==========================================
+ Coverage   59.82%   59.85%   +0.02%     
==========================================
  Files         284      284              
  Lines       22168    22175       +7     
==========================================
+ Hits        13263    13273      +10     
+ Misses       7483     7481       -2     
+ Partials     1422     1421       -1     
Flag Coverage Δ
e2e-tests ∅ <ø> (?)
kind-e2e-tests 47.02% <0.00%> (-0.06%) ⬇️
unit-tests 42.03% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/agent/stats/collector.go 94.65% <100.00%> (+0.04%) ⬆️
pkg/controller/traceflow/controller.go 71.68% <0.00%> (-4.22%) ⬇️
pkg/agent/openflow/network_policy.go 75.82% <0.00%> (+0.14%) ⬆️
pkg/agent/openflow/client.go 57.88% <0.00%> (+0.24%) ⬆️
pkg/agent/flowexporter/exporter/exporter.go 80.46% <0.00%> (+0.46%) ⬆️
pkg/controller/networkpolicy/status_controller.go 74.83% <0.00%> (+1.93%) ⬆️
pkg/ipfix/ipfix_process.go 100.00% <0.00%> (+18.18%) ⬆️
pkg/util/runtime/runtime_linux.go 46.66% <0.00%> (+46.66%) ⬆️

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

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

LGTM, please cherry-pick as needed

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.

Agent panics when calculating NetworkPolicy rule stats
3 participants