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

Infer PolicyTypes if missing #50

Merged
merged 2 commits into from
Jul 12, 2023

Conversation

zeeke
Copy link
Member

@zeeke zeeke commented Jun 22, 2023

In cases where Spec.PolicyTypes is not specified, it should default to the existence of Ingress or Egress rules.

Updating end2end tests to cover also this scenario.

Changes have been guided by the regular NetworkPolicy documentation:

[...] If this field is not specified, it will default based on the existence of Ingress or Egress rules;

@coveralls
Copy link

coveralls commented Jun 22, 2023

Pull Request Test Coverage Report for Build 5529027813

  • 5 of 13 (38.46%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+5.1%) to 58.537%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/server/server.go 5 13 38.46%
Totals Coverage Status
Change from base Build 5523838027: 5.1%
Covered Lines: 1104
Relevant Lines: 1886

💛 - Coveralls

Copy link
Member

@s1061123 s1061123 left a comment

Choose a reason for hiding this comment

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

Almost okey to me. Appreciated if you incorporate my comments. thanks.

}
}
}
var ingressEnable, egressEnable bool = getEnabledPolicyTypes(policy)
Copy link
Member

Choose a reason for hiding this comment

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

how about to change that? (it is just for shorten code with same meaning, so not critical)
ingressEnable, egressEnable := getEnabledPolicyTypes(policy)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea! Fixed

Copy link
Member

@s1061123 s1061123 left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

@zeeke zeeke mentioned this pull request Jul 7, 2023
@zeeke
Copy link
Member Author

zeeke commented Jul 11, 2023

e2e-kind job is fixed by:

@zeeke zeeke closed this Jul 11, 2023
@zeeke zeeke reopened this Jul 11, 2023
@s1061123
Copy link
Member

@zeeke Appreciated your e2e test fix! Could you please rebase the PR to get the e2e fix?

@s1061123
Copy link
Member

@zeeke I update the PR but e2e still failed. PTAL?

ok 1 setup simple test environments
ok 2 test-simple-v4-ingress-list check client-a -> server
not ok 3 test-simple-v4-ingress-list check client-b -> server
# (in test file tests/simple-v4-ingress-list.bats, line 35)
#   `[ "$status" -eq  "1" ]' failed

@zeeke
Copy link
Member Author

zeeke commented Jul 12, 2023

Sure, I'll have a look

In cases where Spec.PolicyTypes is not specified, it should
default to the existence of Ingress or Egress rules.

Updating end2end tests to cover also this scenario.

Signed-off-by: Andrea Panattoni <apanatto@redhat.com>
Signed-off-by: Andrea Panattoni <apanatto@redhat.com>
@zeeke
Copy link
Member Author

zeeke commented Jul 12, 2023

Some tests were missing a sleep after the test setup. I think some assertions were running before the server policy sync.

@s1061123
Copy link
Member

@zeeke thank you for the quick fix! Let's merge that.

@s1061123 s1061123 merged commit 5ec4fd0 into k8snetworkplumbingwg:master Jul 12, 2023
8 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.

None yet

3 participants