Skip to content

Conversation

@huntergregory
Copy link
Contributor

@huntergregory huntergregory commented May 11, 2022

  • 1st commit: remove Name field from NPMNetworkPolicy because we should be using PolicyKey field instead
    • Windows Dataplane was using the wrong field in some scenarios
  • 2nd commit: move PolicyID field in ACLPolicy to NPMNetworkPolicy since it's the same for all ACLs in a netpol

@huntergregory huntergregory added the npm Related to NPM. label May 11, 2022
@huntergregory huntergregory requested a review from a team as a code owner May 11, 2022 23:04
@huntergregory huntergregory requested review from ck319 and removed request for a team May 11, 2022 23:04
Copy link
Contributor

@vakalapa vakalapa left a comment

Choose a reason for hiding this comment

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

minor comments

selectorIpSets[ipset.Metadata.GetPrefixName()] = struct{}{}
}

klog.Infof("policy %s has policy selector: %+v", policy.PolicyKey, selectorIpSets) // FIXME remove after debugging
Copy link
Contributor

Choose a reason for hiding this comment

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

do you want to remove this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gonna fix the bug related to these print statements in a followup PR


func (dp *DataPlane) getSelectorIPsByPolicyName(policyName string) (map[string]struct{}, error) {
policy, ok := dp.policyMgr.GetPolicy(policyName)
func (dp *DataPlane) getSelectorIPsByPolicyName(policyKey string) (map[string]struct{}, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

probably update this func name to getSelectorIPsByPolicyKey

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let me fix the followup PR?

dp.endpointCache[ep.IP] = ep
klog.Infof("updating endpoint cache to include %s: %+v", ep.IP, ep) // FIXME remove after debugging
}
klog.Infof("endpoint cache after refreshing all pod endpoints: %+v", dp.endpointCache) // FIXME remove after debugging
Copy link
Contributor

Choose a reason for hiding this comment

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

remove these prints ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gonna fix the bug related to these print statements in a followup PR

// aclPolicyID returns azure-acl-<network policy namespace>-<network policy name> format
// to differentiate ACLs among different network policies,
// but aclPolicy in the same network policy has the same aclPolicyID.
func aclPolicyID(policyNS, policyName string) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

No strong opinion, but we can keep this in common policy.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not adamant either, but prefer to let Linux return an empty string to keep in par with separate dirty cache etc. between OS's

@huntergregory huntergregory merged commit a15630b into master May 13, 2022
@huntergregory huntergregory deleted the npm-v2-mem-reduction branch May 13, 2022 18:41
rsagasthya pushed a commit to rsagasthya/azure-container-networking that referenced this pull request May 18, 2022
…e memory (Azure#1374)

* remove Name field from NPMNetworkPolicy

* wip moving acl policy id

* fix policy key typo for removing Name field

* fix lint and log

* temp debug logs

* another debug log

* update a couple UTs
matmerr pushed a commit to matmerr/azure-container-networking that referenced this pull request Jun 29, 2022
…e memory (Azure#1374)

* remove Name field from NPMNetworkPolicy

* wip moving acl policy id

* fix policy key typo for removing Name field

* fix lint and log

* temp debug logs

* another debug log

* update a couple UTs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

npm Related to NPM.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants