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

Added separate knobs to configure agent side networkPolicyController. #1753

Closed

Conversation

suwang48404
Copy link
Contributor

Knobs added: statusMgr, logging, and appliedToExternalEntity.

Knobs added: statusMgr, logging, and appliedToExternalEntity.
@suwang48404 suwang48404 force-pushed the releae-0.12-patch-merge branch from 901d09b to a245cc6 Compare January 19, 2021 19:59
@codecov-io
Copy link

codecov-io commented Jan 19, 2021

Codecov Report

Merging #1753 (a245cc6) into master (9d3d10b) will decrease coverage by 1.46%.
The diff coverage is 43.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1753      +/-   ##
==========================================
- Coverage   63.31%   61.85%   -1.47%     
==========================================
  Files         170      192      +22     
  Lines       14250    16377    +2127     
==========================================
+ Hits         9023    10130    +1107     
- Misses       4292     5184     +892     
- Partials      935     1063     +128     
Flag Coverage Δ
kind-e2e-tests 51.07% <32.04%> (-4.31%) ⬇️
unit-tests 42.66% <40.38%> (+1.39%) ⬆️

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

Impacted Files Coverage Δ
.../agent/apiserver/handlers/networkpolicy/handler.go 58.33% <ø> (ø)
...gent/controller/noderoute/node_route_controller.go 45.83% <0.00%> (-0.64%) ⬇️
pkg/agent/interfacestore/types.go 72.72% <0.00%> (-7.28%) ⬇️
pkg/agent/nodeportlocal/k8s/annotations.go 0.00% <0.00%> (ø)
pkg/agent/nodeportlocal/k8s/controller.go 0.00% <0.00%> (ø)
pkg/agent/nodeportlocal/portcache/port_table.go 0.00% <0.00%> (ø)
pkg/agent/nodeportlocal/rules/iptable_rule.go 0.00% <ø> (ø)
pkg/agent/nodeportlocal/rules/rules.go 0.00% <ø> (ø)
pkg/agent/nodeportlocal/util/parse_port.go 0.00% <ø> (ø)
pkg/agent/openflow/client.go 64.32% <ø> (+4.45%) ⬆️
... and 143 more

memberSet.Insert(&group.GroupMembers[i])
m := &group.GroupMembers[i]
if c.appliedToExternalEntity && m.Pod == nil && m.ExternalEntity != nil {
// Convert ExternalEntity to PodEntity so that rules applied to ExternalEntity.
Copy link
Contributor

@Dyanngg Dyanngg Jan 19, 2021

Choose a reason for hiding this comment

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

Having separate knobs for Antrea-native policy features sounds fine by me. However, I think converting externalEntityReference to podReference here is too much a hack. If we know that ExternalEntities will be configured with container interfaces just like Pods, we could refactor GetContainerInterfacesByPod() method to be more generic and be applicable to EEs as well. The same goes for getPodOFPorts and getPodIPs. @jianjuns @tnqn

Copy link
Contributor

Choose a reason for hiding this comment

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

I would agree what Yang said. We could revise the struct or add a new to support ExternalEntity.

Copy link
Member

Choose a reason for hiding this comment

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

Agree with @Dyanngg, I think that's also why we replaced GroupMemberPodSet with GroupMemberSet in many places.

Copy link
Member

Choose a reason for hiding this comment

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

appliedToExternalEntity is not really needed, right? If there's ExternalEntity in the group, I think there's no reason to ignore it?

Copy link
Contributor Author

@suwang48404 suwang48404 Jan 20, 2021

Choose a reason for hiding this comment

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

I took approach with the least change/resistence to allow appliedToExternalEntity supportability, as I am not very familiar with the implementation, and rather not to making sweeping changes.

In my view, if to address this properly, there are two approaches:

  1. Using ANP CRD ( from antrea manifest) as cue to support appliedToExternalEntity or not in antrea. On agent side we will support AppliedToExternalEntity based on AppliedToGroup content derived from ANP and received from controller.
  2. In addition to 1, to be explicit , so that user cannot accidentally change AppliedToExternalEntity supportability by change antrea manifest. An compilation time flag is needed on agent side to indicate supportability on agent regardless of AppliedToGroup content.

@jianjuns @tnqn @Dyanngg what do u think?

And if we do choose of the two above approaches, wonder if I get some help from u guys. It will definitely much efficient if @Dyanngg or @tnqn has a look?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jianjuns @tnqn @Dyanngg need ur input on how to proceed with this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if I got your #2, but definitely I would agree with your #1 that Agent should support ExternalEntity. But in your mind, if Agent does not really implements NetworkPolicy for ExternalEntity, what will be the interface it exposes to you? Probably we should discuss offline to understand your requirements.

Copy link
Contributor

@jianjuns jianjuns left a comment

Choose a reason for hiding this comment

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

Could you explain the reasoning of making this change?

@suwang48404
Copy link
Contributor Author

suwang48404 commented Jan 20, 2021

Could you explain the reasoning of making this change?

The change is made so that networkPolicy controller may be reused to support ANP CRD but perhaps outside antrea CNI itself.

Base automatically changed from master to main January 26, 2021 00:00
@Dyanngg
Copy link
Contributor

Dyanngg commented Feb 9, 2021

superseded by #1775

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.

6 participants