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

Validate labels in ANP/ACNP/CG #3331

Merged
merged 1 commit into from Feb 24, 2022
Merged

Conversation

GraysonWu
Copy link
Contributor

@GraysonWu GraysonWu commented Feb 17, 2022

Fixes #3285.

This PR added some additional validations to ANP, ACNP and CG in
validating webhook. Antrea will validate labels used in ANP, ACNP and
CG under PodSelector, NamespaceSelector and ExternalEntitySelector.

Signed-off-by: wgrayson wgrayson@vmware.com

@Dyanngg
Copy link
Contributor

Dyanngg commented Feb 18, 2022

LGTM, but do you think we should do the same for labelSelectors in ClusterGroups as well?

@GraysonWu GraysonWu force-pushed the validate-label branch 2 times, most recently from bf0d5c7 to cc03d67 Compare February 22, 2022 22:39
@GraysonWu
Copy link
Contributor Author

LGTM, but do you think we should do the same for labelSelectors in ClusterGroups as well?

Good catch. Added.

@GraysonWu GraysonWu changed the title Validate labels in ANP/ACNP Validate labels in ANP/ACNP/CG Feb 22, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #3331 (cc03d67) into main (3f30d84) will increase coverage by 1.16%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3331      +/-   ##
==========================================
+ Coverage   60.85%   62.02%   +1.16%     
==========================================
  Files         266      269       +3     
  Lines       26520    26733     +213     
==========================================
+ Hits        16139    16581     +442     
+ Misses       8591     8340     -251     
- Partials     1790     1812      +22     
Flag Coverage Δ
kind-e2e-tests 49.53% <33.33%> (+1.57%) ⬆️
unit-tests 41.66% <100.00%> (+0.07%) ⬆️

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

Impacted Files Coverage Δ
pkg/controller/networkpolicy/validate.go 48.32% <100.00%> (+7.12%) ⬆️
pkg/controller/serviceexternalip/controller.go 66.47% <0.00%> (-5.12%) ⬇️
pkg/controller/networkpolicy/status_controller.go 65.89% <0.00%> (-3.47%) ⬇️
pkg/agent/nodeportlocal/k8s/npl_controller.go 58.70% <0.00%> (-2.05%) ⬇️
pkg/agent/agent.go 51.34% <0.00%> (-0.36%) ⬇️
...ster/commonarea/mock_remote_common_area_manager.go 20.83% <0.00%> (ø)
...multicluster/commonarea/mock_remote_common_area.go 30.23% <0.00%> (ø)
.../multicluster/mock_membercluster_status_manager.go 100.00% <0.00%> (ø)
pkg/agent/flowexporter/exporter/exporter.go 81.29% <0.00%> (+0.64%) ⬆️
...ntroller/networkpolicy/networkpolicy_controller.go 71.34% <0.00%> (+0.91%) ⬆️
... and 17 more

tnqn
tnqn previously approved these changes Feb 23, 2022
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM, just one style suggestion

pkg/controller/networkpolicy/validate.go Outdated Show resolved Hide resolved
Fixes antrea-io#3285.

This PR added some additional validations to ANP, ACNP and CG in
validating webhook. Antrea will validate labels used in ANP, ACNP and
CG under PodSelector, NamespaceSelector and ExternalEntitySelector.

Signed-off-by: wgrayson <wgrayson@vmware.com>
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM

@tnqn
Copy link
Member

tnqn commented Feb 24, 2022

/test-all

@GraysonWu
Copy link
Contributor Author

/test-integration

@tnqn tnqn added the action/release-note Indicates a PR that should be included in release notes. label Feb 24, 2022
@tnqn tnqn merged commit 52dd939 into antrea-io:main Feb 24, 2022
bangqipropel pushed a commit to bangqipropel/antrea that referenced this pull request Mar 2, 2022
Fixes antrea-io#3285.

This PR added some additional validations to ANP, ACNP and CG in
validating webhook. Antrea will validate labels used in ANP, ACNP and
CG under PodSelector, NamespaceSelector and ExternalEntitySelector.

Signed-off-by: wgrayson <wgrayson@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/release-note Indicates a PR that should be included in release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validate CRDs labels in validating webhook
4 participants