Skip to content
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

[release-4.10] Bug 2099206: Update logging for specific policy when creating it #1149

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 13 additions & 7 deletions go-controller/pkg/ovn/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1141,13 +1141,19 @@ func (oc *Controller) addNetworkPolicy(policy *knet.NetworkPolicy) error {
}
defer nsUnlock()
nsInfo.networkPolicies[policy.Name] = np
// there may have been a namespace update for ACL logging while we were creating the NP
// update it
if err := oc.setACLLoggingForNamespace(policy.Namespace, nsInfo); err != nil {
klog.Warningf(err.Error())
} else {
klog.Infof("Namespace %s: ACL logging setting updated to deny=%s allow=%s",
policy.Namespace, nsInfo.aclLogging.Deny, nsInfo.aclLogging.Allow)
// The allow logging level was updated while we were creating the policy if
// the current allow logging level is different than the one we have from
// the first time we locked the namespace. If this is the case, update the
// policy logging level. We don't care about deny logging level as that only
// applies to the default deny ACLS which were created while the namespace
// was locked.
if nsInfo.aclLogging.Allow != aclLogAllow {
if err := oc.updateACLLoggingForPolicy(np, nsInfo.aclLogging.Allow); err != nil {
klog.Warningf(err.Error())
} else {
klog.Infof("Policy %s: ACL logging setting updated to deny=%s allow=%s",
getPolicyNamespacedName(policy), nsInfo.aclLogging.Deny, nsInfo.aclLogging.Allow)
}
}
return nil
}
Expand Down