-
Notifications
You must be signed in to change notification settings - Fork 366
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
Network Policy Controller sync #82
Conversation
Thanks for your PR. The following commands are available:
|
076e1b4
to
b60832f
Compare
/test-e2e |
09f6ff4
to
ac1a3a5
Compare
ac1a3a5
to
c6199ac
Compare
b60832f
to
693f66d
Compare
// Retrieve all Pods matching the podSelector. | ||
pods, err = n.podLister.Pods(appliedToGroup.Selector.Namespace).List(selector) | ||
for _, pod := range pods { | ||
if pod.Status.PodIP == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L672 needs to check whether IP changes too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Pod without IP typically happens maybe check and ignore Pods with no IP in addPod()?
Around line 662, we could also optimize not to get both old and new groups if Pod labels do not change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are checking for PodIP in add/updatePod.. though this check is also needed because we are retrieving a list of pods from lister which may return pods with no IP.
labels matching is already been done around L662 .. we return if no label, nodename or pod ip change
693f66d
to
f515086
Compare
if groupSelector.Namespace != "" { | ||
// Namespace presence indicates Pods must be selected from the same Namespace. | ||
pods, _ = n.podLister.Pods(groupSelector.Namespace).List(pSelector) | ||
} else if groupSelector.NamespaceSelector != nil && groupSelector.PodSelector != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: maybe check groupSelector.PodSelector first.
// Retrieve all Pods matching the podSelector. | ||
pods, err = n.podLister.Pods(appliedToGroup.Selector.Namespace).List(selector) | ||
for _, pod := range pods { | ||
if pod.Status.PodIP == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Pod without IP typically happens maybe check and ignore Pods with no IP in addPod()?
Around line 662, we could also optimize not to get both old and new groups if Pod labels do not change?
a78154e
to
f2da8a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addPod() could we ignore Pods if no IP set? Assuming a Pod is always first seen without IP, it could be an optimization.
I also add several other comments, but all these are optimization, and I am fine to address them later.
@@ -627,9 +661,9 @@ func (n *NetworkPolicyController) updatePod(oldObj, curObj interface{}) { | |||
// Create set to hold the group keys to enqueue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant if labelsEqual is true, then line 659 and 660 could be skipped.
f2da8a6
to
0ea08f3
Compare
/test-e2e |
Along with namespace event handlers, add logic to sync Groups and internal NP objects.
0ea08f3
to
58c47ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now
Along with namespace event handlers, add
logic to sync Groups and internal NP
objects.