Skip to content

Commit

Permalink
remove log and add comment
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Rae Kim <yikim@redhat.com>
  • Loading branch information
yiraeChristineKim committed Mar 31, 2023
1 parent 7633b89 commit 5ed7ddc
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions controllers/configurationpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1066,13 +1066,6 @@ func (r *ConfigurationPolicyReconciler) handleObjectTemplates(plc policyv1.Confi
handled := false
// iterate through all namespaces the configurationpolicy is set on
for _, ns := range relevantNamespaces {
log.Info(
"Handling the object template for the relevant namespace",
"namespace", ns,
"desiredName", templateObjs[indx].name,
"index", indx,
)

names, compliant, reason, objKind, related, statusUpdateNeeded := r.handleObjects(
objectT, ns, templateObjs[indx], indx, &plc,
)
Expand All @@ -1090,17 +1083,16 @@ func (r *ConfigurationPolicyReconciler) handleObjectTemplates(plc policyv1.Confi
names = append([]string{}, templateObjs[indx].name)
}

// object template enforced, already handled in handleObjects
if names == nil {
handled = true
} else {
enforce = false
}

log.Info(
"eupper----- merge",
"names", names,
)

// violations for enforce configurationpolicies are already handled in handleObjects,
// so we only need to generate a violation if the remediationAction is set to inform
// Or multiple namespaces and enforce use this
if mergeMessageEnforce || (!handled && !enforce) {
if !compliant {
if len(names) == 0 {
Expand Down Expand Up @@ -1142,17 +1134,8 @@ func (r *ConfigurationPolicyReconciler) handleObjectTemplates(plc policyv1.Confi
}
}

log.Info(
"outside merge",
"namespacenumber", len(relevantNamespaces),
)
// In case, when enforce and multiple namespaces, it creates integrated messages,
// When enforce and multiple namespaces, it creates integrated messages,
if mergeMessageEnforce {
// In case, when enforce and multiple namespaces, it creates integrated messages,
log.Info(
"inside merge",
)

parentStatusUpdateNeeded = createMergedStatus(
objShouldExist, numCompliant, numNonCompliant, compliantObjects, nonCompliantObjects, &plc, objData,
)
Expand All @@ -1167,6 +1150,7 @@ func (r *ConfigurationPolicyReconciler) handleObjectTemplates(plc policyv1.Confi

// createMergedStatus updates the status field for a configurationpolicy with remediationAction=inform
// based on how many compliant/noncompliant objects are found when processing the templates in the configurationpolicy
// Or multiple namespaces and enforce use this
func createMergedStatus(
objShouldExist bool,
numCompliant,
Expand Down

0 comments on commit 5ed7ddc

Please sign in to comment.