Merge remote-tracking branch 'gobomb/fix-nil-ns-pointer'
Needed a few modifications to resolve conflicts due to changed datatype of UID.
This commit is contained in:
commit
f9e27f76d6
3 files changed
+35
-24
No files matched your search
+5
-5
@@ -61,9 +61,9 @@ func New(nodeName string, ipt iptables.Interface, ips ipset.Interface, clientset
|
||||
|
||||
func (npc *controller) onNewNsSelector(selector *selector) error {
|
||||
for _, ns := range npc.nss {
|
||||
if ns.namespace != nil {
|
||||
if selector.matchesNamespaceSelector(ns.namespace.ObjectMeta.Labels) {
|
||||
if err := selector.addEntry(nsuid(ns.namespace), string(ns.allPods.ipsetName), namespaceComment(ns)); err != nil {
|
||||
if ns.namespaceUID != "" {
|
||||
if selector.matchesNamespaceSelector(ns.namespaceLabels) {
|
||||
if err := selector.addEntry(ns.namespaceUID, string(ns.allPods.ipsetName), namespaceComment(ns)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -74,10 +74,10 @@ func (npc *controller) onNewNsSelector(selector *selector) error {
|
||||
|
||||
func (npc *controller) onNewNamespacePodsSelector(selector *selector) error {
|
||||
for _, ns := range npc.nss {
|
||||
if ns.namespace != nil && len(ns.pods) > 0 {
|
||||
if ns.namespaceUID != "" && len(ns.pods) > 0 {
|
||||
for _, pod := range ns.pods {
|
||||
if hasIP(pod) {
|
||||
if selector.matchesNamespacedPodSelector(pod.ObjectMeta.Labels, ns.namespace.ObjectMeta.Labels) {
|
||||
if selector.matchesNamespacedPodSelector(pod.ObjectMeta.Labels, ns.namespaceLabels) {
|
||||
if err := selector.addEntry(uid(pod), pod.Status.PodIP, podComment(pod)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user