|
|
|
@@ -285,7 +285,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
|
|
|
|
// This will be used when running through all firewall groups and servics known, to see if a rule should be added.
|
|
|
|
// This will be used when running through all firewall groups and servics known, to see if a rule should be added.
|
|
|
|
|
|
|
|
|
|
|
|
for _, dest_group := range firewallPolicy.Spec.Destination.FirewallGroups {
|
|
|
|
for _, dest_group := range firewallPolicy.Spec.Destination.FirewallGroups {
|
|
|
|
namespace := defaultNs
|
|
|
|
namespace := firewallPolicy.Namespace
|
|
|
|
if len(dest_group.Namespace) > 0 {
|
|
|
|
if len(dest_group.Namespace) > 0 {
|
|
|
|
namespace = dest_group.Namespace
|
|
|
|
namespace = dest_group.Namespace
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -310,7 +310,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
|
|
|
|
// Run through all firewall groups. Add them to the myFirewallGroups list if they either have an annotations or is specified in the resource.
|
|
|
|
// Run through all firewall groups. Add them to the myFirewallGroups list if they either have an annotations or is specified in the resource.
|
|
|
|
|
|
|
|
|
|
|
|
for _, firewallGroup := range firewallGroupCRDs.Items {
|
|
|
|
for _, firewallGroup := range firewallGroupCRDs.Items {
|
|
|
|
if val, found := firewallGroup.Annotations["unifi.engen.priv.no/firewall-policy"]; found && ((strings.Contains(val, "/") && val == firewallPolicy.Namespace+"/"+firewallPolicy.Name) || (val == firewallPolicy.Name && firewallPolicy.Namespace == defaultNs)) {
|
|
|
|
if val, found := firewallGroup.Annotations["unifi.engen.priv.no/firewall-policy"]; found && ((strings.Contains(val, "/") && val == firewallPolicy.Namespace+"/"+firewallPolicy.Name) || (val == firewallPolicy.Name && firewallPolicy.Namespace == firewallGroup.Namespace)) {
|
|
|
|
myFirewallGroups = append(myFirewallGroups, firewallGroup)
|
|
|
|
myFirewallGroups = append(myFirewallGroups, firewallGroup)
|
|
|
|
} else if _, found := destination_groups[firewallGroup.Namespace+"/"+firewallGroup.Name]; found {
|
|
|
|
} else if _, found := destination_groups[firewallGroup.Namespace+"/"+firewallGroup.Name]; found {
|
|
|
|
myFirewallGroups = append(myFirewallGroups, firewallGroup)
|
|
|
|
myFirewallGroups = append(myFirewallGroups, firewallGroup)
|
|
|
|
@@ -340,7 +340,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
|
|
|
|
skipService = true
|
|
|
|
skipService = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if val, found := service.Annotations["unifi.engen.priv.no/firewall-policy"]; found && ((strings.Contains(val, "/") && val == firewallPolicy.Namespace+"/"+firewallPolicy.Name) || (val == firewallPolicy.Name && firewallPolicy.Namespace == defaultNs)) && !skipService {
|
|
|
|
if val, found := service.Annotations["unifi.engen.priv.no/firewall-policy"]; found && ((strings.Contains(val, "/") && val == firewallPolicy.Namespace+"/"+firewallPolicy.Name) || (val == firewallPolicy.Name && firewallPolicy.Namespace == service.Namespace)) && !skipService {
|
|
|
|
myServices = append(myServices, service)
|
|
|
|
myServices = append(myServices, service)
|
|
|
|
} else if _, found := destination_services[service.Namespace+"/"+service.Name]; found && !skipService {
|
|
|
|
} else if _, found := destination_services[service.Namespace+"/"+service.Name]; found && !skipService {
|
|
|
|
myServices = append(myServices, service)
|
|
|
|
myServices = append(myServices, service)
|
|
|
|
|