Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions internal/controller/networkpolicy/np_objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,24 @@ func buildMainNetworkPolicy(desired *flowslatest.FlowCollector, mgr *manager.Man
}},
})
}
np.Spec.Egress = append(np.Spec.Egress, networkingv1.NetworkPolicyEgressRule{
// Console plugin pod needs access to cluster monitoring, see its configured URL, even with upstream deployment
To: []networkingv1.NetworkPolicyPeer{
peerInNamespace(constants.MonitoringNamespace),
},
})
if mgr.Config.DownstreamDeployment {
np.Spec.Ingress = append(np.Spec.Ingress, networkingv1.NetworkPolicyIngressRule{
From: []networkingv1.NetworkPolicyPeer{
peerInNamespace(constants.MonitoringNamespace),
},
})
np.Spec.Egress = append(np.Spec.Egress, networkingv1.NetworkPolicyEgressRule{
To: []networkingv1.NetworkPolicyPeer{
peerInNamespace(constants.MonitoringNamespace),
},
})

} else {
np.Spec.Ingress = append(np.Spec.Ingress, networkingv1.NetworkPolicyIngressRule{
From: []networkingv1.NetworkPolicyPeer{
peerInNamespace(constants.UWMonitoringNamespace),
},
})
np.Spec.Egress = append(np.Spec.Egress, networkingv1.NetworkPolicyEgressRule{
To: []networkingv1.NetworkPolicyPeer{
peerInNamespace(constants.UWMonitoringNamespace),
},
})
}
// Allow apiserver/host
np.Spec.Ingress = append(np.Spec.Ingress, networkingv1.NetworkPolicyIngressRule{
Expand Down